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


[Home] [TitleIndex] [WordIndex

1. Overview

screenshot.png

2. Style Properties

Name

Default

Description

shadow-type

GTK_SHADOW_IN

Style of bevel around the spin button

3. Geometry

geometry.png

For the entry part of the spinbutton, refere to ../GtkEntry. arrow-size is calculated from the font (rounded down to be even) and has a minimum of 6 pixel. In the case that the height for the two stepper buttons is not a multiple of two, the down one will be one pixel larger. (XXX: is this true?)

4. Drawing

The entry part of the spinbutton is simply that. The buttons are inside their own X window (not sure if this matters for theming much). If the shadow-type style property is not NONE, then a box with the given shadow type will be drawn over the whole button area. The detail is "spinbutton" and the state always NORMAL.

For the stepper buttons, a box with detail "spinbutton_up" or "spinbutton_down" is drawn first. After that an arrow gets drawn (hmm, there is some weird placement code for the arrow ...)

The shadow and state is as follows:

shadow

state

at the limit

OUT

INSENSITIVE

pressed

IN

ACTIVE

mouse above

OUT

PRELIGHT

others

OUT

state of the widget, ie. NORMAL or INSENSITIVE

Coped from gtkspinbutton.c (http://svn.gnome.org/viewvc/gtk%2B/trunk/gtk/gtkspinbutton.c?view=markup)

height is the height of the whole widget and width is the width of the spinbuttons.

      if (arrow_type == GTK_ARROW_DOWN)
        {
          y = height / 2;
          height = height - y - 2;
        }
      else
        {
          y = 2;
          height = height / 2 - 2;
        }

      width -= 3;

      if (widget && gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
        x = 2;
      else
        x = 1;

      w = width / 2;
      w -= w % 2 - 1; /* force odd */
      h = (w + 1) / 2;

      x += (width - w) / 2;
      y += (height - h) / 2;

      height = h;
      width = w;

      gtk_paint_arrow (widget->style, spin_button->panel,
                       state_type, shadow_type,
                       NULL, widget, "spinbutton",
                       arrow_type, TRUE,
                       x, y, width, height);

5. GTK+ API Documentation

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


2024-10-23 10:58