Change license from GPLv2+ to GPLv3+.
[pspp-builds.git] / src / ui / gui / psppire-keypad.h
1 /* PSPPIRE - a graphical user interface for PSPP.
2    Copyright (C) 2007 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
16
17 /*
18  This module implements a keypad widget, similar to that dipicted
19  below:
20
21  +---+---+---+---+---+
22  |                   |
23  | +   <   7   8   9 |
24  +                   +
25  |                   |
26  | -   >   4   5   6 |
27  +                   +
28  |                   |
29  | *  <=   1   2   3 |
30  +                   +
31  |                   |
32  | /  >=     0     . |
33  +                   +
34  | y  !=   =   (   ) |
35  |x                  |
36  +---+---+---+---+---+
37
38  It's intended for dialog boxes which produce PSPP syntax.  Thus,
39  a "insert-syntax" signal is emitted whenever a key is clicked.
40  The signal supports the following callback:
41
42  void insert_syntax (Keypad *kp, const char *syntax, gpointer user_data);
43
44 */
45
46 #ifndef __PSPPIRE_KEYPAD_H__
47 #define __PSPPIRE_KEYPAD_H__
48
49
50 #include <glib.h>
51 #include <glib-object.h>
52 #include <gtk/gtkeventbox.h>
53 #include <gtk/gtktable.h>
54
55
56 G_BEGIN_DECLS
57
58 #define PSPPIRE_KEYPAD_TYPE            (psppire_keypad_get_type ())
59 #define PSPPIRE_KEYPAD(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PSPPIRE_KEYPAD_TYPE, Psppire_Keypad))
60 #define PSPPIRE_KEYPAD_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PSPPIRE_KEYPAD_TYPE, Psppire_KeypadClass))
61 #define PSPPIRE_IS_KEYPAD(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_KEYPAD_TYPE))
62 #define PSPPIRE_IS_KEYPAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_KEYPAD_TYPE))
63
64
65 typedef struct _PsppireKeypad       PsppireKeypad;
66 typedef struct _PsppireKeypadClass  PsppireKeypadClass;
67
68 /* All members are private. */
69 struct _PsppireKeypad
70 {
71   GtkEventBox parent;
72
73   /* Hash of syntax fragments indexed by pointer to widget (button) */
74   GHashTable *frag_table;
75   GtkWidget *table;
76
77   /* The order of everything here is important */
78   GtkWidget *digit[10];
79   GtkWidget *dot;
80   GtkWidget *plus;
81   GtkWidget *minus;
82   GtkWidget *star;
83   GtkWidget *star_star;
84   GtkWidget *slash;
85   GtkWidget *eq;
86   GtkWidget *neq;
87   GtkWidget *lt;
88   GtkWidget *le;
89   GtkWidget *gt;
90   GtkWidget *ge;
91   GtkWidget *and;
92   GtkWidget *or;
93   GtkWidget *not;
94
95
96   GtkWidget *parentheses;
97   GtkWidget *delete;
98
99
100   gboolean dispose_has_run;
101 };
102
103
104 struct _PsppireKeypadClass
105 {
106   GtkTableClass parent_class;
107   void (*keypad)(PsppireKeypad*);
108 };
109
110
111 GType          psppire_keypad_get_type        (void);
112 GtkWidget*     psppire_keypad_new             (void);
113
114 G_END_DECLS
115
116 #endif /* __PSPPIRE_KEYPAD_H__ */