[]Struct gtk::ModelButton

pub struct ModelButton(_, _);

ModelButton is a button class that can use a gio::Action as its model. In contrast to ToggleButton or RadioButton, which can also be backed by a gio::Action via the Actionable:action-name property, ModelButton will adapt its appearance according to the kind of action it is backed by, and appear either as a plain, check or radio button.

Model buttons are used when popovers from a menu model with Popover::new_from_model; they can also be used manually in a PopoverMenu.

When the action is specified via the Actionable:action-name and Actionable:action-target properties, the role of the button (i.e. whether it is a plain, check or radio button) is determined by the type of the action and doesn't have to be explicitly specified with the ModelButton:role property.

The content of the button is specified by the ModelButton:text and ModelButton:icon properties.

The appearance of model buttons can be influenced with the ModelButton:centered and ModelButton:iconic properties.

Model buttons have built-in support for submenus in PopoverMenu. To make a ModelButton that opens a submenu when activated, set the ModelButton:menu-name property. To make a button that goes back to the parent menu, you should set the ModelButton:inverted property to place the submenu indicator at the opposite side.

Example

modelbutton
├── <child>
╰── check
modelbutton
├── <child>
╰── radio
modelbutton
├── <child>
╰── arrow

ModelButton has a main CSS node with name modelbutton, and a subnode, which will have the name check, radio or arrow, depending on the role of the button and whether it has a menu name set.

The subnode is positioned before or after the content nodes and gets the .left or .right style class, depending on where it is located.

button.model
├── <child>
╰── check

Iconic model buttons (see ModelButton:iconic) change the name of their main node to button and add a .model style class to it. The indicator subnode is invisible in this case.

Feature: v3_16

Implements

ButtonExt, BinExt, ContainerExt, WidgetExt, glib::object::ObjectExt, BuildableExt, ActionableExt, WidgetExtManual, BuildableExtManual

Implementations

impl ModelButton[src]

pub fn new() -> ModelButton[src]

Creates a new ModelButton.

Feature: v3_16

Returns

the newly created ModelButton widget

pub fn get_property_active(&self) -> bool[src]

The state of the button. This is reflecting the state of the associated gio::Action.

Feature: v3_16

pub fn set_property_active(&self, active: bool)[src]

The state of the button. This is reflecting the state of the associated gio::Action.

Feature: v3_16

pub fn get_property_centered(&self) -> bool[src]

Whether to render the button contents centered instead of left-aligned. This property should be set for title-like items.

Feature: v3_16

pub fn set_property_centered(&self, centered: bool)[src]

Whether to render the button contents centered instead of left-aligned. This property should be set for title-like items.

Feature: v3_16

pub fn get_property_icon(&self) -> Option<Icon>[src]

A gio::Icon that will be used if iconic appearance for the button is desired.

Feature: v3_16

pub fn set_property_icon<P: IsA<Icon> + SetValueOptional>(
    &self,
    icon: Option<&P>
)
[src]

A gio::Icon that will be used if iconic appearance for the button is desired.

Feature: v3_16

pub fn get_property_iconic(&self) -> bool[src]

If this property is set, the button will show an icon if one is set. If no icon is set, the text will be used. This is typically used for horizontal sections of linked buttons.

Feature: v3_16

pub fn set_property_iconic(&self, iconic: bool)[src]

If this property is set, the button will show an icon if one is set. If no icon is set, the text will be used. This is typically used for horizontal sections of linked buttons.

Feature: v3_16

pub fn get_property_inverted(&self) -> bool[src]

Whether to show the submenu indicator at the opposite side than normal. This property should be set for model buttons that 'go back' to a parent menu.

Feature: v3_16

pub fn set_property_inverted(&self, inverted: bool)[src]

Whether to show the submenu indicator at the opposite side than normal. This property should be set for model buttons that 'go back' to a parent menu.

Feature: v3_16

pub fn get_property_menu_name(&self) -> Option<GString>[src]

The name of a submenu to open when the button is activated. If this is set, the button should not have an action associated with it.

Feature: v3_16

pub fn set_property_menu_name(&self, menu_name: Option<&str>)[src]

The name of a submenu to open when the button is activated. If this is set, the button should not have an action associated with it.

Feature: v3_16

pub fn get_property_role(&self) -> ButtonRole[src]

Specifies whether the button is a plain, check or radio button. When Actionable:action-name is set, the role will be determined from the action and does not have to be set explicitly.

Feature: v3_16

pub fn set_property_role(&self, role: ButtonRole)[src]

Specifies whether the button is a plain, check or radio button. When Actionable:action-name is set, the role will be determined from the action and does not have to be set explicitly.

Feature: v3_16

pub fn get_property_text(&self) -> Option<GString>[src]

The label for the button.

Feature: v3_16

pub fn set_property_text(&self, text: Option<&str>)[src]

The label for the button.

Feature: v3_16

pub fn get_property_use_markup(&self) -> bool[src]

If true, XML tags in the text of the button are interpreted as by pango_parse_markup to format the enclosed spans of text. If false, the text will be displayed verbatim.

Feature: v3_24

pub fn set_property_use_markup(&self, use_markup: bool)[src]

If true, XML tags in the text of the button are interpreted as by pango_parse_markup to format the enclosed spans of text. If false, the text will be displayed verbatim.

Feature: v3_24

pub fn connect_property_active_notify<F: Fn(&ModelButton) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

pub fn connect_property_centered_notify<F: Fn(&ModelButton) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

pub fn connect_property_icon_notify<F: Fn(&ModelButton) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

pub fn connect_property_iconic_notify<F: Fn(&ModelButton) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

pub fn connect_property_inverted_notify<F: Fn(&ModelButton) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

pub fn connect_property_menu_name_notify<F: Fn(&ModelButton) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

pub fn connect_property_role_notify<F: Fn(&ModelButton) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

pub fn connect_property_text_notify<F: Fn(&ModelButton) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

pub fn connect_property_use_markup_notify<F: Fn(&ModelButton) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

Trait Implementations

impl Clone for ModelButton

impl Debug for ModelButton

impl Default for ModelButton[src]

impl Display for ModelButton[src]

impl Eq for ModelButton

impl Hash for ModelButton

impl IsA<Actionable> for ModelButton

impl IsA<Bin> for ModelButton

impl IsA<Buildable> for ModelButton

impl IsA<Button> for ModelButton

impl IsA<Container> for ModelButton

impl IsA<Widget> for ModelButton

impl Ord for ModelButton

impl<T: ObjectType> PartialEq<T> for ModelButton

impl<T: ObjectType> PartialOrd<T> for ModelButton

impl StaticType for ModelButton

Auto Trait Implementations

impl RefUnwindSafe for ModelButton

impl !Send for ModelButton

impl !Sync for ModelButton

impl Unpin for ModelButton

impl UnwindSafe for ModelButton

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.