spinbutton-events.cpp revision 74c21fe2482b11f74db5bacae30a0068f1194032
/*
* Common callbacks for spinbuttons
*
* Authors:
* bulia byak <bulia@users.sourceforge.net>
*
* Copyright (C) 2003 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <gdk/gdkkeysyms.h>
#include "../event-context.h"
#include "sp-widget.h"
#include "widget-sizes.h"
{
// retrieve the value
// remember it
return FALSE; // I didn't consume the event
}
void
spinbutton_undo (GtkWidget *w)
{
if (ini) {
}
}
void
{
// defocus spinbuttons by moving focus to the canvas, unless "stay" is on
if (stay) {
} else {
if (canvas) {
}
}
}
{
gdouble v;
switch (get_group0_keyval (event)) {
case GDK_KEY_Escape: // defocus
spinbutton_undo (w);
return TRUE; // I consumed the event
break;
case GDK_KEY_Return: // defocus
case GDK_KEY_KP_Enter:
return TRUE; // I consumed the event
break;
case GDK_KEY_Tab:
case GDK_KEY_ISO_Left_Tab:
// set the flag meaning "do not leave toolbar when changing value"
return FALSE; // I didn't consume the event
break;
// The following keys are processed manually because GTK implements them in strange ways
// (increments start with double step value and seem to grow as you press the key continuously)
case GDK_KEY_Up:
case GDK_KEY_KP_Up:
v = gtk_spin_button_get_value(GTK_SPIN_BUTTON (w));
v += step;
return TRUE; // I consumed the event
break;
case GDK_KEY_Down:
case GDK_KEY_KP_Down:
v = gtk_spin_button_get_value(GTK_SPIN_BUTTON (w));
v -= step;
return TRUE; // I consumed the event
break;
case GDK_KEY_Page_Up:
case GDK_KEY_KP_Page_Up:
v = gtk_spin_button_get_value(GTK_SPIN_BUTTON (w));
v += page;
return TRUE; // I consumed the event
break;
case GDK_KEY_Page_Down:
case GDK_KEY_KP_Page_Down:
v = gtk_spin_button_get_value(GTK_SPIN_BUTTON (w));
v -= page;
return TRUE; // I consumed the event
break;
case GDK_KEY_z:
case GDK_KEY_Z:
spinbutton_undo (w);
return TRUE; // I consumed the event
}
break;
default:
return FALSE;
break;
}
return FALSE; // I didn't consume the event
}