app :: CheckBox :: defaultinit
app :: CheckBox :: is_checked=
Is this control in the checked/on state?app :: CheckBox :: ui_switch=
UISwitch
acting as the real check box
android :: ui $ CheckBox :: is_checked
Is this control in the checked/on state?ios :: ui $ CheckBox :: is_checked
Is this control in the checked/on state?linux :: ui $ CheckBox :: is_checked
Is this control in the checked/on state?ios :: ui $ CheckBox :: is_checked=
Is this control in the checked/on state?android :: ui $ CheckBox :: is_checked=
Is this control in the checked/on state?linux :: ui $ CheckBox :: is_checked=
Is this control in the checked/on state?core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
app :: CheckBox :: defaultinit
gtk :: GtkCallable :: defaultinit
core :: Object :: defaultinit
core :: Finalizable :: defaultinit
app :: View :: defaultinit
app :: TextView :: defaultinit
app :: AppObserver :: defaultinit
app :: AppComponent :: defaultinit
app :: Control :: defaultinit
core :: Finalizable :: finalize
Liberate any resources held byself
before the memory holding self
is freed
app :: CheckBox :: is_checked=
Is this control in the checked/on state?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 :: CheckBox :: ui_switch=
UISwitch
acting as the real check box
app :: AppComponent
An element of an application that is notified of the application life cyclegtk :: GtkCallable
# On iOS, check boxes are a layout composed of a label and an `UISwitch`
redef class CheckBox
redef type NATIVE: UIStackView
redef fun native do return layout.native
# Root layout implementing this check box
var layout = new HorizontalLayout(parent=self.parent)
# Label with the text
var lbl = new Label(parent=layout)
# `UISwitch` acting as the real check box
var ui_switch: UISwitch is noautoinit
redef fun on_ios_event do notify_observers new ToggleEvent(self)
init
do
# Tweak the layout so it is centered
layout.native.distribution = new UIStackViewDistribution.equal_spacing
layout.native.alignment = new UIStackViewAlignment.fill
layout.native.layout_margins_relative_arrangement = true
var s = new UISwitch
native.add_arranged_subview s
ui_switch = s
ui_switch.set_callback self
end
redef fun text=(text) do lbl.text = text
redef fun text do return lbl.text
redef fun is_checked do return ui_switch.on
redef fun is_checked=(value) do ui_switch.set_on_animated(value, true)
end
lib/ios/ui/ui.nit:306,1--342,3
redef class CheckBox
redef type NATIVE: GtkCheckButton
redef var native = new GtkCheckButton
redef fun signal(sender, data) do notify_observers new ToggleEvent(self)
init do native.signal_connect("toggled", self, null)
redef fun text do return native.text
redef fun text=(value) do native.text = (value or else "").to_s
redef fun is_checked do return native.active
redef fun is_checked=(value) do native.active = value
end
lib/linux/ui.nit:314,1--326,3
redef class CheckBox
redef type NATIVE: Android_widget_CompoundButton
redef var native do return (new Android_widget_CheckBox(app.native_activity)).new_global_ref
init do set_callback_on_toggle(native)
redef fun is_checked do return native.is_checked
redef fun is_checked=(value) do native.set_checked(value)
private fun on_toggle do notify_observers new ToggleEvent(self)
private fun set_callback_on_toggle(view: NATIVE)
import on_toggle in "Java" `{
final nit.app.NitObject final_sender_object = self;
CheckBox_incr_ref(final_sender_object);
view.setOnCheckedChangeListener(
new android.widget.CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(android.widget.CompoundButton buttonView, boolean isChecked) {
CheckBox_on_toggle(final_sender_object);
}
});
`}
end
lib/android/ui/ui.nit:267,1--290,3