Mercurial > pidgin.yaz
annotate finch/libgnt/gntslider.h @ 29220:88d889b54df4
Fix building finch & libgnt using older gcc or non-gcc compilers that do
not understand G_GNUC_NULL_TERMINATED
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Thu, 31 Dec 2009 17:33:35 +0000 |
parents | acf284962b40 |
children | 44f53d3fc54f |
rev | line source |
---|---|
18352 | 1 /** |
2 * @file gntslider.h Slider API | |
3 * @ingroup gnt | |
4 */ | |
5 /* | |
6 * GNT - The GLib Ncurses Toolkit | |
7 * | |
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. | |
11 * | |
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. | |
16 * | |
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. | |
21 * | |
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 | |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19410
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
18352 | 25 */ |
26 | |
27 #ifndef GNT_SLIDER_H | |
28 #define GNT_SLIDER_H | |
29 | |
30 #include "gntwidget.h" | |
31 #include "gnt.h" | |
32 #include "gntlabel.h" | |
33 | |
34 #define GNT_TYPE_SLIDER (gnt_slider_get_gtype()) | |
35 #define GNT_SLIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_SLIDER, GntSlider)) | |
36 #define GNT_SLIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_SLIDER, GntSliderClass)) | |
37 #define GNT_IS_SLIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_SLIDER)) | |
38 #define GNT_IS_SLIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_SLIDER)) | |
39 #define GNT_SLIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_SLIDER, GntSliderClass)) | |
40 | |
41 #define GNT_SLIDER_FLAGS(obj) (GNT_SLIDER(obj)->priv.flags) | |
42 #define GNT_SLIDER_SET_FLAGS(obj, flags) (GNT_SLIDER_FLAGS(obj) |= flags) | |
43 #define GNT_SLIDER_UNSET_FLAGS(obj, flags) (GNT_SLIDER_FLAGS(obj) &= ~(flags)) | |
44 | |
45 typedef struct _GntSlider GntSlider; | |
46 typedef struct _GntSliderPriv GntSliderPriv; | |
47 typedef struct _GntSliderClass GntSliderClass; | |
48 | |
49 struct _GntSlider | |
50 { | |
51 GntWidget parent; | |
52 | |
53 gboolean vertical; | |
54 | |
55 int max; /* maximum value */ | |
56 int min; /* minimum value */ | |
57 int step; /* amount to change at each step */ | |
58 int current; /* current value */ | |
19410
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
59 int smallstep; |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
60 int largestep; |
18352 | 61 }; |
62 | |
63 struct _GntSliderClass | |
64 { | |
65 GntWidgetClass parent; | |
66 | |
67 void (*changed)(GntSlider *slider, int); | |
68 void (*gnt_reserved1)(void); | |
69 void (*gnt_reserved2)(void); | |
70 void (*gnt_reserved3)(void); | |
71 void (*gnt_reserved4)(void); | |
72 }; | |
73 | |
74 G_BEGIN_DECLS | |
75 | |
76 /** | |
77 * @return The GType for GntSlider | |
20874
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
78 * |
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
79 * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
18352 | 80 */ |
81 GType gnt_slider_get_gtype(void); | |
82 | |
83 #define gnt_hslider_new(max, min) gnt_slider_new(FALSE, max, min) | |
84 #define gnt_vslider_new(max, min) gnt_slider_new(TRUE, max, min) | |
85 | |
86 /** | |
87 * Create a new slider. | |
88 * | |
89 * @param orient A vertical slider is created if @c TRUE, otherwise the slider is horizontal. | |
90 * @param max The maximum value for the slider | |
91 * @param min The minimum value for the slider | |
92 * | |
93 * @return The newly created slider | |
20874
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
94 * |
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
95 * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
18352 | 96 */ |
97 GntWidget * gnt_slider_new(gboolean orient, int max, int min); | |
98 | |
99 /** | |
100 * Set the range of the slider. | |
101 * | |
102 * @param slider The slider | |
103 * @param max The maximum value | |
104 * @param min The minimum value | |
20874
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
105 * |
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
106 * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
18352 | 107 */ |
108 void gnt_slider_set_range(GntSlider *slider, int max, int min); | |
109 | |
110 /** | |
111 * Sets the amount of change at each step. | |
112 * | |
113 * @param slider The slider | |
19410
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
114 * @param step The amount for each step |
20874
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
115 * |
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
116 * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
18352 | 117 */ |
118 void gnt_slider_set_step(GntSlider *slider, int step); | |
119 | |
120 /** | |
19410
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
121 * Sets the amount of change a small step. |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
122 * |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
123 * @param slider The slider |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
124 * @param step The amount for a small step (for the slider) |
20874
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
125 * |
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
126 * @since 2.2.0 |
19410
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
127 */ |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
128 void gnt_slider_set_small_step(GntSlider *slider, int step); |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
129 |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
130 /** |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
131 * Sets the amount of change a large step. |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
132 * |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
133 * @param slider The slider |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
134 * @param step The amount for a large step (for the slider) |
20874
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
135 * |
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
136 * @since 2.2.0 |
19410
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
137 */ |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
138 void gnt_slider_set_large_step(GntSlider *slider, int step); |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
139 |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
140 /** |
18352 | 141 * Advance the slider forward or backward. |
142 * | |
143 * @param slider The slider | |
144 * @param steps The number of amounts to change, positive to change | |
145 * forward, negative to change backward | |
146 * | |
147 * @return The value of the slider after the change | |
20874
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
148 * |
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
149 * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
18352 | 150 */ |
151 int gnt_slider_advance_step(GntSlider *slider, int steps); | |
152 | |
153 /** | |
154 * Set the current value for the slider. | |
155 * | |
156 * @param slider The slider | |
157 * @param value The current value | |
20874
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
158 * |
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
159 * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
18352 | 160 */ |
161 void gnt_slider_set_value(GntSlider *slider, int value); | |
162 | |
163 /** | |
18515
3b19fa8d0177
Add _get_value for slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18352
diff
changeset
|
164 * Get the current value for the slider. |
3b19fa8d0177
Add _get_value for slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18352
diff
changeset
|
165 * |
3b19fa8d0177
Add _get_value for slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18352
diff
changeset
|
166 * @param slider The slider |
3b19fa8d0177
Add _get_value for slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18352
diff
changeset
|
167 * |
20874
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
168 * |
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
169 * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
18515
3b19fa8d0177
Add _get_value for slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18352
diff
changeset
|
170 */ |
3b19fa8d0177
Add _get_value for slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18352
diff
changeset
|
171 int gnt_slider_get_value(GntSlider *slider); |
3b19fa8d0177
Add _get_value for slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18352
diff
changeset
|
172 |
3b19fa8d0177
Add _get_value for slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18352
diff
changeset
|
173 /** |
18352 | 174 * Update a label with the value of the slider whenever the value changes. |
175 * | |
176 * @param slider The slider | |
177 * @param label The label to update | |
20874
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
178 * |
acf284962b40
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
179 * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
18352 | 180 */ |
181 void gnt_slider_reflect_label(GntSlider *slider, GntLabel *label); | |
182 | |
18515
3b19fa8d0177
Add _get_value for slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18352
diff
changeset
|
183 |
18352 | 184 G_END_DECLS |
185 | |
186 #endif /* GNT_SLIDER_H */ |