text
For a text-only control, see Label
.
app :: TextView :: defaultinit
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
app :: View :: defaultinit
gtk :: GtkCallable :: defaultinit
app :: Control :: defaultinit
app :: AppComponent :: defaultinit
core :: Object :: defaultinit
core :: Finalizable :: defaultinit
app :: TextView :: defaultinit
app :: AppObserver :: defaultinit
core :: Finalizable :: finalize
Liberate any resources held byself
before the memory holding self
is freed
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
app :: AppComponent :: notify_observers
Propagateevent
to all observers
by calling AppObserver::on_event
app :: AppComponent :: observers
AllAppObserver
notified of events raised by self
app :: AppComponent :: observers=
AllAppObserver
notified of events raised by self
app :: AppComponent :: on_pause
The application leaves the active state but is still partially visibleapp :: AppComponent :: on_restart
The application returns to a visible state from a previouson_stop
app :: AppComponent :: on_restore_state
The application is launching, restore its state from a previouson_save_state
app :: AppComponent :: on_resume
The application enters the active state, it is in the foreground and interactiveapp :: AppComponent :: on_save_state
The application may be destroyed soon, save its state for a futureon_restore_state
app :: AppComponent :: on_start
The application is starting or restarting, it is visible to the usercore :: Object :: output_class_name
Display class name on stdout (debug only).Control
in the control tree
Control
in the control tree
app :: AppComponent
An element of an application that is notified of the application life cyclegtk :: GtkCallable
# A control displaying some `text`
#
# For a text-only control, see `Label`.
abstract class TextView
super View
# Main `Text` of this control
#
# By default, or if set to `null`, no text is shown.
var text: nullable Text is writable, abstract, autoinit
# Set the relative size of the text
#
# A value of 1.0, the default, use the platform default text size.
# Values under 1.0 set a smaller text size, and over 1.0 a larger size.
#
# Implementation varies per platform, and some controls may be unaffected
# depending on the customization options of each platform.
# For consistent results, it is recommended to use only on instances
# of `Label` and `size` should be either 0.5, 1.0 or 1.5.
fun size=(size: nullable Float) is autoinit do end
# Align the text horizontally
#
# Use 0.0 to align left (the default), 0.5 to align in the center and
# 1.0 to align on the right.
#
# Implementation varies per platform, and some controls may be unaffected
# depending on the customization options of each platform.
# For consistent results, it is recommended to use only on instances
# of `Label` and `size` should be either 0.0, 0.5 or 1.0.
fun align=(align: nullable Float) is autoinit do end
end
lib/app/ui.nit:226,1--258,3
redef class TextView
redef type NATIVE: NativeTextView
redef fun text do return native.text.to_s
redef fun text=(value) do
if value == null then value = ""
native.text = value.to_java_string
end
redef fun size=(size) do set_size_native(app.native_activity, native, size or else 1.0)
private fun set_size_native(context: NativeContext, view: NativeTextView, size: Float)
in "Java" `{
int s;
if (size == 1.0d)
s = android.R.style.TextAppearance_Medium;
else if (size < 1.0d)
s = android.R.style.TextAppearance_Small;
else // if (size > 1.0d)
s = android.R.style.TextAppearance_Large;
view.setTextAppearance(context, s);
`}
redef fun align=(align) do set_align_native(native, align or else 0.0)
private fun set_align_native(view: NativeTextView, align: Float)
in "Java" `{
int g;
if (align == 0.5d)
g = android.view.Gravity.CENTER_HORIZONTAL;
else if (align < 0.5d)
g = android.view.Gravity.LEFT;
else // if (align > 0.5d)
g = android.view.Gravity.RIGHT;
view.setGravity(g | android.view.Gravity.CENTER_VERTICAL);
`}
end
lib/android/ui/ui.nit:222,1--260,3