Class: Gtk::Button

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#always_show_imageTrueClass

Returns whether the button will ignore the Gtk::Settings:gtk-button-images setting and always show the image, if available.

Returns:

  • (TrueClass)

    true if the button will always show the image

#always_show_image=(always_show_image) ⇒ TrueClass

If true, the button will ignore the Gtk::Settings:gtk-button-images setting and always show the image, if available.

Use this property if the button would be useless or hard to use without the image.

Parameters:

  • always_show_image (TrueClass)

Returns:

  • (TrueClass)

    always-show-image

  • (TrueClass)

    always-show-image

#always_show_image?TrueClass

If true, the button will ignore the Gtk::Settings:gtk-button-images setting and always show the image, if available.

Use this property if the button would be useless or hard to use without the image.

Returns:

  • (TrueClass)

    always-show-image

#clickednil

Emits a Gtk::Button::clicked signal to the given #GtkButton.

Returns:

  • (nil)

#enternil

Emits a Gtk::Button::enter signal to the given #GtkButton.

Returns:

  • (nil)

#event_windowGdk::Window

Returns the button’s event window if it is realized, nil otherwise. This function should be rarely needed.

Returns:

#focus_on_clickTrueClass

Returns whether the button grabs focus when it is clicked with the mouse. See gtk_button_set_focus_on_click().

Returns:

  • (TrueClass)

    true if the button grabs focus when it is clicked with the mouse.

#focus_on_click=(focus_on_click) ⇒ nil

Sets whether the button will grab focus when it is clicked with the mouse. Making mouse clicks not grab focus is useful in places like toolbars where you don’t want the keyboard focus removed from the main area of the application.

Parameters:

  • focus_on_click (TrueClass)

    whether the button grabs focus when clicked with the mouse

Returns:

  • (nil)

#get_alignment(xalign, yalign) ⇒ nil

Gets the alignment of the child in the button.

Parameters:

  • xalign (Gtk::gfloat)

    return location for horizontal alignment

  • yalign (Gtk::gfloat)

    return location for vertical alignment

Returns:

  • (nil)

#imageGtk::Widget

The child widget to appear next to the button text.

Returns:

#image=(image) ⇒ Gtk::Widget

The child widget to appear next to the button text.

Parameters:

Returns:

#image_positionGtk::PositionType

The position of the image relative to the text inside the button.

Returns:

#image_position=(image_position) ⇒ Gtk::PositionType

The position of the image relative to the text inside the button.

Parameters:

Returns:

#labelString

Returns label.

Returns:

  • (String)

    label

#label=(label) ⇒ String

Parameters:

  • label (String)

Returns:

  • (String)

    label

  • (String)

    label

#leavenil

Emits a Gtk::Button::leave signal to the given #GtkButton.

Returns:

  • (nil)

#newGtk::Widget

Creates a new Gtk::Button widget. To add a child widget to the button, use gtk_container_add().

Returns:

  • (Gtk::Widget)

    The newly created Gtk::Button widget.

#new_from_icon_name(icon_name, size) ⇒ Gtk::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 gtk_button_new() and gtk_button_set_image().

Parameters:

  • icon_name (String)

    an icon name or nil

  • size (Integer)

    an icon size (Gtk::IconSize)

Returns:

  • (Gtk::Widget)

    a new Gtk::Button displaying the themed icon

#new_from_stock(stock_id) ⇒ Gtk::Widget

Creates a new Gtk::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 gtk_button_new_with_mnemonic()).

Parameters:

  • stock_id (String)

    the name of the stock item

Returns:

#new_with_label(label) ⇒ Gtk::Widget

Creates a Gtk::Button widget with a #GtkLabel child containing the given text.

Parameters:

  • label (String)

    The text you want the Gtk::Label to hold.

Returns:

  • (Gtk::Widget)

    The newly created Gtk::Button widget.

#new_with_mnemonic(label) ⇒ Gtk::Widget

Creates a new Gtk::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.

Parameters:

  • label (String)

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

Returns:

#pressednil

Emits a Gtk::Button::pressed signal to the given #GtkButton.

Returns:

  • (nil)

#releasednil

Emits a Gtk::Button::released signal to the given #GtkButton.

Returns:

  • (nil)

#reliefGtk::ReliefStyle

Returns relief.

Returns:

#relief=(relief) ⇒ Gtk::ReliefStyle

Parameters:

Returns:

#set_alignment(xalign, yalign) ⇒ nil

Sets the alignment of the child. This property has no effect unless the child is a Gtk::Misc or a #GtkAlignment.

Parameters:

  • xalign (Gtk::gfloat)

    the horizontal position of the child, 0.0 is left aligned, 1.0 is right aligned

  • yalign (Gtk::gfloat)

    the vertical position of the child, 0.0 is top aligned, 1.0 is bottom aligned

Returns:

  • (nil)

#use_stockTrueClass

Returns whether the button label is a stock item.

Returns:

  • (TrueClass)

    true if the button label is used to select a stock item instead of being used directly as the label text.

#use_stock=(use_stock) ⇒ TrueClass

Parameters:

  • use_stock (TrueClass)

Returns:

  • (TrueClass)

    use-stock

  • (TrueClass)

    use-stock

#use_stock?TrueClass

Returns use-stock.

Returns:

  • (TrueClass)

    use-stock

#use_underlineTrueClass

Returns whether an embedded underline in the button label indicates a mnemonic. See gtk_button_set_use_underline ().

Returns:

  • (TrueClass)

    true if an embedded underline in the button label indicates the mnemonic accelerator keys.

#use_underline=(use_underline) ⇒ TrueClass

Parameters:

  • use_underline (TrueClass)

Returns:

  • (TrueClass)

    use-underline

  • (TrueClass)

    use-underline

#use_underline?TrueClass

Returns use-underline.

Returns:

  • (TrueClass)

    use-underline

#xalignGtk::gfloat

If the child of the button is a Gtk::Misc or #GtkAlignment, this property can be used to control its horizontal alignment. 0.0 is left aligned, 1.0 is right aligned.

Returns:

  • (Gtk::gfloat)

    xalign

#xalign=(xalign) ⇒ Gtk::gfloat

If the child of the button is a Gtk::Misc or #GtkAlignment, this property can be used to control its horizontal alignment. 0.0 is left aligned, 1.0 is right aligned.

Parameters:

  • xalign (Gtk::gfloat)

Returns:

  • (Gtk::gfloat)

    xalign

  • (Gtk::gfloat)

    xalign

#yalignGtk::gfloat

If the child of the button is a Gtk::Misc or #GtkAlignment, this property can be used to control its vertical alignment. 0.0 is top aligned, 1.0 is bottom aligned.

Returns:

  • (Gtk::gfloat)

    yalign

#yalign=(yalign) ⇒ Gtk::gfloat

If the child of the button is a Gtk::Misc or #GtkAlignment, this property can be used to control its vertical alignment. 0.0 is top aligned, 1.0 is bottom aligned.

Parameters:

  • yalign (Gtk::gfloat)

Returns:

  • (Gtk::gfloat)

    yalign

  • (Gtk::gfloat)

    yalign