Top |
GtkWidget * | gtk_button_new () |
GtkWidget * | gtk_button_new_with_label () |
GtkWidget * | gtk_button_new_with_mnemonic () |
GtkWidget * | gtk_button_new_from_stock () |
void | gtk_button_pressed () |
void | gtk_button_released () |
void | gtk_button_clicked () |
void | gtk_button_enter () |
void | gtk_button_leave () |
void | gtk_button_set_relief () |
GtkReliefStyle | gtk_button_get_relief () |
const gchar * | gtk_button_get_label () |
void | gtk_button_set_label () |
gboolean | gtk_button_get_use_stock () |
void | gtk_button_set_use_stock () |
gboolean | gtk_button_get_use_underline () |
void | gtk_button_set_use_underline () |
void | gtk_button_set_focus_on_click () |
gboolean | gtk_button_get_focus_on_click () |
void | gtk_button_set_alignment () |
void | gtk_button_get_alignment () |
void | gtk_button_set_image () |
GtkWidget * | gtk_button_get_image () |
void | gtk_button_set_image_position () |
GtkPositionType | gtk_button_get_image_position () |
GdkWindow * | gtk_button_get_event_window () |
gboolean | focus-on-click | Read / Write |
GtkWidget * | image | Read / Write |
GtkPositionType | image-position | Read / Write |
char * | label | Read / Write / Construct |
GtkReliefStyle | relief | Read / Write |
gboolean | use-stock | Read / Write / Construct |
gboolean | use-underline | Read / Write / Construct |
float | xalign | Read / Write |
float | yalign | Read / Write |
int | child-displacement-x | Read |
int | child-displacement-y | Read |
GtkBorder * | default-border | Read |
GtkBorder * | default-outside-border | Read |
gboolean | displace-focus | Read |
int | image-spacing | Read |
GtkBorder * | inner-border | Read |
GObject ╰── GInitiallyUnowned ╰── GtkObject ╰── GtkWidget ╰── GtkContainer ╰── GtkBin ╰── GtkButton ├── GtkToggleButton ├── GtkColorButton ├── GtkFontButton ├── GtkLinkButton ├── GtkOptionMenu ╰── GtkScaleButton
GtkWidget *
gtk_button_new_with_mnemonic (const gchar *label
);
Creates a new GtkButton 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 GtkButton |
GtkWidget *
gtk_button_new_from_stock (const gchar *stock_id
);
Creates a new GtkButton 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()
).
void
gtk_button_pressed (GtkButton *button
);
gtk_button_pressed
is deprecated and should not be used in newly-written code.
void
gtk_button_released (GtkButton *button
);
gtk_button_released
is deprecated and should not be used in newly-written code.
void
gtk_button_enter (GtkButton *button
);
gtk_button_enter
is deprecated and should not be used in newly-written code.
void
gtk_button_leave (GtkButton *button
);
gtk_button_leave
is deprecated and should not be used in newly-written code.
const gchar *
gtk_button_get_label (GtkButton *button
);
Fetches the text from the label of the button, as set by
gtk_button_set_label()
. 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.
void gtk_button_set_label (GtkButton *button
,const gchar *label
);
Sets the text of the label of the button to str
. This text is
also used to select the stock item if gtk_button_set_use_stock()
is used.
This will also clear any previously set labels.
gboolean
gtk_button_get_use_stock (GtkButton *button
);
Returns whether the button label is a stock item.
void gtk_button_set_use_stock (GtkButton *button
,gboolean use_stock
);
If TRUE
, the label set on the button is used as a
stock id to select the stock item for the button.
gboolean
gtk_button_get_use_underline (GtkButton *button
);
Returns whether an embedded underline in the button label indicates a
mnemonic. See gtk_button_set_use_underline()
.
void gtk_button_set_use_underline (GtkButton *button
,gboolean use_underline
);
If true, an underline in the text of the button label indicates the next character should be used for the mnemonic accelerator key.
void gtk_button_set_focus_on_click (GtkButton *button
,gboolean focus_on_click
);
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.
Since: 2.4
gboolean
gtk_button_get_focus_on_click (GtkButton *button
);
Returns whether the button grabs focus when it is clicked with the mouse.
See gtk_button_set_focus_on_click()
.
Since: 2.4
void gtk_button_set_alignment (GtkButton *button
,gfloat xalign
,gfloat yalign
);
Sets the alignment of the child. This property has no effect unless the child is a GtkMisc or a GtkAligment.
button |
||
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 |
Since: 2.4
void gtk_button_get_alignment (GtkButton *button
,gfloat *xalign
,gfloat *yalign
);
Gets the alignment of the child in the button.
button |
||
xalign |
return location for horizontal alignment. |
[out] |
yalign |
return location for vertical alignment. |
[out] |
Since: 2.4
void gtk_button_set_image (GtkButton *button
,GtkWidget *image
);
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_widget_show()
on image
yourself.
Since: 2.6
GtkWidget *
gtk_button_get_image (GtkButton *button
);
Gets the widget that is currenty set as the image of button
.
This may have been explicitly set by gtk_button_set_image()
or constructed by gtk_button_new_from_stock()
.
Since: 2.6
void gtk_button_set_image_position (GtkButton *button
,GtkPositionType position
);
Sets the position of the image relative to the text inside the button.
Since: 2.10
GtkPositionType
gtk_button_get_image_position (GtkButton *button
);
Gets the position of the image relative to the text inside the button.
Since: 2.10
“focus-on-click”
property “focus-on-click” gboolean
Whether the button grabs focus when it is clicked with the mouse.
Owner: GtkButton
Flags: Read / Write
Default value: TRUE
“image”
property“image” GtkWidget *
Child widget to appear next to the button text.
Owner: GtkButton
Flags: Read / Write
“image-position”
property“image-position” GtkPositionType
The position of the image relative to the text inside the button.
Owner: GtkButton
Flags: Read / Write
Default value: GTK_POS_LEFT
Since: 2.10
“label”
property “label” char *
Text of the label widget inside the button, if the button contains a label widget.
Owner: GtkButton
Flags: Read / Write / Construct
Default value: NULL
“relief”
property“relief” GtkReliefStyle
The border relief style.
Owner: GtkButton
Flags: Read / Write
Default value: GTK_RELIEF_NORMAL
“use-stock”
property “use-stock” gboolean
If set, the label is used to pick a stock item instead of being displayed.
Owner: GtkButton
Flags: Read / Write / Construct
Default value: FALSE
“use-underline”
property “use-underline” gboolean
If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key.
Owner: GtkButton
Flags: Read / Write / Construct
Default value: FALSE
“xalign”
property “xalign” float
If the child of the button is a GtkMisc or GtkAlignment, this property can be used to control it's horizontal alignment. 0.0 is left aligned, 1.0 is right aligned.
Owner: GtkButton
Flags: Read / Write
Allowed values: [0,1]
Default value: 0.5
Since: 2.4
“yalign”
property “yalign” float
If the child of the button is a GtkMisc or GtkAlignment, this property can be used to control it's vertical alignment. 0.0 is top aligned, 1.0 is bottom aligned.
Owner: GtkButton
Flags: Read / Write
Allowed values: [0,1]
Default value: 0.5
Since: 2.4
“child-displacement-x”
style property “child-displacement-x” int
How far in the x direction to move the child when the button is depressed.
Owner: GtkButton
Flags: Read
Default value: 0
“child-displacement-y”
style property “child-displacement-y” int
How far in the y direction to move the child when the button is depressed.
Owner: GtkButton
Flags: Read
Default value: 0
“default-border”
style property“default-border” GtkBorder *
The "default-border" style property defines the extra space to add
around a button that can become the default widget of its window.
For more information about default widgets, see gtk_widget_grab_default()
.
Owner: GtkButton
Flags: Read
“default-outside-border”
style property“default-outside-border” GtkBorder *
The "default-outside-border" style property defines the extra outside
space to add around a button that can become the default widget of its
window. Extra outside space is always drawn outside the button border.
For more information about default widgets, see gtk_widget_grab_default()
.
Owner: GtkButton
Flags: Read
“displace-focus”
style property “displace-focus” gboolean
Whether the child_displacement_x/child_displacement_y properties should also affect the focus rectangle.
Owner: GtkButton
Flags: Read
Default value: FALSE
Since: 2.6
“image-spacing”
style property “image-spacing” int
Spacing in pixels between the image and label.
Owner: GtkButton
Flags: Read
Allowed values: >= 0
Default value: 2
“activate”
signalvoid user_function (GtkButton *widget, gpointer user_data)
The ::activate signal on GtkButton is an action signal and emitting it causes the button to animate press then release. Applications should never connect to this signal, but use the “clicked” signal.
widget |
the object which received the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Action
“clicked”
signalvoid user_function (GtkButton *button, gpointer user_data)
Emitted when the button has been activated (pressed and released).
button |
the object that received the signal |
|
user_data |
user data set when the signal handler was connected. |
Flags: Action
“enter”
signalvoid user_function (GtkButton *button, gpointer user_data)
Emitted when the pointer enters the button.
GtkButton::enter
has been deprecated since version 2.8 and should not be used in newly-written code.
Use the “enter-notify-event” signal.
button |
the object that received the signal |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First
“leave”
signalvoid user_function (GtkButton *button, gpointer user_data)
Emitted when the pointer leaves the button.
GtkButton::leave
has been deprecated since version 2.8 and should not be used in newly-written code.
Use the “leave-notify-event” signal.
button |
the object that received the signal |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First
“pressed”
signalvoid user_function (GtkButton *button, gpointer user_data)
Emitted when the button is pressed.
GtkButton::pressed
has been deprecated since version 2.8 and should not be used in newly-written code.
Use the “button-press-event” signal.
button |
the object that received the signal |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First
“released”
signalvoid user_function (GtkButton *button, gpointer user_data)
Emitted when the button is released.
GtkButton::released
has been deprecated since version 2.8 and should not be used in newly-written code.
Use the “button-release-event” signal.
button |
the object that received the signal |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First