Trait gtk::prelude::ToggleButtonExt
source · [−]pub trait ToggleButtonExt: 'static {
Show 13 methods
fn is_active(&self) -> bool;
fn is_inconsistent(&self) -> bool;
fn is_mode(&self) -> bool;
fn set_active(&self, is_active: bool);
fn set_inconsistent(&self, setting: bool);
fn set_mode(&self, draw_indicator: bool);
fn toggled(&self);
fn draws_indicator(&self) -> bool;
fn set_draw_indicator(&self, draw_indicator: bool);
fn connect_toggled<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_active_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_draw_indicator_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_inconsistent_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
}
Expand description
Required Methods
Queries a ToggleButton
and returns its current state. Returns true
if
the toggle button is pressed in and false
if it is raised.
Returns
a gboolean
value.
fn is_inconsistent(&self) -> bool
fn is_inconsistent(&self) -> bool
Gets the value set by set_inconsistent()
.
Returns
true
if the button is displayed as inconsistent, false
otherwise
Retrieves whether the button is displayed as a separate indicator
and label. See set_mode()
.
Returns
true
if the togglebutton is drawn as a separate indicator
and label.
fn set_active(&self, is_active: bool)
fn set_active(&self, is_active: bool)
fn set_inconsistent(&self, setting: bool)
fn set_inconsistent(&self, setting: bool)
If the user has selected a range of elements (such as some text or
spreadsheet cells) that are affected by a toggle button, and the
current values in that range are inconsistent, you may want to
display the toggle in an “in between” state. This function turns on
“in between” display. Normally you would turn off the inconsistent
state again if the user toggles the toggle button. This has to be
done manually, set_inconsistent()
only affects
visual appearance, it doesn’t affect the semantics of the button.
setting
true
if state is inconsistent
Sets whether the button is displayed as a separate indicator and label.
You can call this function on a checkbutton or a radiobutton with
draw_indicator
= false
to make the button look like a normal button.
This can be used to create linked strip of buttons that work like
a StackSwitcher
.
This function only affects instances of classes like CheckButton
and RadioButton
that derive from ToggleButton
,
not instances of ToggleButton
itself.
draw_indicator
if true
, draw the button as a separate indicator
and label; if false
, draw the button like a normal button
Emits the signal::ToggleButton::toggled
signal on the
ToggleButton
. There is no good reason for an
application ever to call this function.
fn draws_indicator(&self) -> bool
fn set_draw_indicator(&self, draw_indicator: bool)
fn connect_toggled<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_toggled<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Should be connected if you wish to perform an action whenever the
ToggleButton
’s state is changed.