[]Struct gtk::Button

pub struct Button(_, _);

The Button widget is generally used to trigger a callback function that is called when the button is pressed. The various signals and how to use them are outlined below.

The Button widget can hold any valid child widget. That is, it can hold almost any other standard Widget. The most commonly used child is the Label.

CSS nodes

Button has a single CSS node with name button. The node will get the style classes .image-button or .text-button, if the content is just an image or label, respectively. It may also receive the .flat style class.

Other style classes that are commonly used with Button include .suggested-action and .destructive-action. In special cases, buttons can be made round by adding the .circular style class.

Button-like widgets like ToggleButton, MenuButton, VolumeButton, LockButton, ColorButton, FontButton or FileChooserButton use style classes such as .toggle, .popup, .scale, .lock, .color, .font, .file to differentiate themselves from a plain Button.

Implements

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

Methods

impl Button
[src]

Creates a new Button widget. To add a child widget to the button, use ContainerExt::add.

Returns

The newly created Button widget.

Creates a new button containing an icon from the current icon theme.

If the icon name isn’t known, a “broken image” icon will be displayed instead. If the current icon theme is changed, the icon will be updated appropriately.

This function is a convenience wrapper around Button::new and ButtonExt::set_image.

Feature: v3_10

icon_name

an icon name or None

size

an icon size (IconSize)

Returns

a new Button displaying the themed icon

Creates a new Button containing the image and text from a stock item. Some stock ids have preprocessor macros like GTK_STOCK_OK and GTK_STOCK_APPLY.

If stock_id is unknown, then it will be treated as a mnemonic label (as for Button::new_with_mnemonic).

Deprecated since 3.10

Use Button::new_with_label instead.

stock_id

the name of the stock item

Returns

a new Button

Creates a Button widget with a Label child containing the given text.

label

The text you want the Label to hold.

Returns

The newly created Button widget.

Creates a new Button containing a label. If characters in label are preceded by an underscore, they are underlined. If you need a literal underscore character in a label, use “__” (two underscores). The first underlined character represents a keyboard accelerator called a mnemonic. Pressing Alt and that key activates the button.

label

The text of the button, with an underscore in front of the mnemonic character

Returns

a new Button

Trait Implementations

impl<T: IsA<Object>> PartialOrd<T> for Button

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Default for Button
[src]

impl Ord for Button

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl<T: IsA<Object>> PartialEq<T> for Button

This method tests for !=.

impl Clone for Button

Performs copy-assignment from source. Read more

impl Eq for Button

impl Debug for Button

impl Hash for Button

Feeds a slice of this type into the given [Hasher]. Read more

impl IsA<Bin> for Button

impl IsA<Container> for Button

impl IsA<Widget> for Button

impl IsA<Buildable> for Button

impl IsA<Actionable> for Button

impl IsA<Object> for Button

impl IsA<Button> for CheckButton

impl IsA<Button> for ColorButton

impl IsA<Button> for FontButton

impl IsA<Button> for LinkButton

impl IsA<Button> for LockButton

impl IsA<Button> for MenuButton

impl IsA<Button> for ModelButton

impl IsA<Button> for RadioButton

impl IsA<Button> for ScaleButton

impl IsA<Button> for ToggleButton

impl IsA<Button> for VolumeButton

impl StaticType for Button

Auto Trait Implementations

impl !Send for Button

impl !Sync for Button

Blanket Implementations

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

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

impl<T> From for T
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

impl<'a, T> ToGlibContainerFromSlice for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<T> Cast for T where
    T: IsA<Object>, 
[src]

Upcasts an object to a superclass or interface T. Read more

Upcasts an object to a reference of its superclass or interface T. Read more

Tries to downcast to a subclass or interface implementor T. Read more

Tries to downcast to a reference of its subclass or interface implementor T. Read more

Returns true if the object is an instance of (can be cast to) T.

Tries to cast to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Tries to cast to reference to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

impl<T> IsA for T where
    T: StaticType + Wrapper + Into<ObjectRef> + UnsafeFrom<ObjectRef> + ToGlibPtr<'a, *mut <T as Wrapper>::GlibType>, 
[src]

impl<Super, Sub> Downcast for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 
[src]

impl<T> ObjectExt for T where
    T: IsA<Object> + SetValue
[src]

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