1/* GTK - The GIMP Toolkit
2 *
3 * Copyright (C) 2010 Intel Corporation
4 * Copyright (C) 2010 RedHat, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Author:
20 * Emmanuele Bassi <[email protected]>
21 * Matthias Clasen <[email protected]>
22 *
23 * Based on similar code from Mx.
24 */
25
26#ifndef __GTK_SWITCH_H__
27#define __GTK_SWITCH_H__
28
29#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
30#error "Only <gtk/gtk.h> can be included directly."
31#endif
32
33#include <gtk/gtkwidget.h>
34
35G_BEGIN_DECLS
36
37#define GTK_TYPE_SWITCH (gtk_switch_get_type ())
38#define GTK_SWITCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SWITCH, GtkSwitch))
39#define GTK_IS_SWITCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SWITCH))
40#define GTK_SWITCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SWITCH, GtkSwitchClass))
41#define GTK_IS_SWITCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SWITCH))
42#define GTK_SWITCH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SWITCH, GtkSwitchClass))
43
44typedef struct _GtkSwitch GtkSwitch;
45typedef struct _GtkSwitchPrivate GtkSwitchPrivate;
46typedef struct _GtkSwitchClass GtkSwitchClass;
47
48/**
49 * GtkSwitch:
50 *
51 * The #GtkSwitch-struct contains private
52 * data and it should only be accessed using the provided API.
53 */
54struct _GtkSwitch
55{
56 /*< private >*/
57 GtkWidget parent_instance;
58
59 GtkSwitchPrivate *priv;
60};
61
62/**
63 * GtkSwitchClass:
64 * @parent_class: The parent class.
65 * @activate: An action signal and emitting it causes the switch to animate.
66 * @state_set: Class handler for the ::state-set signal.
67 */
68struct _GtkSwitchClass
69{
70 GtkWidgetClass parent_class;
71
72 /*< public >*/
73
74 void (* activate) (GtkSwitch *sw);
75
76 gboolean (* state_set) (GtkSwitch *sw, gboolean state);
77 /*< private >*/
78
79 void (* _switch_padding_1) (void);
80 void (* _switch_padding_2) (void);
81 void (* _switch_padding_3) (void);
82 void (* _switch_padding_4) (void);
83 void (* _switch_padding_5) (void);
84};
85
86GDK_AVAILABLE_IN_ALL
87GType gtk_switch_get_type (void) G_GNUC_CONST;
88
89GDK_AVAILABLE_IN_ALL
90GtkWidget * gtk_switch_new (void);
91
92GDK_AVAILABLE_IN_ALL
93void gtk_switch_set_active (GtkSwitch *sw,
94 gboolean is_active);
95GDK_AVAILABLE_IN_ALL
96gboolean gtk_switch_get_active (GtkSwitch *sw);
97
98GDK_AVAILABLE_IN_3_14
99void gtk_switch_set_state (GtkSwitch *sw,
100 gboolean state);
101GDK_AVAILABLE_IN_3_14
102gboolean gtk_switch_get_state (GtkSwitch *sw);
103
104G_END_DECLS
105
106#endif /* __GTK_SWITCH_H__ */
107