Mercurial > pidgin.yaz
annotate finch/libgnt/gntslider.h @ 20350:4d4eb6831722
applied changes from 3ae1e4b3dac8092886b4b8ab961d8d505433b4c4
through 4d5bbc54236419e777e3df044678b798605409bf
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Sun, 21 Oct 2007 04:49:59 +0000 |
parents | 44b4e8bd759b |
children | acf284962b40 |
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 | |
78 */ | |
79 GType gnt_slider_get_gtype(void); | |
80 | |
81 #define gnt_hslider_new(max, min) gnt_slider_new(FALSE, max, min) | |
82 #define gnt_vslider_new(max, min) gnt_slider_new(TRUE, max, min) | |
83 | |
84 /** | |
85 * Create a new slider. | |
86 * | |
87 * @param orient A vertical slider is created if @c TRUE, otherwise the slider is horizontal. | |
88 * @param max The maximum value for the slider | |
89 * @param min The minimum value for the slider | |
90 * | |
91 * @return The newly created slider | |
92 */ | |
93 GntWidget * gnt_slider_new(gboolean orient, int max, int min); | |
94 | |
95 /** | |
96 * Set the range of the slider. | |
97 * | |
98 * @param slider The slider | |
99 * @param max The maximum value | |
100 * @param min The minimum value | |
101 */ | |
102 void gnt_slider_set_range(GntSlider *slider, int max, int min); | |
103 | |
104 /** | |
105 * Sets the amount of change at each step. | |
106 * | |
107 * @param slider The slider | |
19410
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
108 * @param step The amount for each step |
18352 | 109 */ |
110 void gnt_slider_set_step(GntSlider *slider, int step); | |
111 | |
112 /** | |
19410
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
113 * 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
|
114 * |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
115 * @param slider The slider |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
116 * @param step The amount for a small step (for the slider) |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
117 */ |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
118 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
|
119 |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
120 /** |
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 large 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 large step (for the slider) |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
125 */ |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
126 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
|
127 |
3650db1f02d3
Have small and large steps for the slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18515
diff
changeset
|
128 /** |
18352 | 129 * Advance the slider forward or backward. |
130 * | |
131 * @param slider The slider | |
132 * @param steps The number of amounts to change, positive to change | |
133 * forward, negative to change backward | |
134 * | |
135 * @return The value of the slider after the change | |
136 */ | |
137 int gnt_slider_advance_step(GntSlider *slider, int steps); | |
138 | |
139 /** | |
140 * Set the current value for the slider. | |
141 * | |
142 * @param slider The slider | |
143 * @param value The current value | |
144 */ | |
145 void gnt_slider_set_value(GntSlider *slider, int value); | |
146 | |
147 /** | |
18515
3b19fa8d0177
Add _get_value for slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18352
diff
changeset
|
148 * Get the current value for the slider. |
3b19fa8d0177
Add _get_value for slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18352
diff
changeset
|
149 * |
3b19fa8d0177
Add _get_value for slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18352
diff
changeset
|
150 * @param slider The slider |
3b19fa8d0177
Add _get_value for slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18352
diff
changeset
|
151 * |
3b19fa8d0177
Add _get_value for slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18352
diff
changeset
|
152 */ |
3b19fa8d0177
Add _get_value for slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18352
diff
changeset
|
153 int gnt_slider_get_value(GntSlider *slider); |
3b19fa8d0177
Add _get_value for slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18352
diff
changeset
|
154 |
3b19fa8d0177
Add _get_value for slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18352
diff
changeset
|
155 /** |
18352 | 156 * Update a label with the value of the slider whenever the value changes. |
157 * | |
158 * @param slider The slider | |
159 * @param label The label to update | |
160 */ | |
161 void gnt_slider_reflect_label(GntSlider *slider, GntLabel *label); | |
162 | |
18515
3b19fa8d0177
Add _get_value for slider.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18352
diff
changeset
|
163 |
18352 | 164 G_END_DECLS |
165 | |
166 #endif /* GNT_SLIDER_H */ |