This package implements a general button widget. This button can be clicked on by the user to start any action. This button does not have multiple states, it can just be temporarily pressed while the mouse is on it, but does not keep its pressed state.
The gtk+ sources provide the following drawing that explains the role of the various spacings that can be set for a button:
+------------------------------------------------+ | BORDER | | +------------------------------------------+ | | |\\\\\\\\\\\\\\\\DEFAULT\\\\\\\\\\\\\\\\\ | | | |\\+------------------------------------+ | | | |\\| | SPACING 3 | | | | | |\\| +--------------------------------+ | | | | |\\| |########## FOCUS ###############| | | | | |\\| |#+----------------------------+#| | | | | |\\| |#| RELIEF \|#| | | | | |\\| |#| +-----------------------+\|#| | | | | |\\|1|#| + THE TEXT +\|#|2| | | | |\\| |#| +-----------------------+\|#| | | | | |\\| |#| \\\\\ ythickness \\\\\\\\\\|#| | | | | |\\| |#+----------------------------+#| | | | | |\\| |########### 1 ##################| | | | | |\\| +--------------------------------+ | | | | |\\| | default spacing 4 | | | | | |\\+------------------------------------+ | | | |\ ythickness | | | +------------------------------------------+ | | border_width | +------------------------------------------------+
Widget Hierarchy |
---|
GObject (see section Package Glib.Object) Gtk_Object (see section Package Gtk.Object) \___ Gtk_Widget (see section Package Gtk.Widget) \___ Gtk_Container (see section Package Gtk.Container) \___ Gtk_Bin (see section Package Gtk.Bin) \___ Gtk_Button (see section Package Gtk.Button) |
Signals |
---|
Subprograms |
---|
procedure Gtk_New (Button : out Gtk_Button; Label : UTF8_String := ""); | ||
Create a new button. | ||
procedure Gtk_New_From_Stock (Button : out Gtk_Button; Stock_Id : String); | ||
Create a new button containing the image and text from a stock item. | ||
procedure Gtk_New_With_Mnemonic (Button : out Gtk_Button; Label : UTF8_String); | ||
Create a new button containing a label. | ||
procedure Initialize_From_Stock (Button : access Gtk_Button_Record'Class; Stock_Id : String); | ||
Internal initialization function.
| ||
procedure Initialize_With_Mnemonic (Button : access Gtk_Button_Record'Class; Label : UTF8_String); | ||
Internal initialization function.
| ||
function Get_Type return Gtk.Gtk_Type; | ||
Return the internal value associated with a Gtk_Button.
| ||
procedure Set_Relief (Button : access Gtk_Button_Record; New_Style : Gtk.Enums.Gtk_Relief_Style); | ||
Modify the relief style for the button. | ||
function Get_Relief (Button : access Gtk_Button_Record) return Gtk.Enums.Gtk_Relief_Style; | ||
Get the current relief style for the button
| ||
procedure Set_Label (Button : access Gtk_Button_Record; Label : UTF8_String); | ||
Set the label of the button.
| ||
function Get_Label (Button : access Gtk_Button_Record) return UTF8_String; | ||
Return the label of the button.
| ||
procedure Set_Use_Underline (Button : access Gtk_Button_Record; Use_Underline : Boolean); | ||
Set whether underscore is used to designate an accelerator.
| ||
function Get_Use_Underline (Button : access Gtk_Button_Record) return Boolean; | ||
Return whether underscores are used to designate an accelerator.
| ||
procedure Set_Use_Stock (Button : access Gtk_Button_Record; Use_Stock : Boolean); | ||
Set whether a stock item is used by the button.
| ||
function Get_Use_Stock (Button : access Gtk_Button_Record) return Boolean; | ||
Return whether a stock item is used by the button.
| ||
Signals emission | ||
procedure Pressed (Button : access Gtk_Button_Record); | ||
Send the "pressed" signal to the button
| ||
procedure Released (Button : access Gtk_Button_Record); | ||
Send the "release" signal to the button
| ||
procedure Clicked (Button : access Gtk_Button_Record); | ||
Send the "clicked" signal to the button
| ||
procedure Enter (Button : access Gtk_Button_Record); | ||
Send the "enter" signal to the button
| ||
procedure Leave (Button : access Gtk_Button_Record); | ||
Send the "leave" signal to the button
|
Example |
---|
+------------------------------------------------+ | BORDER | | +------------------------------------------+ | | |\\\\\\\\\\\\\\\\DEFAULT\\\\\\\\\\\\\\\\\ | | | |\\+------------------------------------+ | | | |\\| | SPACING 3 | | | | | |\\| +--------------------------------+ | | | | |\\| |########## FOCUS ###############| | | | | |\\| |#+----------------------------+#| | | | | |\\| |#| RELIEF \|#| | | | | |\\| |#| +-----------------------+\|#| | | | | |\\|1|#| + THE TEXT +\|#|2| | | | |\\| |#| +-----------------------+\|#| | | | | |\\| |#| \\\\\ ythickness \\\\\\\\\\|#| | | | | |\\| |#+----------------------------+#| | | | | |\\| |########### 1 ##################| | | | | |\\| +--------------------------------+ | | | | |\\| | default spacing 4 | | | | | |\\+------------------------------------+ | | | |\ ythickness | | | +------------------------------------------+ | | border_width | +------------------------------------------------+