spinbutton: redesign to use an horizontal layout

Rewrite GtkSpinButton to use a touchscreen friendly horizontal layout.
Other features include:
- support for theming buttons with nth-child
- full support for RTL
- use + and - symbolic icons instead of arrows
- general streamlining and cleanup of a lot of related code

https://bugzilla.gnome.org/show_bug.cgi?id=663359
This commit is contained in:
Cosimo Cecchi 2011-11-22 22:08:59 -05:00
parent 03b7bb6e29
commit 10cfa90817
3 changed files with 416 additions and 412 deletions

File diff suppressed because it is too large Load Diff

View File

@ -207,7 +207,9 @@ gboolean gtk_spin_button_get_snap_to_ticks (GtkSpinButton *spin_button)
void gtk_spin_button_update (GtkSpinButton *spin_button); void gtk_spin_button_update (GtkSpinButton *spin_button);
/* private */ /* private */
GdkWindow* _gtk_spin_button_get_panel (GtkSpinButton *spin_button); void _gtk_spin_button_get_panels (GtkSpinButton *spin_button,
GdkWindow **down_panel,
GdkWindow **up_panel);
G_END_DECLS G_END_DECLS

View File

@ -208,18 +208,18 @@ gtk_test_spin_button_click (GtkSpinButton *spinner,
guint button, guint button,
gboolean upwards) gboolean upwards)
{ {
GdkWindow *panel; GdkWindow *down_panel = NULL, *up_panel = NULL, *panel;
gboolean b1res = FALSE, b2res = FALSE; gboolean b1res = FALSE, b2res = FALSE;
panel = _gtk_spin_button_get_panel (spinner); _gtk_spin_button_get_panels (spinner, &down_panel, &up_panel);
panel = (upwards) ? up_panel : down_panel;
if (panel) if (panel)
{ {
gint width, pos; gint width = gdk_window_get_width (panel);
width = gdk_window_get_width (panel); b1res = gdk_test_simulate_button (panel, width - 1, 1, button, 0, GDK_BUTTON_PRESS);
pos = upwards ? 0 : gdk_window_get_height (panel) - 1; b2res = gdk_test_simulate_button (panel, width - 1, 1, button, 0, GDK_BUTTON_RELEASE);
b1res = gdk_test_simulate_button (panel, width - 1, pos, button, 0, GDK_BUTTON_PRESS);
b2res = gdk_test_simulate_button (panel, width - 1, pos, button, 0, GDK_BUTTON_RELEASE);
} }
return b1res && b2res; return b1res && b2res;
} }