1 /* giwled.h  -  GiwLed widget's header
2   Copyright (C) 2006  Alexandre Pereira Bueno, Eduardo Parente Ribeiro
3 
4     This library is free software; you can redistribute it and/or
5     modify it under the terms of the GNU Lesser General Public
6     License as published by the Free Software Foundation; either
7     version 2.1 of the License, or (at your option) any later version.
8 
9     This library 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 GNU
12     Lesser General Public License for more details.
13 
14     You should have received a copy of the GNU Lesser General Public
15     License along with this library; if not, write to the Free Software
16     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17 
18   Maintainers
19   Alexandre Pereira Bueno - alpebu@yahoo.com.br
20   James Scott Jr <skoona@users.sourceforge.net>
21 */
22 
23 
24 
25 #ifndef __GIW_LED_H__
26 #define __GIW_LED_H__
27 
28 #include <gdk/gdk.h>
29 #include <gtk/gtk.h>
30 
31 G_BEGIN_DECLS
32 
33 #define GIW_TYPE_LED                 (giw_led_get_type ())
34 #define GIW_LED(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIW_TYPE_LED, GiwLed))
35 #define GIW_LED_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), GIW_TYPE_LED, GiwLedClass))
36 #define GIW_IS_LED(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIW_TYPE_LED))
37 #define GIW_IS_LED_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), GIW_TYPE_LED))
38 #define GIW_LED_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), GIW_TYPE_LED, GiwLedClass))
39 
40 typedef struct _GiwLed        GiwLed;
41 typedef struct _GiwLedClass   GiwLedClass;
42 
43 struct _GiwLed {
44 #if GTK_CHECK_VERSION(3, 0, 0)
45   GtkWidget parent_instance;
46 #endif
47   GtkWidget widget;
48 
49   gboolean on; //0 for false
50 #if GTK_CHECK_VERSION(3, 0, 0)
51   GdkRGBA color_on, color_off;
52 #else
53   GdkColor color_on, color_off;
54 #endif
55 
56   guint size; // Size of the led
57   guint x, y; // Position inside the widget's window
58 
59   guint radius; // the led radius
60 
61   guint8 enable_mouse; // 0 for disable mouse using, other value to enable it
62 };
63 
64 struct _GiwLedClass {
65   GtkWidgetClass parent_class;
66 
67   void (* mode_changed)(GiwLed *led);  //Signal emited when the mode is chaged (on to off, or off to on)
68 };
69 
70 
71 GtkWidget     *giw_led_new(void);
72 GType          giw_led_get_type(void) G_GNUC_CONST;
73 void           giw_led_set_mode(GiwLed *led, guint8 mode);
74 guint8         giw_led_get_mode(GiwLed *led);
75 #if GTK_CHECK_VERSION(3, 0, 0)
76 void           giw_led_set_rgba(GiwLed *led, GdkRGBA on_color, GdkRGBA off_color);
77 #endif
78 void           giw_led_set_colors(GiwLed *led, GdkColor on_color, GdkColor off_color);
79 void           giw_led_enable_mouse(GiwLed *led, gboolean option);
80 
81 G_END_DECLS
82 
83 #endif /* __GIW_LED_H__ */
84