From eca38246c063db366f793901db12ccd0fa88e4bc Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Tue, 1 Jul 2008 06:43:38 +0000 Subject: Adding use of GtkScaleButton when available (bzr r6105) --- src/ege-adjustment-action.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/ege-adjustment-action.cpp') diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index 2380e2e6b..c70fcc27d 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -44,9 +44,14 @@ #include #include +#include #include #include #include +#if GTK_CHECK_VERSION(2,12,0) +#include +#include +#endif /* GTK_CHECK_VERSION(2,12,0) */ #include #include #include @@ -89,6 +94,17 @@ enum { APPEARANCE_MINIMAL, // no label, just choices in a drop-down menu }; +#if GTK_CHECK_VERSION(2,12,0) +/* TODO need to have appropriate icons setup for these: */ +static const gchar *floogles[] = { + GTK_STOCK_REMOVE, + GTK_STOCK_ADD, + GTK_STOCK_GO_DOWN, + GTK_STOCK_ABOUT, + GTK_STOCK_GO_UP, + 0}; +#endif /* GTK_CHECK_VERSION(2,12,0) */ + typedef struct _EgeAdjustmentDescr EgeAdjustmentDescr; struct _EgeAdjustmentDescr @@ -764,6 +780,12 @@ static GtkWidget* create_tool_item( GtkAction* action ) if ( act->private_data->appearanceMode == APPEARANCE_FULL ) { spinbutton = gtk_hscale_new( act->private_data->adj); gtk_widget_set_size_request(spinbutton, 100, -1); +#if GTK_CHECK_VERSION(2,12,0) + } else if ( act->private_data->appearanceMode == APPEARANCE_MINIMAL ) { + spinbutton = gtk_scale_button_new( GTK_ICON_SIZE_MENU, 0, 100, 2, 0 ); + gtk_scale_button_set_adjustment( GTK_SCALE_BUTTON(spinbutton), act->private_data->adj ); + gtk_scale_button_set_icons( GTK_SCALE_BUTTON(spinbutton), floogles ); +#endif /* GTK_CHECK_VERSION(2,12,0) */ } else { spinbutton = gtk_spin_button_new( act->private_data->adj, act->private_data->climbRate, act->private_data->digits ); } @@ -817,6 +839,10 @@ static GtkWidget* create_tool_item( GtkAction* action ) g_signal_connect_swapped( G_OBJECT(spinbutton), "event", G_CALLBACK(event_cb), action ); if ( act->private_data->appearanceMode == APPEARANCE_FULL ) { /* */ +#if GTK_CHECK_VERSION(2,12,0) + } else if ( act->private_data->appearanceMode == APPEARANCE_MINIMAL ) { + /* */ +#endif /* GTK_CHECK_VERSION(2,12,0) */ } else { gtk_entry_set_width_chars( GTK_ENTRY(spinbutton), act->private_data->digits + 3 ); } @@ -860,6 +886,10 @@ gboolean focus_in_cb( GtkWidget *widget, GdkEventKey *event, gpointer data ) EgeAdjustmentAction* action = EGE_ADJUSTMENT_ACTION( data ); if ( GTK_IS_SPIN_BUTTON(widget) ) { action->private_data->lastVal = gtk_spin_button_get_value( GTK_SPIN_BUTTON(widget) ); +#if GTK_CHECK_VERSION(2,12,0) + } else if ( GTK_IS_SCALE_BUTTON(widget) ) { + action->private_data->lastVal = gtk_scale_button_get_value( GTK_SCALE_BUTTON(widget) ); +#endif /* GTK_CHECK_VERSION(2,12,0) */ } else if (GTK_IS_RANGE(widget) ) { action->private_data->lastVal = gtk_range_get_value( GTK_RANGE(widget) ); } -- cgit v1.2.3