X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lwlib%2Fxlwtabs.c;h=aa9645097d33201a00ff7b56a2fa97575b7e0304;hb=59eec5f21669e81977b5b1fe9bf717cab49cf7fb;hp=efc2954fed77e4caa27b8e5cf5aea3787437d716;hpb=46f51e794ddb493a8a76ec2f3be00b41e3b0be22;p=chise%2Fxemacs-chise.git diff --git a/lwlib/xlwtabs.c b/lwlib/xlwtabs.c index efc2954..aa96450 100644 --- a/lwlib/xlwtabs.c +++ b/lwlib/xlwtabs.c @@ -1,25 +1,25 @@ /* Tabs Widget for XEmacs. Copyright (C) 1999 Edward A. Falk - + This file is part of XEmacs. - + XEmacs is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + XEmacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with XEmacs; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - + /* Synched up with: Tabs.c 1.27 */ - + /* * Tabs.c - Index Tabs composite widget * @@ -655,7 +655,7 @@ TabsSetValues(Widget current, Widget request, Widget new, * Window system will handle the redraws. */ - if( tw->tabs.topWidget != curtw->tabs.topWidget ) + if( tw->tabs.topWidget != curtw->tabs.topWidget ) { if( XtIsRealized(tw->tabs.topWidget) ) { @@ -757,7 +757,7 @@ TabsAcceptFocus(Widget w, Time *t) /* * Return preferred size. Happily accept anything >= our preferred size. * (TODO: is that the right thing to do? Should we always return "almost" - * if offerred more than we need?) + * if offered more than we need?) */ static XtGeometryResult @@ -980,6 +980,12 @@ TabsChangeManaged(Widget w) tw->tabs.topWidget->core.being_destroyed ) ) tw->tabs.topWidget = NULL ; + /* Check whether the highlight tab is still valid. */ + if( tw->tabs.hilight != NULL && + ( !XtIsManaged(tw->tabs.hilight) || + tw->tabs.hilight->core.being_destroyed ) ) + tw->tabs.hilight = NULL ; + GetPreferredSizes(tw) ; MakeSizeRequest(tw) ; @@ -1086,7 +1092,7 @@ TabsPage(Widget w, XEvent *event, String *params, Cardinal *num_params) Widget newtop = NULL; Widget *childP ; int idx ; - int nc = tw->composite.num_children ; + int nc = tw->tabs.displayChildren ; if( nc <= 0 ) return ; @@ -1150,7 +1156,7 @@ TabsHighlight(Widget w, XEvent *event, String *params, Cardinal *num_params) Widget newhl = NULL; Widget *childP ; int idx ; - int nc = tw->composite.num_children ; + int nc = tw->tabs.displayChildren ; if( nc <= 0 ) return ; @@ -1255,6 +1261,7 @@ XawTabsSetTop(Widget w, Bool callCallbacks) if( !XtIsRealized(w) ) { tw->tabs.topWidget = w ; tw->tabs.needs_layout = True ; + tw->tabs.hilight = NULL; /* The highlight tab might disappear. */ return ; } @@ -1265,6 +1272,14 @@ XawTabsSetTop(Widget w, Bool callCallbacks) #endif tab = (TabsConstraints) w->core.constraints ; + + /* Unhighlight before we start messing with the stacking order. */ + if( tw->tabs.hilight != NULL ) + { + DrawHighlight(tw, tw->tabs.hilight, True) ; + tw->tabs.hilight = NULL; + } + if( tab->tabs.row == 0 ) { /* Easy case; undraw current top, undraw new top, assign new @@ -1307,8 +1322,6 @@ XawTabsSetHighlight(Widget t, Widget w) if( XtIsRealized(t) && w != tw->tabs.hilight ) { - if( tw->tabs.hilight != NULL ) - DrawHighlight(tw, tw->tabs.hilight, True) ; if( w != NULL ) DrawHighlight(tw, w, False) ; } @@ -1372,7 +1385,7 @@ DrawTabs(TabsWidget tw, Bool labels) if( !XtIsRealized((Widget)tw)) return ; - + /* draw tabs and frames by row except for the top tab, which * is drawn last. (This is inefficiently written, but should not * be too slow as long as there are not a lot of rows.) @@ -1736,7 +1749,7 @@ TabLayout(TabsWidget tw, int wid, int hgt, Dimension *reply_height, Bool query_o if (!query_only) tw->tabs.displayChildren++; } - /* If there was only one row, increse the height by TABDELTA */ + /* If there was only one row, increase the height by TABDELTA */ if( ++row == 1 ) { y = TABDELTA ;