pub trait SwitchExt: 'static {
fn is_active(&self) -> bool;
fn state(&self) -> bool;
fn set_active(&self, is_active: bool);
fn set_state(&self, state: bool);
fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn emit_activate(&self);
fn connect_state_set<F: Fn(&Self, bool) -> Inhibit + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_active_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_state_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
}
Expand description
Required Methods
fn set_active(&self, is_active: bool)
fn set_active(&self, is_active: bool)
fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
The ::activate signal on GtkSwitch is an action signal and emitting it causes the switch to animate. Applications should never connect to this signal, but use the notify::active signal.
fn emit_activate(&self)
fn connect_state_set<F: Fn(&Self, bool) -> Inhibit + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_state_set<F: Fn(&Self, bool) -> Inhibit + 'static>(
&self,
f: F
) -> SignalHandlerId
The ::state-set signal on GtkSwitch is emitted to change the underlying
state. It is emitted when the user changes the switch position. The
default handler keeps the state in sync with the property::Switch::active
property.
To implement delayed state change, applications can connect to this signal,
initiate the change of the underlying state, and call set_state()
when the underlying state change is complete. The signal handler should
return true
to prevent the default handler from running.
Visually, the underlying state is represented by the trough color of
the switch, while the property::Switch::active
property is represented by the
position of the switch.
state
the new state of the switch
Returns
true
to stop the signal emission