comparison console/libgnt/gntwidget.c @ 13907:cc60d0861337

[gaim-migrate @ 16402] This commit has 1234 lines of diff :) Windows can now be moved (alt+m, then the arrow keys, then escape/enter). Add a window to enable/disable accounts. But the 'add' etc. buttons don't have any callbacks yet. I am going to need to do some more widgets (checkbox, combobox) before I do anything else. I have also updated the test programs to work with the changes in libgnt. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 02 Jul 2006 22:13:06 +0000
parents a621329e8c85
children fdf2dbed6faa
comparison
equal deleted inserted replaced
13906:b986b6e2441b 13907:cc60d0861337
237 237
238 void 238 void
239 gnt_widget_show(GntWidget *widget) 239 gnt_widget_show(GntWidget *widget)
240 { 240 {
241 /* Draw the widget and take focus */ 241 /* Draw the widget and take focus */
242 if (GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_CAN_TAKE_FOCUS)
243 {
244 gnt_widget_take_focus(widget);
245 }
242 gnt_widget_draw(widget); 246 gnt_widget_draw(widget);
243 if (GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_CAN_TAKE_FOCUS)
244 {
245 gnt_widget_take_focus(widget);
246 }
247 } 247 }
248 248
249 void 249 void
250 gnt_widget_draw(GntWidget *widget) 250 gnt_widget_draw(GntWidget *widget)
251 { 251 {
265 { 265 {
266 /* XXX: It may be necessary to make sure the size hasn't changed */ 266 /* XXX: It may be necessary to make sure the size hasn't changed */
267 widget->window = newwin(widget->priv.height, widget->priv.width, 267 widget->window = newwin(widget->priv.height, widget->priv.width,
268 widget->priv.y, widget->priv.x); 268 widget->priv.y, widget->priv.x);
269 wbkgd(widget->window, COLOR_PAIR(GNT_COLOR_NORMAL)); 269 wbkgd(widget->window, COLOR_PAIR(GNT_COLOR_NORMAL));
270 270
271 if (!(GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_NO_BORDER)) 271 if (!(GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_NO_BORDER))
272 box(widget->window, 0, 0); 272 box(widget->window, 0, 0);
273 else 273 else
274 werase(widget->window); 274 werase(widget->window);
275 } 275 }
314 314
315 void 315 void
316 gnt_widget_hide(GntWidget *widget) 316 gnt_widget_hide(GntWidget *widget)
317 { 317 {
318 wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); 318 wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL));
319 werase(widget->window);
320 gnt_screen_release(widget); 319 gnt_screen_release(widget);
320 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_MAPPED);
321 } 321 }
322 322
323 void 323 void
324 gnt_widget_set_position(GntWidget *wid, int x, int y) 324 gnt_widget_set_position(GntWidget *wid, int x, int y)
325 { 325 {
326 /* XXX: Need to install properties for these and g_object_notify */ 326 /* XXX: Need to install properties for these and g_object_notify */
327 wid->priv.x = x; 327 wid->priv.x = x;
328 wid->priv.y = y; 328 wid->priv.y = y;
329 if (wid->window)
330 mvwin(wid->window, y, x);
329 g_signal_emit(wid, signals[SIG_POSITION], 0, x, y); 331 g_signal_emit(wid, signals[SIG_POSITION], 0, x, y);
330 } 332 }
331 333
332 void 334 void
333 gnt_widget_get_position(GntWidget *wid, int *x, int *y) 335 gnt_widget_get_position(GntWidget *wid, int *x, int *y)