[][src]Trait gtk::SwitchExt

pub trait SwitchExt: 'static {
    fn get_active(&self) -> bool;
fn get_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_property_active_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_state_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; }

Trait containing all Switch methods.

Implementors

Switch

Required methods

fn get_active(&self) -> bool

Gets whether the Switch is in its “on” or “off” state.

Returns

true if the Switch is active, and false otherwise

fn get_state(&self) -> bool

Gets the underlying state of the Switch.

Returns

the underlying state

fn set_active(&self, is_active: bool)

Changes the state of self to the desired one.

is_active

true if self should be active, and false otherwise

fn set_state(&self, state: bool)

Sets the underlying state of the Switch.

Normally, this is the same as Switch:active, unless the switch is set up for delayed state changes. This function is typically called from a Switch::state-set signal handler.

See Switch::state-set for details.

state

the new state

fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

The ::activate signal on Switch 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

The ::state-set signal on Switch 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 Switch:active property.

To implement delayed state change, applications can connect to this signal, initiate the change of the underlying state, and call SwitchExt::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 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

fn connect_property_active_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_state_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

Loading content...

Implementors

impl<O: IsA<Switch>> SwitchExt for O[src]

Loading content...