1 /*
2  * GNT - The GLib Ncurses Toolkit
3  *
4  * GNT is the legal property of its developers, whose names are too numerous
5  * to list here.  Please refer to the COPYRIGHT file distributed with this
6  * source distribution.
7  *
8  * This library is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
21  */
22 
23 #ifndef GNT_CHECK_BOX_H
24 #define GNT_CHECK_BOX_H
25 /**
26  * SECTION:gntcheckbox
27  * @section_id: libgnt-gntcheckbox
28  * @title: GntCheckbox
29  * @short_description: A widget that can be toggled
30  * @see_also: #GntButton
31  */
32 
33 #include "gnt.h"
34 #include "gntbutton.h"
35 #include "gntcolors.h"
36 #include "gntkeys.h"
37 
38 #define GNT_TYPE_CHECK_BOX				(gnt_check_box_get_gtype())
39 #define GNT_CHECK_BOX(obj)				(G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_CHECK_BOX, GntCheckBox))
40 #define GNT_CHECK_BOX_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_CHECK_BOX, GntCheckBoxClass))
41 #define GNT_IS_CHECK_BOX(obj)			(G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_CHECK_BOX))
42 #define GNT_IS_CHECK_BOX_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_CHECK_BOX))
43 #define GNT_CHECK_BOX_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_CHECK_BOX, GntCheckBoxClass))
44 
45 #ifndef GNT_DISABLE_DEPRECATED
46 /**
47  * GNT_CHECK_BOX_FLAGS:
48  *
49  * Deprecated: 2.14.0: This is an internal implementation detail.
50  */
51 #define GNT_CHECK_BOX_FLAGS(obj)				(GNT_CHECK_BOX(obj)->priv.flags)
52 /**
53  * GNT_CHECK_BOX_SET_FLAGS:
54  *
55  * Deprecated: 2.14.0: This is an internal implementation detail.
56  */
57 #define GNT_CHECK_BOX_SET_FLAGS(obj, flags)		(GNT_CHECK_BOX_FLAGS(obj) |= flags)
58 /**
59  * GNT_CHECK_BOX_UNSET_FLAGS:
60  *
61  * Deprecated: 2.14.0: This is an internal implementation detail.
62  */
63 #define GNT_CHECK_BOX_UNSET_FLAGS(obj, flags)	(GNT_CHECK_BOX_FLAGS(obj) &= ~(flags))
64 #endif
65 
66 typedef struct _GntCheckBox			GntCheckBox;
67 typedef struct _GntCheckBoxClass		GntCheckBoxClass;
68 #ifndef GNT_DISABLE_DEPRECATED
69 /**
70  * GntCheckBoxPriv:
71  *
72  * Deprecated: 2.14.0: This is an internal implementation detail.
73  */
74 typedef struct _GntCheckBoxPriv GntCheckBoxPriv;
75 #endif
76 
77 /**
78  * GntCheckBox:
79  *
80  * Access to any fields is deprecated. See inline comments for replacements.
81  */
82 struct _GntCheckBox
83 {
84 	GntButton parent;
85 	gboolean GNTSEAL(checked);
86 };
87 
88 struct _GntCheckBoxClass
89 {
90 	GntButtonClass parent;
91 
92 	void (*toggled)(void);
93 
94 	/*< private >*/
95 	void (*gnt_reserved1)(void);
96 	void (*gnt_reserved2)(void);
97 	void (*gnt_reserved3)(void);
98 	void (*gnt_reserved4)(void);
99 };
100 
101 G_BEGIN_DECLS
102 
103 /**
104  * gnt_check_box_get_gtype:
105  *
106  * Returns: GType for GntCheckBox
107  */
108 GType gnt_check_box_get_gtype(void);
109 
110 /**
111  * gnt_check_box_new:
112  * @text: The text for the checkbox.
113  *
114  * Create a new checkbox.
115  *
116  * Returns:  The newly created checkbox.
117  */
118 GntWidget * gnt_check_box_new(const char *text);
119 
120 /**
121  * gnt_check_box_set_checked:
122  * @box:   The checkbox.
123  * @set:   %TRUE if the checkbox should be selected, %FALSE otherwise.
124  *
125  * Set whether the checkbox should be checked or not.
126  */
127 void gnt_check_box_set_checked(GntCheckBox *box, gboolean set);
128 
129 /**
130  * gnt_check_box_get_checked:
131  * @box:  The checkbox.
132  *
133  * Return the checked state of the checkbox.
134  *
135  * Returns:     %TRUE if the checkbox is selected, %FALSE otherwise.
136  */
137 gboolean gnt_check_box_get_checked(GntCheckBox *box);
138 
139 G_END_DECLS
140 
141 #endif /* GNT_CHECK_BOX_H */
142