| 138 }; |
138 }; |
| 139 |
139 |
| 140 G_BEGIN_DECLS |
140 G_BEGIN_DECLS |
| 141 |
141 |
| 142 /** |
142 /** |
| 143 * |
143 * @return GType for GntWidget. |
| 144 * |
|
| 145 * @return |
|
| 146 */ |
144 */ |
| 147 GType gnt_widget_get_gtype(void); |
145 GType gnt_widget_get_gtype(void); |
| 148 |
146 |
| 149 /** |
147 /** |
| 150 * |
148 * Destroy a widget. |
| 151 * @param widget |
149 * @param widget The widget to destroy. |
| 152 */ |
150 */ |
| 153 void gnt_widget_destroy(GntWidget *widget); |
151 void gnt_widget_destroy(GntWidget *widget); |
| 154 |
152 |
| 155 /** |
153 /** |
| 156 * |
154 * Show a widget. This should only be used for toplevel widgets. For the rest |
| 157 * @param widget |
155 * of the widgets, use #gnt_widget_draw instead. |
| |
156 * |
| |
157 * @param widget The widget to show. |
| 158 */ |
158 */ |
| 159 void gnt_widget_show(GntWidget *widget); |
159 void gnt_widget_show(GntWidget *widget); |
| 160 |
160 |
| 161 /** |
161 /** |
| 162 * |
162 * Draw a widget. |
| 163 * @param widget |
163 * @param widget The widget to draw. |
| 164 */ |
164 */ |
| 165 void gnt_widget_draw(GntWidget *widget); |
165 void gnt_widget_draw(GntWidget *widget); |
| 166 |
166 |
| 167 /** |
167 /** |
| 168 * |
168 * @internal |
| 169 * @param widget |
169 * Expose part of a widget. |
| 170 * @param x |
|
| 171 * @param y |
|
| 172 * @param width |
|
| 173 * @param height |
|
| 174 */ |
170 */ |
| 175 void gnt_widget_expose(GntWidget *widget, int x, int y, int width, int height); |
171 void gnt_widget_expose(GntWidget *widget, int x, int y, int width, int height); |
| 176 |
172 |
| 177 /** |
173 /** |
| 178 * |
174 * Hide a widget. |
| 179 * @param widget |
175 * @param widget The widget to hide. |
| 180 */ |
176 */ |
| 181 void gnt_widget_hide(GntWidget *widget); |
177 void gnt_widget_hide(GntWidget *widget); |
| 182 |
178 |
| 183 /** |
179 /** |
| 184 * |
180 * Get the position of a widget. |
| 185 * @param widget |
181 * |
| 186 * @param x |
182 * @param widget The widget. |
| 187 * @param y |
183 * @param x Location to store the x-coordinate of the widget. |
| |
184 * @param y Location to store the y-coordinate of the widget. |
| 188 */ |
185 */ |
| 189 void gnt_widget_get_position(GntWidget *widget, int *x, int *y); |
186 void gnt_widget_get_position(GntWidget *widget, int *x, int *y); |
| 190 |
187 |
| 191 /** |
188 /** |
| 192 * |
189 * Set the position of a widget. |
| 193 * @param widget |
190 * @param widget The widget to reposition. |
| 194 * @param x |
191 * @param x The x-coordinate of the widget. |
| 195 * @param y |
192 * @param y The x-coordinate of the widget. |
| 196 */ |
193 */ |
| 197 void gnt_widget_set_position(GntWidget *widget, int x, int y); |
194 void gnt_widget_set_position(GntWidget *widget, int x, int y); |
| 198 |
195 |
| 199 /** |
196 /** |
| 200 * |
197 * Request a widget to calculate its desired size. |
| 201 * @param widget |
198 * @param widget The widget. |
| 202 */ |
199 */ |
| 203 void gnt_widget_size_request(GntWidget *widget); |
200 void gnt_widget_size_request(GntWidget *widget); |
| 204 |
201 |
| 205 /** |
202 /** |
| 206 * |
203 * Get the size of a widget. |
| 207 * @param widget |
204 * @param widget The widget. |
| 208 * @param width |
205 * @param width Location to store the width of the widget. |
| 209 * @param height |
206 * @param height Location to store the height of the widget. |
| 210 */ |
207 */ |
| 211 void gnt_widget_get_size(GntWidget *widget, int *width, int *height); |
208 void gnt_widget_get_size(GntWidget *widget, int *width, int *height); |
| 212 |
209 |
| 213 /** |
210 /** |
| 214 * |
211 * Set the size of a widget. |
| 215 * @param widget |
212 * |
| 216 * @param width |
213 * @param widget The widget to resize. |
| 217 * @param height |
214 * @param width The width of the widget. |
| 218 * |
215 * @param height The height of the widget. |
| 219 * @return |
216 * |
| |
217 * @return If the widget was resized to the new size. |
| 220 */ |
218 */ |
| 221 gboolean gnt_widget_set_size(GntWidget *widget, int width, int height); |
219 gboolean gnt_widget_set_size(GntWidget *widget, int width, int height); |
| 222 |
220 |
| 223 /** |
221 /** |
| 224 * |
222 * Confirm a requested a size for a widget. |
| 225 * @param widget |
223 * |
| 226 * @param width |
224 * @param widget The widget. |
| 227 * @param height |
225 * @param width The requested width. |
| 228 * |
226 * @param height The requested height. |
| 229 * @return |
227 * |
| |
228 * @return @c TRUE if the new size was confirmed, @c FALSE otherwise. |
| 230 */ |
229 */ |
| 231 gboolean gnt_widget_confirm_size(GntWidget *widget, int width, int height); |
230 gboolean gnt_widget_confirm_size(GntWidget *widget, int width, int height); |
| 232 |
231 |
| 233 /** |
232 /** |
| 234 * |
233 * Trigger the key-press callbacks for a widget. |
| 235 * @param widget |
234 * |
| 236 * @param keys |
235 * @param widget The widget. |
| 237 * |
236 * @param keys The keypress on the widget. |
| 238 * @return |
237 * |
| |
238 * @return @c TRUE if the key-press was handled, @c FALSE otherwise. |
| 239 */ |
239 */ |
| 240 gboolean gnt_widget_key_pressed(GntWidget *widget, const char *keys); |
240 gboolean gnt_widget_key_pressed(GntWidget *widget, const char *keys); |
| 241 |
241 |
| 242 /** |
242 /** |
| 243 * |
243 * Trigger the 'click' callback of a widget. |
| 244 * @param widget |
244 * |
| 245 * @param event |
245 * @param widget The widget. |
| 246 * @param x |
246 * @param event The mouseevent. |
| 247 * @param y |
247 * @param x The x-coordinate of the mouse. |
| 248 * |
248 * @param y The y-coordinate of the mouse. |
| 249 * @return |
249 * |
| |
250 * @return @c TRUE if the event was handled, @c FALSE otherwise. |
| 250 */ |
251 */ |
| 251 gboolean gnt_widget_clicked(GntWidget *widget, GntMouseEvent event, int x, int y); |
252 gboolean gnt_widget_clicked(GntWidget *widget, GntMouseEvent event, int x, int y); |
| 252 |
253 |
| 253 /** |
254 /** |
| 254 * |
255 * Give or remove focus to a widget. |
| 255 * @param widget |
256 * @param widget The widget. |
| 256 * @param set |
257 * @param set @c TRUE of focus should be given to the widget, @c FALSE if |
| 257 * |
258 * focus should be removed. |
| 258 * @return |
259 * |
| |
260 * @return @c TRUE if the focus has been changed, @c FALSE otherwise. |
| 259 */ |
261 */ |
| 260 gboolean gnt_widget_set_focus(GntWidget *widget, gboolean set); |
262 gboolean gnt_widget_set_focus(GntWidget *widget, gboolean set); |
| 261 |
263 |
| 262 /** |
264 /** |
| 263 * |
265 * Activate a widget. This only applies to widgets that can be activated (eg. GntButton) |
| 264 * @param widget |
266 * @param widget The widget to activate. |
| 265 */ |
267 */ |
| 266 void gnt_widget_activate(GntWidget *widget); |
268 void gnt_widget_activate(GntWidget *widget); |
| 267 |
269 |
| 268 /** |
270 /** |
| 269 * |
271 * Set the name of a widget. |
| 270 * @param widget |
272 * @param widget The widget. |
| 271 * @param name |
273 * @param name A new name for the widget. |
| 272 */ |
274 */ |
| 273 void gnt_widget_set_name(GntWidget *widget, const char *name); |
275 void gnt_widget_set_name(GntWidget *widget, const char *name); |
| 274 |
276 |
| |
277 /** |
| |
278 * Get the name of a widget. |
| |
279 * @param widget The widget. |
| |
280 * @return The name of the widget. |
| |
281 */ |
| 275 const char *gnt_widget_get_name(GntWidget *widget); |
282 const char *gnt_widget_get_name(GntWidget *widget); |
| 276 |
283 |
| 277 /* Widget-subclasses should call this from the draw-callback. |
284 /** |
| 278 * Applications should just call gnt_widget_draw instead of this. */ |
285 * @internal |
| 279 /** |
286 * Use #gnt_widget_draw instead. |
| 280 * |
|
| 281 * @param widget |
|
| 282 */ |
287 */ |
| 283 void gnt_widget_queue_update(GntWidget *widget); |
288 void gnt_widget_queue_update(GntWidget *widget); |
| 284 |
289 |
| 285 /** |
290 /** |
| 286 * |
291 * Set whether a widget can take focus or not. |
| 287 * @param widget |
292 * |
| 288 * @param set |
293 * @param widget The widget. |
| |
294 * @param set @c TRUE if the widget can take focus. |
| 289 */ |
295 */ |
| 290 void gnt_widget_set_take_focus(GntWidget *widget, gboolean set); |
296 void gnt_widget_set_take_focus(GntWidget *widget, gboolean set); |
| 291 |
297 |
| 292 /** |
298 /** |
| 293 * |
299 * Set the visibility of a widget. |
| 294 * @param widget |
300 * |
| 295 * @param set |
301 * @param widget The widget. |
| |
302 * @param set Whether the widget is visible or not. |
| 296 */ |
303 */ |
| 297 void gnt_widget_set_visible(GntWidget *widget, gboolean set); |
304 void gnt_widget_set_visible(GntWidget *widget, gboolean set); |
| 298 |
305 |
| 299 /** |
306 /** |
| 300 * |
307 * Check whether the widget has shadows. |
| 301 * @param widget |
308 * |
| 302 * |
309 * @param widget The widget. |
| 303 * @return |
310 * |
| |
311 * @return @c TRUE if the widget has shadows. This checks both the user-setting |
| |
312 * and whether the widget can have shadows at all. |
| 304 */ |
313 */ |
| 305 gboolean gnt_widget_has_shadow(GntWidget *widget); |
314 gboolean gnt_widget_has_shadow(GntWidget *widget); |
| 306 |
315 |
| 307 G_END_DECLS |
316 G_END_DECLS |
| 308 |
317 |