/** * Called when the spin value is wrapped (gtk+ 2.10 only) */ static void on_spin_value_wrapped (GtkWidget *widget, gpointer data) { gint value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (widget)); if (widget == time_seconds_spinner) gtk_spin_button_spin (GTK_SPIN_BUTTON (time_minutes_spinner), (value == 0) ? GTK_SPIN_STEP_FORWARD : GTK_SPIN_STEP_BACKWARD, 1); else if (widget == time_minutes_spinner) gtk_spin_button_spin (GTK_SPIN_BUTTON (time_hours_spinner), (value == 0) ? GTK_SPIN_STEP_FORWARD : GTK_SPIN_STEP_BACKWARD, 1); }
static void cb_time_value_changed(GtkSpinButton *widget, gpointer data) { gchar *val; gint value = gtk_spin_button_get_value(widget); if (widget == GTK_SPIN_BUTTON(start_seconds)) { if (value > 59) { gtk_spin_button_set_value(widget, value - 60); gtk_spin_button_spin(GTK_SPIN_BUTTON(start_minutes), GTK_SPIN_STEP_FORWARD, 1); } else if (value < 0) { gtk_spin_button_set_value(widget, value + 60); gtk_spin_button_spin(GTK_SPIN_BUTTON(start_minutes), GTK_SPIN_STEP_BACKWARD, 1); } } else if (widget == GTK_SPIN_BUTTON(start_minutes)) { if (value > 59) { gtk_spin_button_set_value(widget, value - 60); gtk_spin_button_spin(GTK_SPIN_BUTTON(start_hours), GTK_SPIN_STEP_FORWARD, 1); } else if (value < 0) { gtk_spin_button_set_value(widget, value + 60); gtk_spin_button_spin(GTK_SPIN_BUTTON(start_hours), GTK_SPIN_STEP_BACKWARD, 1); } } else if (widget == GTK_SPIN_BUTTON(start_hours)) { if (value > 23) { gtk_spin_button_set_value(widget, value - 24); calendar_update(start_calendar, 1); } else if (value < 0) { calendar_update(start_calendar, -1); gtk_spin_button_set_value(widget, value + 24); } } else if (widget == GTK_SPIN_BUTTON(end_seconds)) { if (value > 59) { gtk_spin_button_set_value(widget, value - 60); gtk_spin_button_spin(GTK_SPIN_BUTTON(end_minutes), GTK_SPIN_STEP_FORWARD, 1); } else if (value < 0) { gtk_spin_button_set_value(widget, value + 60); gtk_spin_button_spin(GTK_SPIN_BUTTON(end_minutes), GTK_SPIN_STEP_BACKWARD, 1); } } else if (widget == GTK_SPIN_BUTTON(end_minutes)) { if (value > 59) { gtk_spin_button_set_value(widget, value - 60); gtk_spin_button_spin(GTK_SPIN_BUTTON(end_hours), GTK_SPIN_STEP_FORWARD, 1); } else if (value < 0) { gtk_spin_button_set_value(widget, value + 60); gtk_spin_button_spin(GTK_SPIN_BUTTON(end_hours), GTK_SPIN_STEP_BACKWARD, 1); } } else if (widget == GTK_SPIN_BUTTON(end_hours)) { if (value > 23) { gtk_spin_button_set_value(widget, value - 24); calendar_update(end_calendar, 1); } else if (value < 0) { calendar_update(end_calendar, -1); gtk_spin_button_set_value(widget, value + 24); } } val = g_strdup_printf("%02d", value); gtk_entry_set_text(GTK_ENTRY(widget), val); g_free(val); }
static VALUE rg_spin(VALUE self, VALUE direction, VALUE increment) { gtk_spin_button_spin(_SELF(self), RVAL2GENUM(direction, GTK_TYPE_SPIN_TYPE), NUM2DBL(increment)); return self; }
static void go_previous (GtkWidget *button, IdolTrackerWidget *widget) { if (widget->priv->current_result_page > 0) gtk_spin_button_spin (GTK_SPIN_BUTTON (widget->priv->page_selector), GTK_SPIN_STEP_BACKWARD, 1); /* do_search is called via page_selector_value_changed_cb */ }
static void go_next (GtkWidget *button, IdolTrackerWidget *widget) { if (widget->priv->current_result_page < widget->priv->total_result_count / IDOL_TRACKER_MAX_RESULTS_SIZE) gtk_spin_button_spin (GTK_SPIN_BUTTON (widget->priv->page_selector), GTK_SPIN_STEP_FORWARD, 1); /* do_search is called via page_selector_value_changed_cb */ }
static gboolean gimp_rotate_tool_key_press (GimpTool *tool, GdkEventKey *kevent, GimpDisplay *display) { GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool); if (display == draw_tool->display) { GimpRotateTool *rotate = GIMP_ROTATE_TOOL (tool); GtkSpinButton *angle_spin = GTK_SPIN_BUTTON (rotate->angle_spin_button); switch (kevent->keyval) { case GDK_KEY_Up: gtk_spin_button_spin (angle_spin, GTK_SPIN_STEP_FORWARD, 0.0); return TRUE; case GDK_KEY_Down: gtk_spin_button_spin (angle_spin, GTK_SPIN_STEP_BACKWARD, 0.0); return TRUE; case GDK_KEY_Right: gtk_spin_button_spin (angle_spin, GTK_SPIN_PAGE_FORWARD, 0.0); return TRUE; case GDK_KEY_Left: gtk_spin_button_spin (angle_spin, GTK_SPIN_PAGE_BACKWARD, 0.0); return TRUE; default: break; } } return GIMP_TOOL_CLASS (parent_class)->key_press (tool, kevent, display); }
/* Performs an explicit 'spin' on a spin button. */ int clip_GTK_SPINBUTTONSPIN(ClipMachine * ClipMachineMemory) { C_widget *cspb = _fetch_cw_arg(ClipMachineMemory); GtkSpinType direction = _clip_parni(ClipMachineMemory, 2); gfloat increment = _clip_parnd(ClipMachineMemory, 3); CHECKCWID(cspb, GTK_IS_SPIN_BUTTON); CHECKOPT(2, NUMERIC_type_of_ClipVarType); CHECKOPT(3, NUMERIC_type_of_ClipVarType); gtk_spin_button_spin(GTK_SPIN_BUTTON(cspb->widget), direction, increment); return 0; err: return 1; }