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