GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

GFC::Gtk::Button Class Reference

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

#include <gfc/gtk/button.hh>

Inheritance diagram for GFC::Gtk::Button:

GFC::Gtk::Bin GFC::Gtk::Container GFC::Gtk::Widget GFC::Gtk::Object GFC::Atk::Implementor GFC::G::Object GFC::G::TypeInterface GFC::G::TypeInstance GFC::G::TypeInstance GFC::Trackable GFC::Trackable GFC::Gtk::ColorButton GFC::Gtk::FontButton GFC::Gtk::ToggleButton GFC::Gtk::CheckButton GFC::Gtk::RadioButton List of all members.

Signal Prototypes

Public Member Functions

Constructors
Accessors
Methods
Signal Proxies

Protected Member Functions

Constructors

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

GFC::Gtk::Button::Button GtkButton *  button,
bool  owns_reference = false
[explicit, protected]
 

Construct a new Button from an existing GtkButton.

Parameters:
button A pointer to a GtkButton.
owns_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).

GFC::Gtk::Button::Button Image image  )  [explicit]
 

Constructs a Button widget that contains an Image.

Parameters:
image The Image you want the Button to contain.

GFC::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.

GFC::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.

GFC::Gtk::Button::Button const StockId stock_id  )  [explicit]
 

Constructs a new Button containing the image and text from a stock item.

Parameters:
stock_id The stock ID for a stock item.

Some stock IDs are pre-registered like Gtk::StockId::OK and Gtk::StockId::APPLY. If stock_id is unknown, then it will be treated as a mnemonic label.


Member Function Documentation

void GFC::Gtk::Button::get_alignment float *  xalign,
float *  yalign
 

Gets the alignment of the child in the button.

Parameters:
xalign The return location for horizontal alignment.
yalign The return location for vertical alignment.

bool GFC::Gtk::Button::get_focus_on_click  )  const
 

Determines whether the button grabs focus when it is clicked with the mouse.

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

String GFC::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 GFC::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.

void GFC::Gtk::Button::set_alignment float  xalign,
float  yalign
 

Sets the alignment of the child.

Parameters:
xalign The horizontal position of the child, 0.0 is left aligned, 1.0 is right aligned.
yalign The vertical position of the child, 0.0 is top aligned, 1.0 is bottom aligned.

This method has no effect unless the child is of type GTK_TYPE_MISC or GTK_TYPE_ALIGNMENT.

void GFC::Gtk::Button::set_focus_on_click bool  focus_on_click  ) 
 

Sets whether the button will grab focus when it is clicked with the mouse.

Parameters:
focus_on_click Whether the mouse grabs focus when 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.

void GFC::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 GFC::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 GFC::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 GFC::Gtk::Button::set_stock_id const StockId stock_id  ) 
 

Sets the button image and text from a stock item.

Parameters:
stock_id The stock ID for a stock item.

This is a convenience method for setting a stock item and is equivalent to calling set_label(), set_use_stock() and set_use_underline(). Some stock IDs are pre-registered like Gtk::StockId::OK and Gtk::StockId::APPLY. If stock_id is unknown, then it will be treated as a mnemonic label.

void GFC::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 GFC::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 GFC::Gtk::Button::sig_clicked  ) 
 

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.


Member Data Documentation

const ActivateSignalType GFC::Gtk::Button::activate_signal [static, protected]
 

Activate signal (see sig_activate()).

Calls a slot with the signature:

             void function();

const ClickedSignalType GFC::Gtk::Button::clicked_signal [static, protected]
 

Clicked signal (see sig_clicked()).

Calls a slot with the signature:

             void function();

const EnterSignalType GFC::Gtk::Button::enter_signal [static, protected]
 

Enter signal (see sig_enter()).

Calls a slot with the signature:

             void function();

const LeaveSignalType GFC::Gtk::Button::leave_signal [static, protected]
 

Leave signal (see sig_leave()).

Calls a slot with the signature:

             void function();

const PressedSignalType GFC::Gtk::Button::pressed_signal [static, protected]
 

Pressed signal (see sig_pressed()).

Calls a slot with the signature:

             void function();

const ReleasedSignalType GFC::Gtk::Button::released_signal [static, protected]
 

Released signal (see sig_released()).

Calls a slot with the signature:

             void function();


The documentation for this class was generated from the following file:
Generated on Tue Aug 24 00:34:37 2004 for GFC-UI by doxygen 1.3.8