Mercurial > hg > xemacs-beta
comparison lwlib/lwlib-Xlw.c @ 2641:f7e2b977e15c
[xemacs-hg @ 2005-03-09 05:58:54 by stephent]
Stop geometry thrashing in tabs widget <87vf81e4z9.fsf@tleepslib.sk.tsukuba.ac.jp>
author | stephent |
---|---|
date | Wed, 09 Mar 2005 05:58:54 +0000 |
parents | 04bc9d2f42c7 |
children | ad2f4ae9895b |
comparison
equal
deleted
inserted
replaced
2640:a4040d921acc | 2641:f7e2b977e15c |
---|---|
317 #endif /* LWLIB_SCROLLBARS_LUCID */ | 317 #endif /* LWLIB_SCROLLBARS_LUCID */ |
318 | 318 |
319 #ifdef LWLIB_TABS_LUCID | 319 #ifdef LWLIB_TABS_LUCID |
320 /* tab control | 320 /* tab control |
321 | 321 |
322 lwlib is such an incredible hairy crock. I just cannot believe | 322 [[ lwlib is such an incredible hairy crock. I just cannot believe |
323 it! There are random dependencies between functions, there is a | 323 it! There are random dependencies between functions, there is a |
324 total lack of genericity, even though it initially appears to be | 324 total lack of genericity, even though it initially appears to be |
325 generic. It should all be junked and begun again. Building tabs are | 325 generic. It should all be junked and begun again. Building tabs are |
326 an example - in theory we should be able to reuse a lot of the | 326 an example - in theory we should be able to reuse a lot of the |
327 general stuff because we want to put labels of whatever toolkit we | 327 general stuff because we want to put labels of whatever toolkit we |
328 are using in the tab. Instead we have to hack it by hand. */ | 328 are using in the tab. Instead we have to hack it by hand. ]] |
329 While lwlib is a hairy crock, whoever wrote that seems to misunderstand | |
330 Falk's tab control widget. The tab control widget has *two* kinds of | |
331 children: *widgets*, which all occupy a *single* pane below the row of | |
332 tabs---this is where the labels created in build_tabs_in_widget go, and | |
333 *gadgets*, the tabs themselves, which do *not* draw themselves, but | |
334 rather are drawn by the control. In fact, in XEmacs the true widget | |
335 children are *never* visible! So this case is not a problem in the | |
336 design of lwlib, but rather of Falk's widget. -- sjt */ | |
329 static void | 337 static void |
330 xlw_tab_control_callback (Widget w, XtPointer client_data, XtPointer call_data) | 338 xlw_tab_control_callback (Widget w, XtPointer client_data, XtPointer call_data) |
331 { | 339 { |
332 /* call data is the topmost widget */ | 340 /* call data is the topmost widget */ |
333 widget_instance* instance = (widget_instance*)client_data; | 341 widget_instance* instance = (widget_instance*)client_data; |
373 int ac = 0; | 381 int ac = 0; |
374 Widget tab = 0; | 382 Widget tab = 0; |
375 widget_value* val = instance->info->val; | 383 widget_value* val = instance->info->val; |
376 | 384 |
377 XtSetArg (al [ac], XtNsensitive, val->enabled); ac++; | 385 XtSetArg (al [ac], XtNsensitive, val->enabled); ac++; |
378 XtSetArg (al [ac], XtNmappedWhenManaged, FALSE); ac++; | 386 XtSetArg (al [ac], XtNmappedWhenManaged, False); ac++; |
379 XtSetArg (al [ac], XtNorientation, XtorientHorizontal); ac++; | 387 XtSetArg (al [ac], XtNorientation, XtorientHorizontal); ac++; |
380 XtSetArg (al [ac], XtNresizable, False); ac++; | |
381 | 388 |
382 /* add any args the user supplied for creation time */ | 389 /* add any args the user supplied for creation time */ |
383 lw_add_value_args_to_args (val, al, &ac); | 390 lw_add_value_args_to_args (val, al, &ac); |
384 | 391 |
385 tab = XtCreateManagedWidget (val->name, tabsWidgetClass, | 392 tab = XtCreateManagedWidget (val->name, tabsWidgetClass, |
394 | 401 |
395 static void build_tabs_in_widget (widget_instance* UNUSED (instance), | 402 static void build_tabs_in_widget (widget_instance* UNUSED (instance), |
396 Widget widget, widget_value* val) | 403 Widget widget, widget_value* val) |
397 { | 404 { |
398 widget_value* cur = val; | 405 widget_value* cur = val; |
406 Arg al[1]; | |
407 | |
408 /* Children are always invisible, don't permit resizing. */ | |
409 XtSetArg (al[0], XtNresizable, False); | |
410 | |
399 for (cur = val; cur; cur = cur->next) | 411 for (cur = val; cur; cur = cur->next) |
400 { | 412 { |
401 if (cur->value) | 413 if (cur->value) |
402 { | 414 { |
415 Widget w; | |
403 #ifdef LWLIB_WIDGETS_MOTIF | 416 #ifdef LWLIB_WIDGETS_MOTIF |
404 xm_create_label (widget, cur); | 417 w = xm_create_label (widget, cur); |
405 #else | 418 #else |
406 xaw_create_label (widget, cur); | 419 w = xaw_create_label (widget, cur); |
407 #endif | 420 #endif |
421 XtSetValues (w, al, 1); | |
408 } | 422 } |
409 cur->change = NO_CHANGE; | 423 cur->change = NO_CHANGE; |
410 } | 424 } |
411 } | 425 } |
412 | 426 |