Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gtk::Button Class Reference

A GtkButton C++ wrapper class. More...

`#include <inti/gtk/button.h>`

Inheritance diagram for Inti::Gtk::Button:

List of all members.

## Public Member Functions

Constructors

- Button ()
    Constructs an empty Button widget.
- Button (Image &image)
    Constructs a Button widget that contains an Image.
- Button (const String &label, bool use_underline=false)
    Constructs a Button widget with a Label child containing the given label.
- Button (Image &image, const String &label, bool use_underline=false, bool horizontal=false)
    Sets the image and label for the button.
- virtual ~Button ()
    Destructor.

Accessors

- GtkButton * gtk_button () const
    Get a pointer to the GtkButton structure.
- GtkButtonClass * gtk_button_class () const
    Get a pointer to the GtkButtonClass structure.
- operator GtkButton * () const
    Conversion operator; safely converts a Button to a GtkButton pointer.
- ReliefStyle get_relief () const
    Returns the current relief style of the Button.
- String get_label () const
    Fetches the text from the label of the button, as set by set_label().
- bool get_use_underline () const
    Returns true if an embedded underline in the button label indicates a mnemonic (see set_use_underline()).
- bool get_use_stock () const
    Returns whether the button label is a stock item.

Methods

- void pressed ()
    Emits a Button::pressed_signal to the calling Button.
- void released ()
    Emits a Button::released_signal to the calling Button.
- void clicked ()
    Emits a Button::clicked_signal to the calling Button.
- void enter ()
    Emits a Button::enter_signal to the calling Button.
- void leave ()
    Emits a Button::leave_signal to the calling Button.
- void set_relief (ReliefStyle newstyle)
    Sets the relief style of the edges of the Button.
- void set_label (const String &label)
    Sets the text of the label of the button to label.
- void set_use_underline (bool use_underline)
    Sets whether an underline in the text of the button label indicates the next character should be used for the mnemonic accelerator key.
- void set_use_stock (bool use_stock)
    Sets whether the label set on the button is used as a stock id to select the stock item for the button.
- void set_image (Image &image, const String &label, bool use_underline=false, bool horizontal=false)
    Sets the image and label for the button.

Property Proxies

- const LabelPropertyProxy prop_label ()
    Text of the label widget inside the button, if the button contains a Label (String : Read / Write).
- const UseUnderlinePropertyProxy prop_use_underline ()
    The border relief style (ReliefStyle : Read / Write).
- const UseStockPropertyProxy prop_use_stock ()
    If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key (bool : Read / Write).
- const ReliefPropertyProxy prop_relief ()
    If set, the label is used to pick a stock item instead of being displayed (bool : Read / Write).

Signal Proxies

- const PressedSignalProxy sig_pressed ()
    Connect to the pressed_signal; emitted when the button is initially pressed.
- const ReleasedSignalProxy sig_released ()
    Connect to the released_signal; emitted when a button which is pressed is released, no matter where the mouse cursor is.
- const ClickedSignalProxy sig_clicked ()
    Connect to the clicked_signal; emitted when a button clicked on by the mouse and the cursor stays on the button.
- const EnterSignalProxy sig_enter ()
    Connect to the enter_signal; emitted when the mouse cursor enters the region of the button.
- const LeaveSignalProxy sig_leave ()
    Connect to the leave_signal; emitted when the mouse cursor leaves the region of the button.
- const ActivateSignalProxy sig_activate ()
    Connect to the activate_signal; emitted when the button is activated.

## Protected Member Functions

Constructors

- Button (GtkButton *button, bool reference=false)
    Construct a new Button from an existing GtkButton.

Accessors

- bool depresssed () const
    Returns true if the button is depressed.

Methods

- void set_depressed (bool depressed)
    Sets whether the button is currently drawn as down or not.

Signal Handlers

- virtual void on_pressed ()
    Called when the button is initially pressed.
- virtual void on_released ()
    Called when a button which is pressed is released, no matter where the mouse cursor is.
- virtual void on_clicked ()
    Called when a button clicked on by the mouse and the cursor stays on the button.
- virtual void on_enter ()
    Called when the mouse cursor enters the region of the button.
- virtual void on_leave ()
    Called when the mouse cursor leaves the region of the button.
- virtual void on_activate ()
    Called when the button is activated.

## Detailed Description

A GtkButton C++ wrapper class.

The Button widget is generally used to attach a function to that is called when the button is pressed. The Button widget can hold any valid child widget. That is it can hold most any other standard Widget. The most commonly used child is the Label.

## Constructor & Destructor Documentation

Inti::Gtk::Button::Button | ( | GtkButton * | button,
|  | bool | reference = false
| ) | `[explicit, protected]`

  | Construct a new Button from an existing GtkButton. Parameters:
  button | A pointer to a GtkButton.
  reference | Set false if the initial reference count is floating, set true if it's not.
The button can be a newly created GtkButton or an existing GtkButton. (see G::Object::Object).

Inti::Gtk::Button::Button | ( | Image & | image | ) | `[explicit]`

  | Constructs a Button widget that contains an Image. Parameters:
  image | The Image you want the Button to contain.

Inti::Gtk::Button::Button | ( | const String & | label,
|  | bool | use_underline = false
| ) | `[explicit]`

  | Constructs a Button widget with a Label child containing the given label. Parameters:
  label | The text you want the Label to hold.
  use_underline | Set true if label contains a mnemonic character.
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.

Inti::Gtk::Button::Button | ( | Image & | image,
|  | const String & | label,
|  | bool | use_underline = false,
|  | bool | horizontal = false
| ) |

  | Sets the image and label for the button. Parameters:
  image | The Image you want the button to display.
  label | The text you want the button to display.
  use_underline | Set true if an underline in the label indicates a mnemonic.
  horizontal | Set true if the image and label should be beside each other.
This constructor lets you display an image and a label inside a button, like a toolbar button does. If horizontal is true the label is displayed beside the image. If horizontal is false the label is displayed underneath the image.

## Member Function Documentation

String Inti::Gtk::Button::get_label | ( |  | ) | const

| Fetches the text from the label of the button, as set by set_label(). Returns: The text of the label widget. If the label text has not been set the return value will be a null String. This will be the case if you create an empty button to use as a container.

bool Inti::Gtk::Button::get_use_stock | ( |  | ) | const

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

virtual void Inti::Gtk::Button::on_clicked | ( |  | ) | `[protected, virtual]`

| Called when a button clicked on by the mouse and the cursor stays on the button. If the cursor is not on the button when the mouse button is released, the signal is not emitted.

void Inti::Gtk::Button::set_depressed | ( | bool | depressed | ) | `[protected]`

  | Sets whether the button is currently drawn as down or not. Parameters:
  depressed | Set true if the button should be drawn with a recessed shadow.
This is purely a visual setting, and is meant only for use by derived widgets.

void Inti::Gtk::Button::set_image | ( | Image & | image,
|  | const String & | label,
|  | bool | use_underline = false,
|  | bool | horizontal = false
| ) |

  | Sets the image and label for the button. Parameters:
  image | The Image you want the button to display.
  label | The text you want the button to display.
  use_underline | Set true if an underline in the label indicates a mnemonic.
  horizontal | Set true if the image and label should be beside each other.
This is a convenience method that lets you display an image and a label inside a button, like a toolbar button does. If horizontal is true the label is displayed beside the image. If horizontal is false the label is displayed underneath the image. This method will clear any previously set image or label.

void Inti::Gtk::Button::set_label | ( | const String & | label | ) |

  | Sets the text of the label of the button to label. Parameters:
  label | A String.
This method will clear any previously set label. The text is also used to select the stock item if set_use_stock() is used.

void Inti::Gtk::Button::set_relief | ( | ReliefStyle | newstyle | ) |

  | Sets the relief style of the edges of the Button. Parameters:
  newstyle | The ReliefStyle to set.
Three styles exist, RELIEF_NORMAL, RELIEF_HALF, RELIEF_NONE. The default style is, as one can guess, RELIEF_NORMAL.

void Inti::Gtk::Button::set_use_stock | ( | bool | use_stock | ) |

  | Sets whether the label set on the button is used as a stock id to select the stock item for the button. Parameters:
  use_stock | Set true if the button should use a stock item.

void Inti::Gtk::Button::set_use_underline | ( | bool | use_underline | ) |

  | Sets whether an underline in the text of the button label indicates the next character should be used for the mnemonic accelerator key. Parameters:
  use_underline | Set true if an underline in the text indicates a mnemonic.

const ClickedSignalProxy Inti::Gtk::Button::sig_clicked | ( |  | ) | `[inline]`

| Connect to the clicked_signal; emitted when a button clicked on by the mouse and the cursor stays on the button. If the cursor is not on the button when the mouse button is released, the signal is not emitted.

The documentation for this class was generated from the following file:

- button.h

Main Page - Footer