]> git.cworth.org Git - grrobot/blob - src/grr_board_view.h
f7df6daae9c379e517d07ce1af5efc4f9c228adc
[grrobot] / src / grr_board_view.h
1 /* grr_board_view - GTK+ widget for displaying an rr_board
2  *
3  * Copyright © 2003 Carl Worth
4  *
5  * Permission to use, copy, modify, distribute, and sell this software
6  * and its documentation for any purpose is hereby granted without
7  * fee, provided that the above copyright notice appear in all copies
8  * and that both that copyright notice and this permission notice
9  * appear in supporting documentation, and that the name of Carl Worth
10  * not be used in advertising or publicity pertaining to distribution
11  * of the software without specific, written prior permission.
12  * Carl Worth makes no representations about the suitability of this
13  * software for any purpose.  It is provided "as is" without express
14  * or implied warranty.
15  * 
16  * CARL WORTH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
18  * NO EVENT SHALL CARL WORTH BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
20  * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
21  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
22  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23  *
24  * Author: Carl Worth <carl@theworths.org>
25  */
26
27 #ifndef GRR_BOARD_VIEW_H
28 #define GRR_BOARD_VIEW_H
29
30 #include <gdk/gdk.h>
31 #include <gtk/gtkadjustment.h>
32 #include <gtk/gtkwidget.h>
33
34 #include <rr.h>
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39
40 #define GRR_BOARD_VIEW(obj)     GTK_CHECK_CAST (obj, grr_board_view_get_type (), grr_board_view_t)
41 #define GRR_BOARD_VIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, grr_board_view_get_type (), grr_board_view_class_t)
42 #define GRR_IS_BOARD_VIEW(obj)  GTK_CHECK_TYPE (obj, grr_board_view_get_type ())
43
44 typedef struct grr_board_view           grr_board_view_t;
45 typedef struct grr_board_view_class     grr_board_view_class_t;
46
47 struct grr_board_view
48 {
49     /* GtkWidget has to be first for GTK+ object magic? */
50     GtkWidget widget;
51
52     rr_board_t *board;
53     int owns_board;
54     int board_width, board_height;
55     int board_pad_x, board_pad_y;
56
57     int cell_width, cell_height;
58
59     /* XXX: Obviously, the rest of this needs to be gutted */
60
61     /* update policy (GTK_UPDATE_[CONTINUOUS/DELAYED/DISCONTINUOUS]) */
62     guint policy : 2;
63     
64     /* Button currently pressed or 0 if none */
65     guint8 button;
66     
67     /* Dimensions of dial components */
68     gint radius;
69     gint pointer_width;
70     
71     /* ID of update timer, or 0 if none */
72     guint32 timer;
73     
74     /* Current angle */
75     gfloat angle;
76     gfloat last_angle;
77     
78     /* Old values from adjustment stored so we know when something changes */
79     gfloat old_value;
80     gfloat old_lower;
81     gfloat old_upper;
82
83     GtkAdjustment *adjustment;
84 };
85
86 struct grr_board_view_class
87 {
88     GtkWidgetClass parent_class;
89 };
90
91 GtkWidget*     grr_board_view_new       (rr_board_t *board);
92 GtkType        grr_board_view_get_type  (void);
93 void           grr_board_view_set_board (grr_board_view_t *view,
94                                          rr_board_t *board);
95 #ifdef __cplusplus
96 }
97 #endif /* __cplusplus */
98
99 #endif /* GRR_BOARD_VIEW_H */