[−]Struct gtk::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]
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]
&self,
icon: Option<&P>
)
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]
&self,
f: F
) -> SignalHandlerId
pub fn connect_property_centered_notify<F: Fn(&ModelButton) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
pub fn connect_property_icon_notify<F: Fn(&ModelButton) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
pub fn connect_property_iconic_notify<F: Fn(&ModelButton) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
pub fn connect_property_inverted_notify<F: Fn(&ModelButton) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
pub fn connect_property_menu_name_notify<F: Fn(&ModelButton) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
pub fn connect_property_role_notify<F: Fn(&ModelButton) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
pub fn connect_property_text_notify<F: Fn(&ModelButton) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
pub fn connect_property_use_markup_notify<F: Fn(&ModelButton) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
Trait Implementations
impl Clone for ModelButton
fn clone(&self) -> ModelButton
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ModelButton
impl Default for ModelButton
[src]
impl Display for ModelButton
[src]
impl Eq for ModelButton
impl Hash for ModelButton
fn hash<__H: Hasher>(&self, state: &mut __H)
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
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
fn cmp(&self, other: &ModelButton) -> Ordering
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: ObjectType> PartialEq<T> for ModelButton
impl<T: ObjectType> PartialOrd<T> for ModelButton
fn partial_cmp(&self, other: &T) -> Option<Ordering>
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StaticType for ModelButton
fn static_type() -> Type
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<Super, Sub> CanDowncast<Sub> for Super where
Sub: IsA<Super>,
Super: IsA<Super>,
Sub: IsA<Super>,
Super: IsA<Super>,
impl<T> Cast for T where
T: ObjectType,
T: ObjectType,
fn upcast<T>(self) -> T where
Self: IsA<T>,
T: ObjectType,
Self: IsA<T>,
T: ObjectType,
fn upcast_ref<T>(&self) -> &T where
Self: IsA<T>,
T: ObjectType,
Self: IsA<T>,
T: ObjectType,
fn downcast<T>(self) -> Result<T, Self> where
Self: CanDowncast<T>,
T: ObjectType,
Self: CanDowncast<T>,
T: ObjectType,
fn downcast_ref<T>(&self) -> Option<&T> where
Self: CanDowncast<T>,
T: ObjectType,
Self: CanDowncast<T>,
T: ObjectType,
fn dynamic_cast<T>(self) -> Result<T, Self> where
T: ObjectType,
T: ObjectType,
fn dynamic_cast_ref<T>(&self) -> Option<&T> where
T: ObjectType,
T: ObjectType,
unsafe fn unsafe_cast<T>(self) -> T where
T: ObjectType,
T: ObjectType,
unsafe fn unsafe_cast_ref<T>(&self) -> &T where
T: ObjectType,
T: ObjectType,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ObjectExt for T where
T: ObjectType,
T: ObjectType,
fn is<U>(&self) -> bool where
U: StaticType,
U: StaticType,
fn get_type(&self) -> Type
fn get_object_class(&self) -> &ObjectClass
fn set_properties(
&self,
property_values: &[(&str, &dyn ToValue)]
) -> Result<(), BoolError>
&self,
property_values: &[(&str, &dyn ToValue)]
) -> Result<(), BoolError>
fn set_property<'a, N>(
&self,
property_name: N,
value: &dyn ToValue
) -> Result<(), BoolError> where
N: Into<&'a str>,
&self,
property_name: N,
value: &dyn ToValue
) -> Result<(), BoolError> where
N: Into<&'a str>,
fn get_property<'a, N>(&self, property_name: N) -> Result<Value, BoolError> where
N: Into<&'a str>,
N: Into<&'a str>,
unsafe fn set_qdata<QD>(&self, key: Quark, value: QD) where
QD: 'static,
QD: 'static,
unsafe fn get_qdata<QD>(&self, key: Quark) -> Option<&QD> where
QD: 'static,
QD: 'static,
unsafe fn steal_qdata<QD>(&self, key: Quark) -> Option<QD> where
QD: 'static,
QD: 'static,
unsafe fn set_data<QD>(&self, key: &str, value: QD) where
QD: 'static,
QD: 'static,
unsafe fn get_data<QD>(&self, key: &str) -> Option<&QD> where
QD: 'static,
QD: 'static,
unsafe fn steal_data<QD>(&self, key: &str) -> Option<QD> where
QD: 'static,
QD: 'static,
fn block_signal(&self, handler_id: &SignalHandlerId)
fn unblock_signal(&self, handler_id: &SignalHandlerId)
fn stop_signal_emission(&self, signal_name: &str)
fn disconnect(&self, handler_id: SignalHandlerId)
fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId where
F: 'static + Send + Sync + Fn(&T, &ParamSpec),
F: 'static + Send + Sync + Fn(&T, &ParamSpec),
unsafe fn connect_notify_unsafe<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: Fn(&T, &ParamSpec),
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: Fn(&T, &ParamSpec),
fn notify<'a, N>(&self, property_name: N) where
N: Into<&'a str>,
N: Into<&'a str>,
fn notify_by_pspec(&self, pspec: &ParamSpec)
fn has_property<'a, N>(&self, property_name: N, type_: Option<Type>) -> bool where
N: Into<&'a str>,
N: Into<&'a str>,
fn get_property_type<'a, N>(&self, property_name: N) -> Option<Type> where
N: Into<&'a str>,
N: Into<&'a str>,
fn find_property<'a, N>(&self, property_name: N) -> Option<ParamSpec> where
N: Into<&'a str>,
N: Into<&'a str>,
fn list_properties(&self) -> Vec<ParamSpec>
fn connect<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value> + Send + Sync + 'static,
N: Into<&'a str>,
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value> + Send + Sync + 'static,
N: Into<&'a str>,
fn connect_local<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value> + 'static,
N: Into<&'a str>,
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value> + 'static,
N: Into<&'a str>,
unsafe fn connect_unsafe<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value>,
N: Into<&'a str>,
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value>,
N: Into<&'a str>,
fn emit<'a, N>(
&self,
signal_name: N,
args: &[&dyn ToValue]
) -> Result<Option<Value>, BoolError> where
N: Into<&'a str>,
&self,
signal_name: N,
args: &[&dyn ToValue]
) -> Result<Option<Value>, BoolError> where
N: Into<&'a str>,
fn downgrade(&self) -> WeakRef<T>
fn bind_property<'a, O, N, M>(
&'a self,
source_property: N,
target: &'a O,
target_property: M
) -> BindingBuilder<'a> where
M: Into<&'a str>,
N: Into<&'a str>,
O: ObjectType,
&'a self,
source_property: N,
target: &'a O,
target_property: M
) -> BindingBuilder<'a> where
M: Into<&'a str>,
N: Into<&'a str>,
O: ObjectType,
fn ref_count(&self) -> u32
impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
t: &'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
fn to_glib_container_from_slice(
_t: &'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
_t: &'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
fn to_glib_full_from_slice(_t: &[T]) -> *const GList
impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
t: &'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
fn to_glib_container_from_slice(
_t: &'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
_t: &'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
fn to_glib_full_from_slice(_t: &[T]) -> *const GPtrArray
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
t: &'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
fn to_glib_container_from_slice(
t: &'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
t: &'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
fn to_glib_full_from_slice(t: &[T]) -> *mut GArray
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
t: &'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
fn to_glib_container_from_slice(
t: &'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
t: &'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
fn to_glib_full_from_slice(t: &[T]) -> *mut GList
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
t: &'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
fn to_glib_container_from_slice(
t: &'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
t: &'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
fn to_glib_full_from_slice(t: &[T]) -> *mut GPtrArray
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToSendValue for T where
T: ToValue + SetValue + Send + ?Sized,
T: ToValue + SetValue + Send + ?Sized,
fn to_send_value(&self) -> SendValue
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> ToValue for T where
T: SetValue + ?Sized,
T: SetValue + ?Sized,
fn to_value(&self) -> Value
fn to_value_type(&self) -> Type
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,