Wed, 07 Nov 2007 13:49:26 +0000
disapproval of revision '40c706f04342bffe4e576e1e11a54fc8ef3d354b'
| 18406 | 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 | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19587
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 18406 | 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 */ | |
|
19587
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
59 | int smallstep; |
|
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
60 | int largestep; |
| 18406 | 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 | |
|
20939
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
78 | * |
|
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
79 | * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
| 18406 | 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 | |
|
20939
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
94 | * |
|
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
95 | * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
| 18406 | 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 | |
|
20939
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
105 | * |
|
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
106 | * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
| 18406 | 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 | |
|
19587
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
114 | * @param step The amount for each step |
|
20939
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
115 | * |
|
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
116 | * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
| 18406 | 117 | */ |
| 118 | void gnt_slider_set_step(GntSlider *slider, int step); | |
| 119 | ||
| 120 | /** | |
|
19587
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
121 | * Sets the amount of change a small step. |
|
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
122 | * |
|
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
123 | * @param slider The slider |
|
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
124 | * @param step The amount for a small step (for the slider) |
|
20939
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
125 | * |
|
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
126 | * @since 2.2.0 |
|
19587
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
127 | */ |
|
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
128 | void gnt_slider_set_small_step(GntSlider *slider, int step); |
|
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
129 | |
|
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
130 | /** |
|
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
131 | * Sets the amount of change a large step. |
|
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
132 | * |
|
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
133 | * @param slider The slider |
|
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
134 | * @param step The amount for a large step (for the slider) |
|
20939
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
135 | * |
|
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
136 | * @since 2.2.0 |
|
19587
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
137 | */ |
|
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
138 | void gnt_slider_set_large_step(GntSlider *slider, int step); |
|
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
139 | |
|
8715e45e1258
Have small and large steps for the slider.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18433
diff
changeset
|
140 | /** |
| 18406 | 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 | |
|
20939
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
148 | * |
|
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
149 | * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
| 18406 | 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 | |
|
20939
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
158 | * |
|
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
159 | * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
| 18406 | 160 | */ |
| 161 | void gnt_slider_set_value(GntSlider *slider, int value); | |
| 162 | ||
| 163 | /** | |
| 18433 | 164 | * Get the current value for the slider. |
| 165 | * | |
| 166 | * @param slider The slider | |
| 167 | * | |
|
20939
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
168 | * |
|
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
169 | * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
| 18433 | 170 | */ |
| 171 | int gnt_slider_get_value(GntSlider *slider); | |
| 172 | ||
| 173 | /** | |
| 18406 | 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 | |
|
20939
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
178 | * |
|
13dd02add7c1
Add @since doxygen tags for finch/libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
179 | * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
| 18406 | 180 | */ |
| 181 | void gnt_slider_reflect_label(GntSlider *slider, GntLabel *label); | |
| 182 | ||
| 18433 | 183 | |
| 18406 | 184 | G_END_DECLS |
| 185 | ||
| 186 | #endif /* GNT_SLIDER_H */ |