1 /*
2 
3     (c) Fraser Stuart 2009
4 
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9 
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14 
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 
19 */
20 
21 #ifndef __SWITCH_TOGGLE_H
22 #define __SWITCH_TOGGLE_H
23 
24 #include <gtk/gtk.h>
25 #include <cairo.h>
26 #include "widgets.h"
27 
28 G_BEGIN_DECLS
29 
30 #define INV_SWITCH_TOGGLE_DRAW_ALL 0
31 #define INV_SWITCH_TOGGLE_DRAW_DATA  1
32 
33 #define INV_SWITCH_TOGGLE_OFF 0
34 #define INV_SWITCH_TOGGLE_ON  1
35 
36 #define INV_SWITCH_TOGGLE(obj) GTK_CHECK_CAST(obj, inv_switch_toggle_get_type (), InvSwitchToggle)
37 #define INV_SWITCH_TOGGLE_CLASS(klass) GTK_CHECK_CLASS_CAST(klass, inv_switch_toggle_get_type(), InvSwitchToggleClass)
38 #define INV_IS_SWITCH_TOGGLE(obj) GTK_CHECK_TYPE(obj, inv_switch_toggle_get_type())
39 
40 
41 typedef struct _InvSwitchToggle InvSwitchToggle;
42 typedef struct _InvSwitchToggleClass InvSwitchToggleClass;
43 
44 
45 struct _InvSwitchToggle {
46 	GtkWidget widget;
47 
48 	gint bypass;
49 	gint state;
50 	gint laststate;
51 	float value;
52 
53 	float on_value;
54 	float off_value;
55 
56 	struct colour on;
57 	struct colour off;
58 
59 	char on_text[15];
60 	char off_text[15];
61 
62 	char label[15];
63 
64 	GdkPixbuf *img_on;
65 	GdkPixbuf *img_off;
66 
67 	gint	font_size;
68 
69 };
70 
71 struct _InvSwitchToggleClass {
72 	GtkWidgetClass parent_class;
73 };
74 
75 
76 GtkType inv_switch_toggle_get_type(void);
77 GtkWidget * inv_switch_toggle_new();
78 
79 void inv_switch_toggle_set_bypass(InvSwitchToggle *switch_toggle, gint num);
80 void inv_switch_toggle_toggle(InvSwitchToggle *switch_toggle);
81 void inv_switch_toggle_set_state(InvSwitchToggle *switch_toggle, gint state);
82 void inv_switch_toggle_set_value(InvSwitchToggle *switch_toggle, gint state, float value);
83 void inv_switch_toggle_set_colour(InvSwitchToggle *switch_toggle, gint state, float R, float G, float B);
84 void inv_switch_toggle_set_text(InvSwitchToggle *switch_toggle, gint state, const char *text);
85 void inv_switch_toggle_set_label(InvSwitchToggle *switch_toggle, const char *text);
86 void inv_switch_toggle_set_tooltip(InvSwitchToggle *switch_toggle, gchar *tip);
87 float inv_switch_toggle_get_value(InvSwitchToggle *switch_toggle);
88 
89 G_END_DECLS
90 
91 #endif /* __SWITCH_TOGGLE_H */
92 
93