comparison lwlib/xlwtabs.c @ 430:a5df635868b2 r21-2-23

Import from CVS: tag r21-2-23
author cvs
date Mon, 13 Aug 2007 11:29:08 +0200
parents 3ecd8885ac67
children 3a7e78e1142d
comparison
equal deleted inserted replaced
429:8305706cbb93 430:a5df635868b2
596 /* ARGSUSED */ 596 /* ARGSUSED */
597 static Boolean 597 static Boolean
598 TabsSetValues(Widget current, Widget request, Widget new, 598 TabsSetValues(Widget current, Widget request, Widget new,
599 ArgList args, Cardinal *num_args) 599 ArgList args, Cardinal *num_args)
600 { 600 {
601 TabsWidget curtw = (TabsWidget) current ; 601 TabsWidget curtw = (TabsWidget) current ;
602 TabsWidget tw = (TabsWidget) new ; 602 TabsWidget tw = (TabsWidget) new ;
603 Boolean needRedraw = False ; 603 Boolean needRedraw = False ;
604 Widget *childP ; 604 Widget *childP ;
605 int i ; 605 int i ;
606 606
607 607
608 if( tw->tabs.font != curtw->tabs.font || 608 if( tw->tabs.font != curtw->tabs.font ||
609 tw->tabs.internalWidth != curtw->tabs.internalWidth || 609 tw->tabs.internalWidth != curtw->tabs.internalWidth ||
610 tw->tabs.internalHeight != curtw->tabs.internalHeight ) 610 tw->tabs.internalHeight != curtw->tabs.internalHeight )
611 { 611 {
612 tw->tabs.tab_height = 2 * tw->tabs.internalHeight + SHADWID ; 612 tw->tabs.tab_height = 2 * tw->tabs.internalHeight + SHADWID ;
613 613
614 if( tw->tabs.font != NULL ) 614 if( tw->tabs.font != NULL )
615 tw->tabs.tab_height += tw->tabs.font->max_bounds.ascent + 615 tw->tabs.tab_height += tw->tabs.font->max_bounds.ascent +
616 tw->tabs.font->max_bounds.descent ; 616 tw->tabs.font->max_bounds.descent ;
617 617
618 /* Tab size has changed. Resize all tabs and request a new size */ 618 /* Tab size has changed. Resize all tabs and request a new size */
619 for(i=0, childP=tw->composite.children; 619 for(i=0, childP=tw->composite.children;
620 i < tw->composite.num_children; 620 i < tw->composite.num_children;
621 ++i, ++childP) 621 ++i, ++childP)
622 if( XtIsManaged(*childP) ) 622 if( XtIsManaged(*childP) )
623 TabWidth(*childP) ; 623 TabWidth(*childP) ;
624 PreferredSize(tw, &tw->core.width, &tw->core.height, NULL,NULL) ; 624 PreferredSize(tw, &tw->core.width, &tw->core.height, NULL,NULL) ;
625 needRedraw = True ; 625 needRedraw = True ;
626 tw->tabs.needs_layout = True ; 626 tw->tabs.needs_layout = True ;
627 } 627 }
628 628
629 /* TODO: if any color changes, need to recompute GCs and redraw */ 629 /* TODO: if any color changes, need to recompute GCs and redraw */
630 630
631 if( tw->core.background_pixel != curtw->core.background_pixel || 631 if( tw->core.background_pixel != curtw->core.background_pixel ||
632 tw->core.background_pixmap != curtw->core.background_pixmap ) 632 tw->core.background_pixmap != curtw->core.background_pixmap )
633 if( XtIsRealized(new) ) 633 if( XtIsRealized(new) )
634 { 634 {
635 TabsFreeGCs(tw) ; 635 TabsFreeGCs(tw) ;
636 TabsAllocGCs(tw) ; 636 TabsAllocGCs(tw) ;
637 needRedraw = True ; 637 needRedraw = True ;
638 } 638 }
639 639
640 if( tw->core.sensitive != curtw->core.sensitive ) 640 if( tw->core.sensitive != curtw->core.sensitive )
641 needRedraw = True ; 641 needRedraw = True ;
642 642
643 /* If top widget changes, need to change stacking order, redraw tabs. 643 /* If top widget changes, need to change stacking order, redraw tabs.
644 * Window system will handle the redraws. 644 * Window system will handle the redraws.
645 */ 645 */
646 646
647 if( tw->tabs.topWidget != curtw->tabs.topWidget ) 647 if( tw->tabs.topWidget != curtw->tabs.topWidget ) {
648 { 648 if( XtIsRealized(tw->tabs.topWidget) )
649 if( XtIsRealized(tw->tabs.topWidget) ) 649 {
650 { 650 Widget w = tw->tabs.topWidget ;
651 Widget w = tw->tabs.topWidget ; 651 TabsConstraints tab = (TabsConstraints) w->core.constraints ;
652 TabsConstraints tab = (TabsConstraints) w->core.constraints ; 652
653 653 XRaiseWindow(XtDisplay(w), XtWindow(w)) ;
654 XRaiseWindow(XtDisplay(w), XtWindow(w)) ;
655 #ifdef NEED_MOTIF 654 #ifdef NEED_MOTIF
656 XtVaSetValues(curtw->tabs.topWidget, XmNtraversalOn, False, 0) ; 655 XtVaSetValues(curtw->tabs.topWidget, XmNtraversalOn, False, 0) ;
657 XtVaSetValues(w, XmNtraversalOn, True, 0) ; 656 XtVaSetValues(w, XmNtraversalOn, True, 0) ;
658 #endif 657 #endif
659 658
660 if( tab->tabs.row != tw->tabs.numRows-1 ) 659 if( tab->tabs.row != tw->tabs.numRows-1 )
661 TabsShuffleRows(tw) ; 660 TabsShuffleRows(tw) ;
662 661
663 needRedraw = True ; 662 needRedraw = True ;
664 } 663 }
665 else 664 }
666 tw->tabs.needs_layout = True ; 665 else
667 } 666 tw->tabs.needs_layout = True ;
668 667
669 return needRedraw ; 668 return needRedraw ;
670 } 669 }
671 670
672 671
673 /* Called when any child constraint resources change. */ 672 /* Called when any child constraint resources change. */
674 673
818 Dimension cw,ch ; /* children's preferred size */ 817 Dimension cw,ch ; /* children's preferred size */
819 Dimension aw,ah ; /* available size we can give child */ 818 Dimension aw,ah ; /* available size we can give child */
820 Dimension th ; /* space used by tabs */ 819 Dimension th ; /* space used by tabs */
821 Dimension wid,hgt ; /* Tabs widget size */ 820 Dimension wid,hgt ; /* Tabs widget size */
822 821
823 rw = tab->tabs.wid ; 822 rw = cw = tab->tabs.wid ;
824 rh = tab->tabs.hgt ; 823 rh = ch = tab->tabs.hgt ;
825 824
826 /* find out what the resulting preferred size would be */ 825 /* find out what the resulting preferred size would be */
827 826
828 #ifdef COMMENT 827 #ifdef COMMENT
829 MaxChild(tw, &cw, &ch) ; 828 MaxChild(tw, &cw, &ch) ;
1057 1056
1058 static void 1057 static void
1059 TabsPage(Widget w, XEvent *event, String *params, Cardinal *num_params) 1058 TabsPage(Widget w, XEvent *event, String *params, Cardinal *num_params)
1060 { 1059 {
1061 TabsWidget tw = (TabsWidget) w ; 1060 TabsWidget tw = (TabsWidget) w ;
1062 Widget newtop ; 1061 Widget newtop = NULL;
1063 Widget *childP ; 1062 Widget *childP ;
1064 int idx ; 1063 int idx ;
1065 int nc = tw->composite.num_children ; 1064 int nc = tw->composite.num_children ;
1066 1065
1067 if( nc <= 0 ) 1066 if( nc <= 0 )
1120 1119
1121 static void 1120 static void
1122 TabsHighlight(Widget w, XEvent *event, String *params, Cardinal *num_params) 1121 TabsHighlight(Widget w, XEvent *event, String *params, Cardinal *num_params)
1123 { 1122 {
1124 TabsWidget tw = (TabsWidget) w ; 1123 TabsWidget tw = (TabsWidget) w ;
1125 Widget newhl ; 1124 Widget newhl = NULL;
1126 Widget *childP ; 1125 Widget *childP ;
1127 int idx ; 1126 int idx ;
1128 int nc = tw->composite.num_children ; 1127 int nc = tw->composite.num_children ;
1129 1128
1130 if( nc <= 0 ) 1129 if( nc <= 0 )