W Wrapl, The Programming Language

Libraries:Gtk:Gtk:Button

Types

T

Inherits from:

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

The T widget can hold any valid child widget. That is it can hold most any other standard Gtk.Gtk.Widget.T. The most commonly used child is the Gtk.Gtk.Label.T.



Constants

Nil : T

Functions

GetType() : Gtk.GObject.Type.T



New() : Gtk.Gtk.Button.T

Creates a new T widget. To add a child widget to the button, use Gtk.Gtk.Container.Add.

Returns The newly created T widget.


NewFromStock(stock_id @ Std.String.T) : Gtk.Gtk.Button.T

Creates a new T 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()).

stock_id the name of the stock item
Returns a new T


NewWithLabel(label @ Std.String.T) : Gtk.Gtk.Button.T

Creates a T widget with a Gtk.Gtk.Label.T child containing the given text.

label The text you want the Gtk.Gtk.Label.T to hold.
Returns The newly created T widget.


NewWithMnemonic(label @ Std.String.T) : Gtk.Gtk.Button.T

Creates a new T 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 T


Methods

:Clicked(self @ T) : Std.Object.T

Emits a "clicked" signal to the given T.

button The T you want to send the signal to.


:Enter(self @ T) : Std.Object.T

Warning

Enter has been deprecated since version 2.20 and should not be used in newly-written code. Use the "enter-notify-event" signal.



:GetAlignment(self @ T, xalign @ Std.Object.T, yalign @ Std.Object.T) : Std.Object.T

Gets the alignment of the child in the button.

button a T
xalign return location for horizontal alignment. [out]
yalign return location for vertical alignment. [out]


:GetEventWindow(self @ T) : Gtk.Gdk.Window.T

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

button a T
Returns button's event window. [transfer none]


:GetFocusOnClick(self @ T) : Std.Symbol.T

Returns whether the button grabs focus when it is clicked with the mouse. See SetFocusOnClick.

button a T
Returns TRUE if the button grabs focus when it is clicked with the mouse.


:GetImage(self @ T) : Gtk.Gtk.Widget.T

Gets the widget that is currenty set as the image of button. This may have been explicitly set by SetImage or constructed by gtk_button_new_from_stock().

button a T
Returns a Gtk.Gtk.Widget.T or NULL in case there is no image. [transfer none]


:GetImagePosition(self @ T) : Gtk.Gtk.PositionType.T

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

button a T
Returns the position


:GetLabel(self @ T) : Std.String.T

Fetches the text from the label of the button, as set by SetLabel. If the label text has not been set the return value will be NULL. This will be the case if you create an empty button with gtk_button_new() to use as a container.

button a T
Returns The text of the label widget. This string is owned by the widget and must not be modified or freed.


:GetRelief(self @ T) : Gtk.Gtk.ReliefStyle.T

Returns the current relief style of the given T.

button The T you want the Gtk.Gtk.ReliefStyle.T from.
Returns The current Gtk.Gtk.ReliefStyle.T


:GetUseStock(self @ T) : Std.Symbol.T

Returns whether the button label is a stock item.

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


:GetUseUnderline(self @ T) : Std.Symbol.T

Returns whether an embedded underline in the button label indicates a mnemonic. See SetUseUnderline.

button a T
Returns TRUE if an embedded underline in the button label indicates the mnemonic accelerator keys.


:Leave(self @ T) : Std.Object.T

Warning

Leave has been deprecated since version 2.20 and should not be used in newly-written code. Use the "leave-notify-event" signal.



:Pressed(self @ T) : Std.Object.T

Warning

Pressed has been deprecated since version 2.20 and should not be used in newly-written code. Use the "button-press-event" signal.



:Released(self @ T) : Std.Object.T

Warning

Released has been deprecated since version 2.20 and should not be used in newly-written code. Use the "button-release-event" signal.



:SetAlignment(self @ T, xalign @ Std.Real.T, yalign @ Std.Real.T) : Std.Object.T

Sets the alignment of the child. This property has no effect unless the child is a Gtk.Gtk.Misc.T or a GtkAligment.

button a T
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


:SetFocusOnClick(self @ T, focus_on_click @ Std.Symbol.T) : Std.Object.T

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.

button a T
focus_on_click whether the button grabs focus when clicked with the mouse


:SetImage(self @ T, image @ Gtk.Gtk.Widget.T) : Std.Object.T

Set the image of button to the given widget. Note that it depends on the "gtk-button-images" setting whether the image will be displayed or not, you don't have to call Gtk.Gtk.Widget.Show on image yourself.

button a T
image a widget to set as the image for the button


:SetImagePosition(self @ T, position @ Gtk.Gtk.PositionType.T) : Std.Object.T

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

button a T
position the position


:SetLabel(self @ T, label @ Std.String.T) : Std.Object.T

Sets the text of the label of the button to str. This text is also used to select the stock item if SetUseStock is used.

This will also clear any previously set labels.

button a T
label a string


:SetRelief(self @ T, newstyle @ Gtk.Gtk.ReliefStyle.T) : Std.Object.T

Sets the relief style of the edges of the given T widget. Three styles exist, GTK_RELIEF_NORMAL, GTK_RELIEF_HALF, GTK_RELIEF_NONE. The default style is, as one can guess, GTK_RELIEF_NORMAL.

button The T you want to set relief styles of.
newstyle The GtkReliefStyle as described above.


:SetUseStock(self @ T, use_stock @ Std.Symbol.T) : Std.Object.T

If TRUE, the label set on the button is used as a stock id to select the stock item for the button.

button a T
use_stock TRUE if the button should use a stock item


:SetUseUnderline(self @ T, use_underline @ Std.Symbol.T) : Std.Object.T

If true, an underline in the text of the button label indicates the next character should be used for the mnemonic accelerator key.

button a T
use_underline TRUE if underlines in the text indicate mnemonics