1 /* PSPPIRE - a graphical user interface for PSPP. 2 Copyright (C) 2007, 2010 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/gtk.h> 53 54 55 G_BEGIN_DECLS 56 57 #define PSPPIRE_KEYPAD_TYPE (psppire_keypad_get_type ()) 58 #define PSPPIRE_KEYPAD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PSPPIRE_KEYPAD_TYPE, PsppireKeypad)) 59 #define PSPPIRE_KEYPAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PSPPIRE_KEYPAD_TYPE, PsppireKeypadClass)) 60 #define PSPPIRE_IS_KEYPAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_KEYPAD_TYPE)) 61 #define PSPPIRE_IS_KEYPAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_KEYPAD_TYPE)) 62 63 64 typedef struct _PsppireKeypad PsppireKeypad; 65 typedef struct _PsppireKeypadClass PsppireKeypadClass; 66 67 /* All members are private. */ 68 struct _PsppireKeypad 69 { 70 GtkEventBox parent; 71 72 /* Hash of syntax fragments indexed by pointer to widget (button) */ 73 GHashTable *frag_table; 74 GtkWidget *table; 75 76 /* The order of everything here is important */ 77 GtkWidget *digit[10]; 78 GtkWidget *dot; 79 GtkWidget *plus; 80 GtkWidget *minus; 81 GtkWidget *star; 82 GtkWidget *star_star; 83 GtkWidget *slash; 84 GtkWidget *eq; 85 GtkWidget *neq; 86 GtkWidget *lt; 87 GtkWidget *le; 88 GtkWidget *gt; 89 GtkWidget *ge; 90 GtkWidget *and; 91 GtkWidget *or; 92 GtkWidget *not; 93 94 95 GtkWidget *parentheses; 96 GtkWidget *delete; 97 98 99 gboolean dispose_has_run; 100 }; 101 102 103 struct _PsppireKeypadClass 104 { 105 GtkEventBoxClass parent_class; 106 void (*keypad)(PsppireKeypad*); 107 }; 108 109 110 GType psppire_keypad_get_type (void); 111 GtkWidget* psppire_keypad_new (void); 112 113 G_END_DECLS 114 115 #endif /* __PSPPIRE_KEYPAD_H__ */ 116