This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

1. Overview

I should be pretty obvious what buttons are and where they are usually used. One thing one should keep in mind is the fact that ../GtkButton is used inside other widgets like ../GtkComboBox, ../GtkTreeView and ../GtkOptionMenu.

screenshot.png

2. Style Properties

Name

Default

Description

default-border

{1, 1, 1, 1}

Extra space to add for CAN_DEFAULT buttons

default-outside-border

{0, 0, 0, 0}

Extra space to add for CAN_DEFAULT buttons that is always drawn outside the border

child-displacement-x

0

How far in the x direction to move the child when the button is depressed

child-displacement-y

0

How far in the y direction to move the child when the button is depressed

displace-focus

FALSE

Whether the child_displacement_x/_y properties should also affect the focus rectangle

inner-border

{1, 1, 1, 1}

Border between button edges and child.

Values given in the form {1, 1, 1, 1} map as {left, right, top, bottom}.

3. Geometry

3.0.1. Geometry if interior-focus = 1

The geometry of a simple button that cannot get the default action:

button-nodefault.png

3.0.2. interior-focus = 0

If interior-focus = 0, then the focused button will look differently. (Buttons without a focus stay the same.)

button-exterior-focus.png

TODO: show spacing for the HAS_DEFAULT case.

See also http://svn.gnome.org/viewvc/gtk%2B/trunk/docs/widget_geometry.txt?view=markup.

4. Drawing

Buttons may be drawn transparent.

As seen in the above images, the button consists of a BOX. If the button has the focus, it will be drawn on the button as schown in the above images. The detail for both of these is "button".

There is nothing special about the state and shadow that are used:

normal

pressed

prelight

insensitive

shadow type

OUT

IN

OUT

OUT

state

NORMAL

ACTIVE

PRELIGHT

INSENSITIVE

If the button is the default button, then another box with detail "buttondefault" will be drawn underneath everything.

5. How to Change Button on focus style

It seems only accept change focus line width and color, if it can change the background image.

6. GTK+ API Documentation

http://library.gnome.org/devel/gtk/stable/GtkButton.html


2024-10-23 10:58