Add _gtk_spin_button_get_panel private function

It's needed in gtktestutils.c
This commit is contained in:
Javier Jardón 2010-07-13 00:11:39 +02:00
parent 57d870ac5b
commit cbbffa18f8
3 changed files with 18 additions and 4 deletions

View File

@ -2428,3 +2428,9 @@ gtk_spin_button_update (GtkSpinButton *spin_button)
else
gtk_spin_button_set_value (spin_button, val);
}
GdkWindow *
_gtk_spin_button_get_panel (GtkSpinButton *spin_button)
{
return spin_button->priv->panel;
}

View File

@ -169,6 +169,9 @@ void gtk_spin_button_set_snap_to_ticks (GtkSpinButton *spin_button,
gboolean gtk_spin_button_get_snap_to_ticks (GtkSpinButton *spin_button);
void gtk_spin_button_update (GtkSpinButton *spin_button);
/* private */
GdkWindow* _gtk_spin_button_get_panel (GtkSpinButton *spin_button);
G_END_DECLS
#endif /* __GTK_SPIN_BUTTON_H__ */

View File

@ -22,6 +22,7 @@
#include "config.h"
#include <gtk/gtk.h>
#include "gtkspinbutton.h"
#include <locale.h>
#include <string.h>
@ -189,14 +190,18 @@ gtk_test_spin_button_click (GtkSpinButton *spinner,
guint button,
gboolean upwards)
{
GdkWindow *panel;
gboolean b1res = FALSE, b2res = FALSE;
if (spinner->panel)
panel = _gtk_spin_button_get_panel (spinner);
if (panel)
{
gint width, height, pos;
gdk_drawable_get_size (spinner->panel, &width, &height);
gdk_drawable_get_size (panel, &width, &height);
pos = upwards ? 0 : height - 1;
b1res = gdk_test_simulate_button (spinner->panel, width - 1, pos, button, 0, GDK_BUTTON_PRESS);
b2res = gdk_test_simulate_button (spinner->panel, width - 1, pos, 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;
}