Update to 24f58c58bb8d22c0e8e6c5ce43c536c47b719bc6
[gnt.git] / gntcheckbox.h
blob559652de1c7222e146063fdee1c8f450b67b472a
1 /**
2 * @file gntcheckbox.h Checkbox API
3 * @ingroup gnt
4 */
5 /*
6 * GNT - The GLib Ncurses Toolkit
8 * GNT is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
12 * This library is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
27 #ifndef GNT_CHECK_BOX_H
28 #define GNT_CHECK_BOX_H
30 #include "gntbutton.h"
31 #include "gnt.h"
32 #include "gntcolors.h"
33 #include "gntkeys.h"
35 #define GNT_TYPE_CHECK_BOX (gnt_check_box_get_gtype())
36 #define GNT_CHECK_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_CHECK_BOX, GntCheckBox))
37 #define GNT_CHECK_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_CHECK_BOX, GntCheckBoxClass))
38 #define GNT_IS_CHECK_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_CHECK_BOX))
39 #define GNT_IS_CHECK_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_CHECK_BOX))
40 #define GNT_CHECK_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_CHECK_BOX, GntCheckBoxClass))
42 #define GNT_CHECK_BOX_FLAGS(obj) (GNT_CHECK_BOX(obj)->priv.flags)
43 #define GNT_CHECK_BOX_SET_FLAGS(obj, flags) (GNT_CHECK_BOX_FLAGS(obj) |= flags)
44 #define GNT_CHECK_BOX_UNSET_FLAGS(obj, flags) (GNT_CHECK_BOX_FLAGS(obj) &= ~(flags))
46 typedef struct _GntCheckBox GntCheckBox;
47 typedef struct _GntCheckBoxPriv GntCheckBoxPriv;
48 typedef struct _GntCheckBoxClass GntCheckBoxClass;
50 struct _GntCheckBox
52 GntButton parent;
53 gboolean checked;
56 struct _GntCheckBoxClass
58 GntButtonClass parent;
60 void (*toggled)(void);
62 void (*gnt_reserved1)(void);
63 void (*gnt_reserved2)(void);
64 void (*gnt_reserved3)(void);
65 void (*gnt_reserved4)(void);
68 G_BEGIN_DECLS
70 /**
71 * @return GType for GntCheckBox
73 GType gnt_check_box_get_gtype(void);
75 /**
76 * Create a new checkbox.
78 * @param text The text for the checkbox.
80 * @return The newly created checkbox.
82 GntWidget * gnt_check_box_new(const char *text);
84 /**
85 * Set whether the checkbox should be checked or not.
87 * @param box The checkbox.
88 * @param set @c TRUE if the checkbox should be selected, @c FALSE otherwise.
90 void gnt_check_box_set_checked(GntCheckBox *box, gboolean set);
92 /**
93 * Return the checked state of the checkbox.
95 * @param box The checkbox.
97 * @return @c TRUE if the checkbox is selected, @c FALSE otherwise.
99 gboolean gnt_check_box_get_checked(GntCheckBox *box);
101 G_END_DECLS
103 #endif /* GNT_CHECK_BOX_H */