comparison lwlib/xlwtabs.c @ 432:3a7e78e1142d r21-2-24

Import from CVS: tag r21-2-24
author cvs
date Mon, 13 Aug 2007 11:29:58 +0200
parents a5df635868b2
children 9d177e8d4150
comparison
equal deleted inserted replaced
431:a97165e56215 432:3a7e78e1142d
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with XEmacs; see the file COPYING. If not, write to 17 along with XEmacs; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */ 19 Boston, MA 02111-1307, USA. */
20 20
21 /* Synched up with: Tabs.c 1.23 */ 21 /* Synched up with: Tabs.c 1.25 */
22 22
23 /* 23 /*
24 * Tabs.c - Index Tabs composite widget 24 * Tabs.c - Index Tabs composite widget
25 * 25 *
26 * Author: Edward A. Falk 26 * Author: Edward A. Falk
566 bw = tab->tabs.bwid ; 566 bw = tab->tabs.bwid ;
567 XtConfigureWidget(*childP, SHADWID,tw->tabs.tab_total+SHADWID, 567 XtConfigureWidget(*childP, SHADWID,tw->tabs.tab_total+SHADWID,
568 cw-bw*2,ch-bw*2, bw) ; 568 cw-bw*2,ch-bw*2, bw) ;
569 } 569 }
570 if( XtIsRealized(w) ) 570 if( XtIsRealized(w) )
571 XClearWindow(XtDisplay((Widget)tw), XtWindow((Widget)tw)) ; 571 {
572 XClearWindow(XtDisplay((Widget)tw), XtWindow((Widget)tw)) ;
573 tw->tabs.needs_layout = False ;
574 XtClass(tw)->core_class.expose((Widget)tw,NULL,None) ;
575 }
572 } 576 }
573 577
574 tw->tabs.needs_layout = False ; 578 tw->tabs.needs_layout = False ;
575 } /* Resize */ 579 } /* Resize */
576 580
627 } 631 }
628 632
629 /* TODO: if any color changes, need to recompute GCs and redraw */ 633 /* TODO: if any color changes, need to recompute GCs and redraw */
630 634
631 if( tw->core.background_pixel != curtw->core.background_pixel || 635 if( tw->core.background_pixel != curtw->core.background_pixel ||
632 tw->core.background_pixmap != curtw->core.background_pixmap ) 636 tw->core.background_pixmap != curtw->core.background_pixmap ||
637 tw->tabs.font != curtw->tabs.font )
633 if( XtIsRealized(new) ) 638 if( XtIsRealized(new) )
634 { 639 {
635 TabsFreeGCs(tw) ; 640 TabsFreeGCs(tw) ;
636 TabsAllocGCs(tw) ; 641 TabsAllocGCs(tw) ;
637 needRedraw = True ; 642 needRedraw = True ;
642 647
643 /* If top widget changes, need to change stacking order, redraw tabs. 648 /* If top widget changes, need to change stacking order, redraw tabs.
644 * Window system will handle the redraws. 649 * Window system will handle the redraws.
645 */ 650 */
646 651
647 if( tw->tabs.topWidget != curtw->tabs.topWidget ) { 652 if( tw->tabs.topWidget != curtw->tabs.topWidget )
653 {
648 if( XtIsRealized(tw->tabs.topWidget) ) 654 if( XtIsRealized(tw->tabs.topWidget) )
649 { 655 {
650 Widget w = tw->tabs.topWidget ; 656 Widget w = tw->tabs.topWidget ;
651 TabsConstraints tab = (TabsConstraints) w->core.constraints ; 657 TabsConstraints tab = (TabsConstraints) w->core.constraints ;
652 658
659 if( tab->tabs.row != tw->tabs.numRows-1 ) 665 if( tab->tabs.row != tw->tabs.numRows-1 )
660 TabsShuffleRows(tw) ; 666 TabsShuffleRows(tw) ;
661 667
662 needRedraw = True ; 668 needRedraw = True ;
663 } 669 }
664 }
665 else 670 else
666 tw->tabs.needs_layout = True ; 671 tw->tabs.needs_layout = True ;
672 }
667 673
668 return needRedraw ; 674 return needRedraw ;
669 } 675 }
670 676
671 677
825 /* find out what the resulting preferred size would be */ 831 /* find out what the resulting preferred size would be */
826 832
827 #ifdef COMMENT 833 #ifdef COMMENT
828 MaxChild(tw, &cw, &ch) ; 834 MaxChild(tw, &cw, &ch) ;
829 #endif /* COMMENT */ 835 #endif /* COMMENT */
830 PreferredSize2(tw, tw->tabs.max_cw,tw->tabs.max_ch, &wid, &hgt) ; 836 PreferredSize2(tw,
837 cw=tw->tabs.max_cw, ch=tw->tabs.max_ch, &wid, &hgt) ;
831 838
832 /* Ask to be resized to accommodate. */ 839 /* Ask to be resized to accommodate. */
833 840
834 if( wid != tw->core.width || hgt != tw->core.height ) 841 if( wid != tw->core.width || hgt != tw->core.height )
835 { 842 {
1080 break ; 1087 break ;
1081 1088
1082 switch( params[0][0] ) { 1089 switch( params[0][0] ) {
1083 case 'u': /* up */ 1090 case 'u': /* up */
1084 case 'U': 1091 case 'U':
1085 if( idx == 0 ) 1092 if( --idx < 0 )
1086 idx = nc ; 1093 idx = nc-1 ;
1087 newtop = tw->composite.children[idx-1] ; 1094 newtop = tw->composite.children[idx] ;
1088 break ; 1095 break ;
1089 1096
1090 case 'd': /* down */ 1097 case 'd': /* down */
1091 case 'D': 1098 case 'D':
1092 if( ++idx >= nc ) 1099 if( ++idx >= nc )
1094 newtop = tw->composite.children[idx] ; 1101 newtop = tw->composite.children[idx] ;
1095 break ; 1102 break ;
1096 1103
1097 case 'h': 1104 case 'h':
1098 case 'H': 1105 case 'H':
1106 default:
1099 newtop = tw->composite.children[0] ; 1107 newtop = tw->composite.children[0] ;
1100 break ; 1108 break ;
1101 1109
1102 case 'e': 1110 case 'e':
1103 case 'E': 1111 case 'E':
1139 if( tw->tabs.hilight == NULL ) 1147 if( tw->tabs.hilight == NULL )
1140 newhl = tw->composite.children[0] ; 1148 newhl = tw->composite.children[0] ;
1141 1149
1142 else 1150 else
1143 { 1151 {
1152 /* find index of currently highlit child */
1144 for(idx=0, childP=tw->composite.children; idx < nc; ++idx, ++childP ) 1153 for(idx=0, childP=tw->composite.children; idx < nc; ++idx, ++childP )
1145 if( tw->tabs.hilight == *childP ) 1154 if( tw->tabs.hilight == *childP )
1146 break ; 1155 break ;
1147 1156
1148 switch( params[0][0] ) { 1157 switch( params[0][0] ) {
1149 case 'u': /* up */ 1158 case 'u': /* up */
1150 case 'U': 1159 case 'U':
1151 if( idx == 0 ) 1160 if( --idx < 0 )
1152 idx = nc ; 1161 idx = nc-1 ;
1153 newhl = tw->composite.children[idx-1] ; 1162 newhl = tw->composite.children[idx] ;
1154 break ; 1163 break ;
1155 1164
1156 case 'd': /* down */ 1165 case 'd': /* down */
1157 case 'D': 1166 case 'D':
1158 if( ++idx >= nc ) 1167 if( ++idx >= nc )
1166 break ; 1175 break ;
1167 1176
1168 case 'e': 1177 case 'e':
1169 case 'E': 1178 case 'E':
1170 newhl = tw->composite.children[nc-1] ; 1179 newhl = tw->composite.children[nc-1] ;
1180 break ;
1181
1182 default:
1183 newhl = tw->tabs.hilight ;
1171 break ; 1184 break ;
1172 } 1185 }
1173 } 1186 }
1174 1187
1175 XawTabsSetHighlight(w, newhl) ; 1188 XawTabsSetHighlight(w, newhl) ;