annotate lwlib/xlwtabs.c @ 5569:d19b6e3bdf91

#'cl-defsubst-expand; avoid mutually-recursive symbol macros. lisp/ChangeLog addition: 2011-09-10 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (cl-defsubst-expand): Change set 2a6a8da4dd7c of http://mid.gmane.org/19966.17522.332164.615228@parhasard.net wasn't sufficiently comprehensive, symbol macros can be mutually rather than simply recursive, and they can equally hang. Thanks for the bug report, Michael Sperber, and for the test case, Stephen Turnbull.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 10 Sep 2011 13:17:29 +0100
parents 308d34e9f07d
children 574f0cded429
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Tabs Widget for XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1999 Edward A. Falk
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 This file is part of XEmacs.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
5
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4916
diff changeset
6 XEmacs is free software: you can redistribute it and/or modify it
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4916
diff changeset
7 under the terms of the GNU General Public License as published by the
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4916
diff changeset
8 Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4916
diff changeset
9 option) any later version.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
10
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4916
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4916
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4916
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4916
diff changeset
14 for more details.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
15
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4916
diff changeset
16 You should have received a copy of the GNU General Public License
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4916
diff changeset
17 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
18
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 * Tabs.c - Index Tabs composite widget
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 * Author: Edward A. Falk
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 * falk@falconer.vip.best.com
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 * Date: July 29, 1997
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 * Overall layout of this widget is as follows:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 * ________ ,---------. _________
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 * | label || Label || Label | \ tabs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 * |________|| ||_________| /
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 * |+----------------------------+| \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 * || || |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 * || child widget window || > frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 * |+----------------------------+| |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 * +------------------------------+ /
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 * The height of the tabs includes the shadow width, top and bottom
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 * margins, and the height of the text.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 * The height of the frame includes the top and bottom shadow width and the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 * size of the child widget window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 * The tabs overlap the frame and each other vertically by the shadow
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 * width, so that when the topmost tab is drawn, it obliterates part of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 * the frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
50 /* Synched up with: Tabs.c 1.27.
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
51
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
52 This file contains essential XEmacs-related fixes to the original
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
53 version of the Tabs widget. Be VERY careful about syncing if you ever
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
54 update to a more recent version. In general this is probably now a
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
55 bad idea.
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
56
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
57 #### We need to check that various windows (the whole widget, or a single
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
58 tab) are of "reasonable" size, ie, we need to try for more sanity in the
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
59 geometry management routines.
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
60 */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
61
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
62 /*
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
63 * TODO: min child height = tab height
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 #include <stdio.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 #include <X11/Xlib.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 #include <X11/IntrinsicP.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 #include <X11/StringDefs.h>
4769
5460287a3327 Remove support for pre-X11R5 systems, including systems without Xmu. See
Jerry James <james@xemacs.org>
parents: 4528
diff changeset
72 #include <X11/Xmu/Drawing.h>
5460287a3327 Remove support for pre-X11R5 systems, including systems without Xmu. See
Jerry James <james@xemacs.org>
parents: 4528
diff changeset
73 #include <X11/Xmu/Misc.h>
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
74
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
75 /* #### This may be risky, lwlib-internal.h redefines abort() */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
76 #include "lwlib-fonts.h"
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
77 #include "lwlib-colors.h"
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
78 #include "lwlib-internal.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 #include "xlwtabsP.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 #include "xlwgcs.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
82 #define XFT_USE_HEIGHT_NOT_ASCENT_DESCENT 0
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
83
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
84 /* #### These should probably be resources. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 #define MIN_WID 10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 #define MIN_HGT 10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 #define INDENT 3 /* tabs indented from edge by this much */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 #define SPACING 0 /* distance between tabs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 #define SHADWID 1 /* default shadow width */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 #define TABDELTA 2 /* top tab grows this many pixels */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 #define TABLDELTA 2 /* top tab label offset this many pixels */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 /****************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 * IndexTabs Resources
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 ****************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 static char defaultTranslations[] = "\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 <BtnUp>: select() \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 <FocusIn>: highlight() \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 <FocusOut>: unhighlight() \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 <Key>Page_Up: page(up) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 <Key>KP_Page_Up: page(up) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 <Key>Prior: page(up) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 <Key>KP_Prior: page(up) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 <Key>Page_Down: page(down) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 <Key>KP_Page_Down: page(down) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 <Key>Next: page(down) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 <Key>KP_Next: page(down) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 <Key>Home: page(home) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 <Key>KP_Home: page(home) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 <Key>End: page(end) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 <Key>KP_End: page(end) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 <Key>Up: highlight(up) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 <Key>KP_Up: highlight(up) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 <Key>Down: highlight(down) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 <Key>KP_Down: highlight(down) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 <Key> : page(select) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 " ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 static char accelTable[] = " #augment\n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 <Key>Page_Up: page(up) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 <Key>KP_Page_Up: page(up) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 <Key>Prior: page(up) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 <Key>KP_Prior: page(up) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 <Key>Page_Down: page(down) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 <Key>KP_Page_Down: page(down) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 <Key>Next: page(down) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 <Key>KP_Next: page(down) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 <Key>Home: page(home) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 <Key>KP_Home: page(home) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 <Key>End: page(end) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 <Key>KP_End: page(end) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 <Key>Up: highlight(up) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 <Key>KP_Up: highlight(up) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 <Key>Down: highlight(down) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 <Key>KP_Down: highlight(down) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 <Key> : page(select) \n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 " ;
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
142 static XtAccelerators defaultAccelerators ; /* #### Never used */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143
4528
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
144 static XtResource resources[] = {
4522
fc7067b7f407 Backout last patch; forgot to specify file.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4521
diff changeset
145 #define offset(field) XtOffsetOf(TabsRec, tabs.field)
4528
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
146 #define res(name,_class,intrepr,type,member,extrepr,value) \
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
147 Xt_RESOURCE (name, _class, intrepr, type, offset(member), extrepr, value)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148
4528
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
149 res (XtNselectInsensitive, XtCSelectInsensitive, XtRBoolean, Boolean,
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
150 selectInsensitive, XtRImmediate, True),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
151 res (XtNfont, XtCFont, XtRFontStruct, XFontStruct *,
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
152 font, XtRString, XtDefaultFont),
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
153 #ifdef HAVE_XFT_TABS
3397
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
154 /* #### Maybe use "-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1" here?
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
155 or XtDefaultFont? */
4528
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
156 res (XtNfcFontName, XtCFcFontName, XtRString, String,
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
157 fcFontName, XtRString, NULL),
3397
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
158 /* #### This needs to be fixed to give a proper type and converter for
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
159 XftFonts. See also xlwmenu.c. */
4528
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
160 res (XtNxftFont, XtCXftFont, XtRString, String,
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
161 xftFontName, XtRString, "Helvetica-12"),
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
162 #endif
4528
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
163 res (XtNinternalWidth, XtCWidth, XtRDimension, Dimension,
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
164 internalWidth, XtRImmediate, 4),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
165 res (XtNinternalHeight, XtCHeight, XtRDimension, Dimension,
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
166 internalHeight, XtRImmediate, 4),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
167 Xt_RESOURCE (XtNborderWidth, XtCBorderWidth, XtRDimension, Dimension,
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
168 XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate, 0),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
169 res (XtNtopWidget, XtCTopWidget, XtRWidget, Widget,
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
170 topWidget, XtRImmediate, NULL),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
171 res (XtNcallback, XtCCallback, XtRCallback, XtPointer,
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
172 callbacks, XtRCallback, NULL),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
173 res (XtNpopdownCallback, XtCCallback, XtRCallback, XtPointer,
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
174 popdownCallbacks, XtRCallback, NULL),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
175 res (XtNbeNiceToColormap, XtCBeNiceToColormap, XtRBoolean, Boolean,
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
176 be_nice_to_cmap, XtRImmediate, True),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
177 res (XtNtopShadowContrast, XtCTopShadowContrast, XtRInt, int,
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
178 top_shadow_contrast, XtRImmediate, 20),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
179 res (XtNbottomShadowContrast, XtCBottomShadowContrast, XtRInt, int,
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
180 bot_shadow_contrast, XtRImmediate, 40),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
181 res (XtNinsensitiveContrast, XtCInsensitiveContrast, XtRInt, int,
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
182 insensitive_contrast, XtRImmediate, 33),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
183 Xt_RESOURCE (XtNaccelerators, XtCAccelerators, XtRAcceleratorTable,
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
184 XtTranslations, XtOffsetOf(TabsRec,core.accelerators),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
185 XtRString, accelTable),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
186 #undef offset
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
187 #undef res
4522
fc7067b7f407 Backout last patch; forgot to specify file.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4521
diff changeset
188 };
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 /* constraint resources */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192
4528
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
193 static XtResource tabsConstraintResources[] = {
4522
fc7067b7f407 Backout last patch; forgot to specify file.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4521
diff changeset
194 #define offset(field) XtOffsetOf(TabsConstraintsRec, tabs.field)
4528
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
195 #define res(name,_class,intrepr,type,member,extrepr,value) \
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
196 Xt_RESOURCE (name, _class, intrepr, type, offset(member), extrepr, value)
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
197 res (XtNtabLabel, XtCLabel, XtRString, String, label, XtRString, NULL),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
198 res (XtNtabLeftBitmap, XtCLeftBitmap, XtRBitmap, Pixmap, left_bitmap,
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
199 XtRImmediate, None),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
200 res (XtNtabForeground, XtCForeground, XtRPixel, Pixel, foreground,
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
201 XtRString, XtDefaultForeground),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
202 res (XtNresizable, XtCResizable, XtRBoolean, Boolean, resizable,
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
203 XtRImmediate, True),
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
204 #undef offset
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
205 #undef res
4522
fc7067b7f407 Backout last patch; forgot to specify file.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4521
diff changeset
206 } ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 #if !NeedFunctionPrototypes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 /* FORWARD REFERENCES: */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 /* member functions */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 static void TabsClassInit();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 static void TabsInit();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 static void TabsResize();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 static void TabsExpose();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 static void TabsDestroy();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 static void TabsRealize();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 static Boolean TabsSetValues();
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
224 static Boolean TabsAcceptFocus();
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 static XtGeometryResult TabsQueryGeometry();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 static XtGeometryResult TabsGeometryManager();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 static void TabsChangeManaged();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 static void TabsConstraintInitialize() ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 static Boolean TabsConstraintSetValues() ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 /* action procs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 static void TabsSelect() ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 static void TabsPage() ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 static void TabsHighlight() ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 static void TabsUnhighlight() ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 /* internal privates */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 static void TabsAllocGCs() ; /* get rendering GCs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 static void TabsFreeGCs() ; /* return rendering GCs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 static void DrawTabs() ; /* draw all tabs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 static void DrawTab() ; /* draw one index tab */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 static void DrawFrame() ; /* draw frame around contents */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 static void DrawTrim() ; /* draw trim around a tab */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 static void DrawBorder() ; /* draw border */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 static void DrawHighlight() ; /* draw highlight */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 static void UndrawTab() ; /* undraw interior of a tab */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 static void TabWidth() ; /* recompute tab size */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 static void GetPreferredSizes() ; /* query all children for their sizes */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 static void MaxChild() ; /* find max preferred child size */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 static int PreferredSize() ; /* compute preferred size */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 static int PreferredSize2() ; /* compute preferred size */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 static int PreferredSize3() ; /* compute preferred size */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 static void MakeSizeRequest() ; /* try to change size */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 static void getBitmapInfo() ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 static int TabLayout() ; /* lay out tabs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 static void TabsShuffleRows() ; /* bring current tab to bottom row */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 static void TabsAllocFgGC() ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 static void TabsAllocGreyGC() ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 static void TabsClassInit(void) ;
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
266 static void TabsInit( Widget req, Widget new_, ArgList, Cardinal *nargs) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 static void TabsConstraintInitialize(Widget, Widget, ArgList, Cardinal *) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 static void TabsRealize(Widget, Mask *, XSetWindowAttributes *) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 static void TabsDestroy( Widget w) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 static void TabsResize( Widget w) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 static void TabsExpose( Widget w, XEvent *event, Region region) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 static Boolean TabsSetValues(Widget, Widget, Widget, ArgList, Cardinal *) ;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
273 static Boolean TabsAcceptFocus(Widget, Time *);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 static Boolean TabsConstraintSetValues(Widget, Widget, Widget,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 ArgList, Cardinal *) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 static XtGeometryResult TabsQueryGeometry(Widget,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 XtWidgetGeometry *, XtWidgetGeometry *) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 static XtGeometryResult TabsGeometryManager(Widget,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 XtWidgetGeometry *, XtWidgetGeometry *) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 static void TabsChangeManaged( Widget w) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 static void TabsSelect(Widget, XEvent *, String *, Cardinal *) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 static void TabsPage(Widget, XEvent *, String *, Cardinal *) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 static void TabsHighlight(Widget, XEvent *, String *, Cardinal *) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 static void TabsUnhighlight(Widget, XEvent *, String *, Cardinal *) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 static void DrawTabs( TabsWidget tw, Bool labels) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 static void DrawTab( TabsWidget tw, Widget child, Bool labels) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 static void DrawFrame( TabsWidget tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 static void DrawTrim( TabsWidget, int x, int y,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 int wid, int hgt, Bool bottom, Bool undraw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 static void DrawBorder( TabsWidget tw, Widget child, Bool undraw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 static void DrawHighlight( TabsWidget tw, Widget child, Bool undraw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 static void UndrawTab( TabsWidget tw, Widget child) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 static void TabWidth( Widget w) ;
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
297 static int TabLayout( TabsWidget, Dimension wid, Dimension hgt, Dimension *r_hgt,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 Bool query_only) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 static void GetPreferredSizes(TabsWidget) ;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
300 static void MaxChild(TabsWidget, Widget except, Dimension, Dimension) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 static void TabsShuffleRows( TabsWidget tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 static int PreferredSize( TabsWidget,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 Dimension *reply_width, Dimension *reply_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 Dimension *reply_cw, Dimension *reply_ch) ;
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
305 static int PreferredSize2( TabsWidget, Dimension cw, Dimension ch,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 Dimension *rw, Dimension *rh) ;
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
307 static int PreferredSize3( TabsWidget, Dimension wid, Dimension hgt,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 Dimension *rw, Dimension *rh) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 static void MakeSizeRequest(TabsWidget) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 static void TabsAllocGCs(TabsWidget) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 static void TabsFreeGCs(TabsWidget) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 static void getBitmapInfo( TabsWidget tw, TabsConstraints tab) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 static void TabsAllocFgGC( TabsWidget tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 static void TabsAllocGreyGC( TabsWidget tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 #define AddRect(i,xx,yy,w,h) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 do{rects[(i)].x=(xx); rects[i].y=(yy); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 rects[i].width=(w); rects[i].height=(h);}while(0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 static XtActionsRec actionsList[] =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 {
4528
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
325 { (String) "select", TabsSelect },
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
326 { (String) "page", TabsPage },
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
327 { (String) "highlight", TabsHighlight },
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
328 { (String) "unhighlight", TabsUnhighlight },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 } ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 /****************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 * Full class record constant
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 ****************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 #ifndef NEED_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 #define SuperClass (&constraintClassRec)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 #define SuperClass (&xmManagerClassRec)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 TabsClassRec tabsClassRec = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 /* core_class fields */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 /* superclass */ (WidgetClass) SuperClass,
4528
726060ee587c First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4522
diff changeset
348 /* class_name */ (String) "Tabs",
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 /* widget_size */ sizeof(TabsRec),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 /* class_initialize */ TabsClassInit,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 /* class_part_init */ NULL, /* TODO? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 /* class_inited */ FALSE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 /* initialize */ TabsInit,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 /* initialize_hook */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 /* realize */ TabsRealize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 /* actions */ actionsList,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 /* num_actions */ XtNumber(actionsList),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 /* resources */ resources,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 /* num_resources */ XtNumber(resources),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 /* xrm_class */ NULLQUARK,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 /* compress_motion */ TRUE,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
362 #if XtSpecificationRelease < 6
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
363 /* compress_exposure */ XtExposeCompressMaximal,
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
364 #else
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
365 /* compress_exposure */ XtExposeCompressMaximal|XtExposeNoRegion,
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
366 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 /* compress_enterleave*/ TRUE,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
368 /* visible_interest */ TRUE,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 /* destroy */ TabsDestroy,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 /* resize */ TabsResize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 /* expose */ TabsExpose,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 /* set_values */ TabsSetValues,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 /* set_values_hook */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 /* set_values_almost */ XtInheritSetValuesAlmost,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 /* get_values_hook */ NULL,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
376 /* accept_focus */ TabsAcceptFocus,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 /* version */ XtVersion,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 /* callback_private */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 /* tm_table */ defaultTranslations,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 /* query_geometry */ TabsQueryGeometry,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 /* display_accelerator*/ XtInheritDisplayAccelerator,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 /* extension */ NULL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 /* composite_class fields */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 /* geometry_manager */ TabsGeometryManager,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 /* change_managed */ TabsChangeManaged,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 /* insert_child */ XtInheritInsertChild, /* TODO? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 /* delete_child */ XtInheritDeleteChild, /* TODO? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 /* extension */ NULL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 /* constraint_class fields */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 /* subresources */ tabsConstraintResources,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 /* subresource_count */ XtNumber(tabsConstraintResources),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 /* constraint_size */ sizeof(TabsConstraintsRec),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 /* initialize */ TabsConstraintInitialize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 /* destroy */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 /* set_values */ TabsConstraintSetValues,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 /* extension */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 #ifdef NEED_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 /* Manager Class fields */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 /* translations */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 /* syn_resources */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 /* num_syn_resources */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 /* syn_constraint_resources */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 /* num_syn_constraint_resources */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 /* parent_process */ XmInheritParentProcess,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 /* extension */ NULL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 /* Tabs class fields */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 /* extension */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 WidgetClass tabsWidgetClass = (WidgetClass)&tabsClassRec;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
422 #define TabsNumChildren(tw) (((TabsWidget)tw)->composite.num_children)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
423 #define TabVisible(tab) \
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
424 (XtIsManaged(tab) && \
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
425 ((TabsConstraints)((tab)->core.constraints))->tabs.visible)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
428
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
429 static int debug_tabs = 0; /* increase for more verbosity */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
430
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
431 #ifdef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
432 /* #### duplicated from xlwmenu.c -- CLEAN THIS SHIT UP!
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
433 Undeclared so define at top. */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
434 #define MINL(x,y) ((((unsigned long) (x)) < ((unsigned long) (y))) \
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
435 ? ((unsigned long) (x)) : ((unsigned long) (y)))
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
436
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
437 static int
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
438 x_xft_text_width (Display *dpy, XftFont *xft_font, FcChar8 *run, int len)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
439 {
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
440 static XGlyphInfo glyphinfo; /* #### static? */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
441
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
442 XftTextExtents8 (dpy,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
443 xft_font,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
444 run, len, &glyphinfo);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
445 return glyphinfo.xOff;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
446 }
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
447 #endif
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
448
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 /****************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 * Member Procedures
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 ****************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 TabsClassInit(void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 defaultAccelerators = XtParseAcceleratorTable(accelTable) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 /* TODO: register converter for labels? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 /* Init a newly created tabs widget. Compute height of tabs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 * and optionally compute size of widget. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 /* ARGSUSED */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 static void
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
470 TabsInit(Widget request, Widget new_, ArgList UNUSED (args),
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 647
diff changeset
471 Cardinal *UNUSED (num_args))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 {
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
473 TabsWidget newTw = (TabsWidget)new_;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 newTw->tabs.numRows = 0 ;
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
476 newTw->tabs.realRows = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 GetPreferredSizes(newTw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 /* height is easy, it's the same for all tabs:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 * TODO: font height + height of tallest bitmap.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 newTw->tabs.tab_height = 2 * newTw->tabs.internalHeight + SHADWID ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
485 #ifdef HAVE_XFT_TABS
3685
382b11fa8866 [xemacs-hg @ 2006-11-17 02:50:22 by stephent]
stephent
parents: 3397
diff changeset
486 /* #### kludge for name change */
382b11fa8866 [xemacs-hg @ 2006-11-17 02:50:22 by stephent]
stephent
parents: 3397
diff changeset
487 if (!newTw->tabs.fcFontName)
382b11fa8866 [xemacs-hg @ 2006-11-17 02:50:22 by stephent]
stephent
parents: 3397
diff changeset
488 newTw->tabs.fcFontName = newTw->tabs.xftFontName;
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
489 /* must get font here
3685
382b11fa8866 [xemacs-hg @ 2006-11-17 02:50:22 by stephent]
stephent
parents: 3397
diff changeset
490 #### to do this right, we should add a new Xt Resource type +
382b11fa8866 [xemacs-hg @ 2006-11-17 02:50:22 by stephent]
stephent
parents: 3397
diff changeset
491 conversion function */
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
492 newTw->tabs.renderFont =
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
493 xft_open_font_by_name (XtDisplay ((Widget) newTw),
3397
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
494 newTw->tabs.fcFontName);
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
495 if (newTw->tabs.renderFont != NULL)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
496 #if XFT_USE_HEIGHT_NOT_ASCENT_DESCENT
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
497 newTw->tabs.tab_height += newTw->tabs.renderFont->height;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
498 #else
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
499 newTw->tabs.tab_height += newTw->tabs.renderFont->ascent +
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
500 newTw->tabs.renderFont->descent;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
501 #endif /* XFT_USE_HEIGHT_NOT_ASCENT_DESCENT */
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
502 #else /* ! HAVE_XFT_TABS */
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
503 if (newTw->tabs.font != NULL)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 newTw->tabs.tab_height += newTw->tabs.font->max_bounds.ascent +
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
505 newTw->tabs.font->max_bounds.descent;
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
506 #endif /* ! HAVE_XFT_TABS */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 /* if size not explicitly set, set it to our preferred size now. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 if( request->core.width == 0 || request->core.height == 0 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 Dimension w,h ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 PreferredSize(newTw, &w, &h, NULL,NULL) ;
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
514 if( request->core.width == 0 ) new_->core.width = w ;
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
515 if( request->core.height == 0 ) new_->core.height = h ;
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
516 XtClass(new_)->core_class.resize(new_) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 /* defer GC allocation, etc., until Realize() time. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 newTw->tabs.foregroundGC =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 newTw->tabs.backgroundGC =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 newTw->tabs.greyGC =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 newTw->tabs.topGC =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 newTw->tabs.botGC = None ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 newTw->tabs.grey50 = None ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 newTw->tabs.needs_layout = False ;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
529
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 newTw->tabs.hilight = NULL ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 #ifdef NEED_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 newTw->manager.navigation_type = XmTAB_GROUP ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 newTw->manager.traversal_on = True ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 /* Init the constraint part of a new tab child. Compute the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 * size of the tab.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 /* ARGSUSED */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 static void
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
544 TabsConstraintInitialize(Widget UNUSED (request), Widget new_,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 647
diff changeset
545 ArgList UNUSED (args), Cardinal *UNUSED (num_args))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 {
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
547 TabsConstraints tab = (TabsConstraints) new_->core.constraints ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 tab->tabs.greyAlloc = False ; /* defer allocation of pixel */
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
549 tab->tabs.visible = False ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
551 getBitmapInfo((TabsWidget)XtParent(new_), tab) ;
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
552 TabWidth(new_) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 /* Called when tabs widget first realized. Create the window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 * and allocate the GCs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 TabsRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 TabsWidget tw = (TabsWidget) w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 attributes->bit_gravity = NorthWestGravity;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 *valueMask |= CWBitGravity;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569 SuperClass->core_class.realize(w, valueMask, attributes);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571 TabsAllocGCs(tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 TabsDestroy(Widget w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 {
4173
03f6627a2e09 [xemacs-hg @ 2007-09-18 02:55:29 by james]
james
parents: 3685
diff changeset
579 TabsWidget tw = (TabsWidget) w;
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
580 #ifdef HAVE_XFT_TABS
4173
03f6627a2e09 [xemacs-hg @ 2007-09-18 02:55:29 by james]
james
parents: 3685
diff changeset
581 XftFontClose (XtDisplay (w), tw->tabs.renderFont);
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
582 #endif /* ! HAVE_XFT_TABS */
4173
03f6627a2e09 [xemacs-hg @ 2007-09-18 02:55:29 by james]
james
parents: 3685
diff changeset
583 TabsFreeGCs (tw) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587 /* Parent has resized us. This will require that the tabs be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 * laid out again.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 TabsResize(Widget w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 TabsWidget tw = (TabsWidget) w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 int i ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 int num_children = tw->composite.num_children ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 Widget *childP ;
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 647
diff changeset
598 /* TabsConstraints tab ; */ /* #### unused */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 Dimension cw,ch,bw ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 /* Our size has now been dictated by the parent. Lay out the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 * tabs, lay out the frame, lay out the children. Remember
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 * that the tabs overlap each other and the frame by shadowWidth.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 * Also, the top tab is larger than the others, so if there's only
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 * one row, the widget must be made taller to accommodate this.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 * Once the tabs are laid out, if there is more than one
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 * row, we may need to shuffle the rows to bring the top tab
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 * to the bottom row.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
612 tw->tabs.needs_layout = False ;
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
613
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 if( num_children > 0 && tw->composite.children != NULL )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 /* Loop through the tabs and assign rows & x positions */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 (void) TabLayout(tw, tw->core.width, tw->core.height, NULL, False) ;
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
618 num_children = TabsNumChildren (tw);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 /* assign a top widget, bring it to bottom row. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 TabsShuffleRows(tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623 /* now assign child positions & sizes. Positions are all the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 * same: just inside the frame. Sizes are also all the same.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627 tw->tabs.child_width = cw = tw->core.width - 2 * SHADWID ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 tw->tabs.child_height = ch =
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
629 tw->core.height < (tw->tabs.tab_total + 2 * SHADWID) ? 0 :
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
630 tw->core.height - tw->tabs.tab_total - 2 * SHADWID ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 for(i=0, childP=tw->composite.children;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
633 i < num_children;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 ++i, ++childP)
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
635 if( XtIsManaged(*childP) )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636 {
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 647
diff changeset
637 /* tab = (TabsConstraints) (*childP)->core.constraints ; */
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
638 bw = (*childP)->core.border_width ;
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
639 /* Don't do anything if we can't see any of the child. */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
640 if (ch >= bw*2 && ch > 0 && cw >= bw*2 && cw > 0)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
641 XtConfigureWidget(*childP, SHADWID,tw->tabs.tab_total+SHADWID,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
642 cw-bw*2,ch-bw*2, bw) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
644 if( XtIsRealized(w) ) {
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
645 XClearWindow(XtDisplay((Widget)tw), XtWindow((Widget)tw)) ;
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
646 /* should not be necessary to explicitly repaint after a
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
647 * resize, but XEmacs folks tell me it is.
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
648 */
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
649 XtClass(tw)->core_class.expose((Widget)tw,NULL,None) ;
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
650 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652 } /* Resize */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
656 /* Redraw entire Tabs widget */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
658 /* ARGSUSED */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 647
diff changeset
660 TabsExpose(Widget w, XEvent *UNUSED (event), Region UNUSED (region))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662 TabsWidget tw = (TabsWidget) w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664 if( tw->tabs.needs_layout )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 XtClass(w)->core_class.resize(w) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667 DrawTabs(tw, True) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
668 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671 /* Called when any Tabs widget resources are changed. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 /* ARGSUSED */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674 static Boolean
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
675 TabsSetValues(Widget current, Widget UNUSED (request), Widget new_,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 647
diff changeset
676 ArgList UNUSED (args), Cardinal *UNUSED (num_args))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
677 {
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
678 TabsWidget curtw = (TabsWidget) current ;
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
679 TabsWidget tw = (TabsWidget) new_ ;
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
680 Boolean needRedraw = False ;
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
681 Widget *childP ;
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
682 int i ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
684 if(
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
685 #ifdef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
686 tw->tabs.renderFont != curtw->tabs.renderFont ||
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
687 #else
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
688 tw->tabs.font != curtw->tabs.font ||
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
689 #endif
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
690 tw->tabs.internalWidth != curtw->tabs.internalWidth ||
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
691 tw->tabs.internalHeight != curtw->tabs.internalHeight)
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
692 {
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
693 tw->tabs.tab_height = 2 * tw->tabs.internalHeight + SHADWID;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
694
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
695 #ifdef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
696 if (tw->tabs.renderFont != NULL)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
697 #if XFT_USE_HEIGHT_NOT_ASCENT_DESCENT
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
698 tw->tabs.tab_height += tw->tabs.renderFont->height;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
699 #else
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
700 tw->tabs.tab_height += tw->tabs.renderFont->ascent +
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
701 tw->tabs.renderFont->descent;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
702 #endif /* XFT_USE_HEIGHT_NOT_ASCENT_DESCENT */
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
703 #else /* ! HAVE_XFT_TABS */
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
704 if (tw->tabs.font != NULL)
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
705 tw->tabs.tab_height += tw->tabs.font->max_bounds.ascent +
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
706 tw->tabs.font->max_bounds.descent;
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
707 #endif /* ! HAVE_XFT_TABS */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
708
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
709 /* Tab size has changed. Resize all tabs and request a new size */
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
710 for(i=0, childP=tw->composite.children;
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 448
diff changeset
711 i < (int) tw->composite.num_children;
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
712 ++i, ++childP)
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
713 if( XtIsManaged(*childP) )
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
714 TabWidth(*childP) ;
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
715 PreferredSize(tw, &tw->core.width, &tw->core.height, NULL,NULL) ;
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
716 needRedraw = True ;
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
717 tw->tabs.needs_layout = True ;
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
718 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
719
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
720 /* TODO: if any color changes, need to recompute GCs and redraw */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
721
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
722 if( tw->core.background_pixel != curtw->core.background_pixel ||
432
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 430
diff changeset
723 tw->core.background_pixmap != curtw->core.background_pixmap ||
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
724 #ifdef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
725 tw->tabs.renderFont != curtw->tabs.renderFont
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
726 #else
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
727 tw->tabs.font != curtw->tabs.font
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
728 #endif
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
729 )
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
730 if( XtIsRealized(new_) )
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
731 {
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
732 TabsFreeGCs(tw) ;
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
733 TabsAllocGCs(tw) ;
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
734 needRedraw = True ;
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
735 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
737 if( tw->core.sensitive != curtw->core.sensitive )
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
738 needRedraw = True ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
739
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
740 /* If top widget changes, need to change stacking order, redraw tabs.
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
741 * Window system will handle the redraws.
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
742 */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
744 if( tw->tabs.topWidget != curtw->tabs.topWidget )
432
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 430
diff changeset
745 {
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
746 if( XtIsRealized(tw->tabs.topWidget) )
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
747 {
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
748 Widget w = tw->tabs.topWidget ;
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
749 TabsConstraints tab = (TabsConstraints) w->core.constraints ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
750
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
751 XRaiseWindow(XtDisplay(w), XtWindow(w)) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
752 #ifdef NEED_MOTIF
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
753 XtVaSetValues(curtw->tabs.topWidget, XmNtraversalOn, False, 0) ;
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
754 XtVaSetValues(w, XmNtraversalOn, True, 0) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
755 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
756
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 448
diff changeset
757 if( tab->tabs.row != (int) tw->tabs.numRows-1 )
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
758 TabsShuffleRows(tw) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
759
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
760 needRedraw = True ;
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
761 }
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
762 else
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
763 tw->tabs.needs_layout = True ;
432
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 430
diff changeset
764 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
765
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
766 return needRedraw ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
767 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
768
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
769
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
770 /* Called when any child constraint resources change. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
771
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
772 /* ARGSUSED */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
773 static Boolean
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
774 TabsConstraintSetValues(Widget current, Widget UNUSED (request), Widget new_,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 647
diff changeset
775 ArgList UNUSED (args), Cardinal *UNUSED (num_args))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
776 {
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
777 TabsWidget tw = (TabsWidget) XtParent(new_) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
778 TabsConstraints ctab = (TabsConstraints) current->core.constraints ;
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
779 TabsConstraints tab = (TabsConstraints) new_->core.constraints ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
780
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
782 /* if label changes, need to re-layout the entire widget */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
783 /* if foreground changes, need to redraw tab label */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
784
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
785 /* TODO: only need resize of new bitmap has different dimensions
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
786 * from old bitmap.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
787 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
788
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
789 if( tab->tabs.label != ctab->tabs.label || /* Tab size has changed. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
790 tab->tabs.left_bitmap != ctab->tabs.left_bitmap )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
791 {
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
792 TabWidth(new_) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
793 tw->tabs.needs_layout = True ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
795 if( tab->tabs.left_bitmap != ctab->tabs.left_bitmap )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
796 getBitmapInfo(tw, tab) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
797
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
798 /* If there are no subclass ConstraintSetValues procedures remaining
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
799 * to be invoked, and if the preferred size has changed, ask
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
800 * for a resize.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
801 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
802 if( XtClass((Widget)tw) == tabsWidgetClass )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
803 MakeSizeRequest(tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
804 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
805
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
806
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
807 /* The child widget itself never needs a redisplay, but the parent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
808 * Tabs widget might.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
809 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
811 if( XtIsRealized(new_) )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
812 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
813 if( tw->tabs.needs_layout ) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
814 XClearWindow(XtDisplay((Widget)tw), XtWindow((Widget)tw)) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
815 XtClass(tw)->core_class.expose((Widget)tw,NULL,None) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
816 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
817
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
818 else if( tab->tabs.foreground != ctab->tabs.foreground )
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2286
diff changeset
819 DrawTab(tw, new_, True) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
820 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
821
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
822 return False ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
824
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
825
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
826 static Boolean
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 647
diff changeset
827 TabsAcceptFocus(Widget w, Time *UNUSED (t))
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
828 {
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
829 if( !w->core.being_destroyed && XtIsRealized(w) &&
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
830 XtIsSensitive(w) && XtIsManaged(w) && w->core.visible )
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
831 {
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
832 Widget p ;
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
833 for(p = XtParent(w); !XtIsShell(p); p = XtParent(p)) ;
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
834 XtSetKeyboardFocus(p,w) ;
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
835 return True ;
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
836 }
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
837 else
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
838 return False ;
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
839 }
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
840
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
841
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
842
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
843 /*
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
844 * Return status, with preferred size in PREFERRED.
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
845 *
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
846 * According to the X Toolkit Intrinsics manual
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
847 * XtGeometryYes = accept INTENDED without change
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
848 * XtGeometryNo = request to stay _exactly_ the same
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
849 * XtGeometryAlmost = suggest PREFERRED as a compromise
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
850 * and the PREFERRED argument must be filled in completely (ie, any fields
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
851 * whose bits are set in the request_mode mask must correspond to the
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
852 * preferred geometry, which must be consistent with the return value).
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
853 *
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
854 * Assuming horizontal orientation, in XEmacs, we should always accept if
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
855 * the width is more than we need. There's no problem if there are only a
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
856 * couple of tabs packed to the left. OTOH there's probably something wrong
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
857 * if we're offered a height more than 1.5x or 2x the preferred height.
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
858 * (#### Do tab controls do vertical?)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
859 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
860
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
861 /* compute the height above which we complain */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
862 #define TAB_HEIGHT_TOLERANCE(x) (2*x)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
863
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
864 static XtGeometryResult
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
865 TabsQueryGeometry (Widget w,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
866 XtWidgetGeometry *intended,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
867 XtWidgetGeometry *preferred) /* RETURN */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868 {
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
869 TabsWidget tw = (TabsWidget) w;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
870 XtGeometryMask mode = intended->request_mode;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
871
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
872 preferred->request_mode = CWWidth | CWHeight;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
873 PreferredSize (tw, &preferred->width, &preferred->height, NULL, NULL);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
875 /* If width is big enough, accept it. */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
876 if ((mode & CWWidth) && intended->width >= preferred->width)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
877 preferred->width = intended->width;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
878
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
879 /* If height is within range, accept it.
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
880 #### If too tall, we could offer a compromise at TAB_HEIGHT_TOLERANCE.
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
881 Should we? */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
882 if ((mode & CWHeight) && intended->height >= preferred->height
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
883 && intended->height <= TAB_HEIGHT_TOLERANCE (preferred->height))
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
884 preferred->height = intended->height;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
885
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
886 /* Compute return value. */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
887 if (preferred->width == ((mode & CWWidth) ? intended->width
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
888 : w->core.width)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
889 && preferred->height == ((mode & CWHeight) ? intended->height
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
890 : w->core.height))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
891 return XtGeometryYes;
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
892 else if (preferred->width == w->core.width
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
893 && preferred->height == w->core.height)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
894 return XtGeometryNo;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
895 else
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
896 return XtGeometryAlmost;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
897 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
898
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
899
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
900
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
901 /*
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
902 * Geometry Manager; called when TAB (a child) wants to be resized.
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
903 *
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
904 * According to the X Toolkit Intrinsics manual
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
905 * XtGeometryDone = accept REQUEST and do it (#### check this)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
906 * XtGeometryYes = accept REQUEST without change
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
907 * XtGeometryNo = refuse REQUEST (ie, stay _exactly_ the same)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
908 * XtGeometryAlmost = suggest REPLY as a compromise
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
909 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
910
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
911 static XtGeometryResult
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
912 TabsGeometryManager (Widget tab,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
913 XtWidgetGeometry *request,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
914 XtWidgetGeometry *reply) /* RETURN */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915 {
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
916 TabsWidget control = (TabsWidget) XtParent(tab);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
917 Dimension s = SHADWID;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
918 TabsConstraints constraint = (TabsConstraints) tab->core.constraints;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
919 XtGeometryResult result, best_offer = XtGeometryYes;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
920 Dimension rw, rh;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
921
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
922 static int debug_count = 0;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
923 static int debug_mask = 1;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
924
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
925 /* Position request cannot be satisfied, so if tabs are not resizable,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
926 no nontrivial request can be satisfied: return XGeometryNo. */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
927 if (!constraint->tabs.resizable)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
928 return XtGeometryNo;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
929
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
930 fprintf (stderr, "Urk! label is resizable!\n");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
931
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
932 /* Assume we will refuse these; toggle iff we accept them.
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
933 Reply won't specify any fields not in the request. */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
934 reply->request_mode = request->request_mode;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
935 reply->x = tab->core.x;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
936 reply->y = tab->core.y;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
937
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
938 /* If a position request would result in a change, best offer is
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
939 XtGeometryAlmost. Otherwise toggle reply->request_mode. */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
940 if ((request->request_mode & CWX) && request->x != tab->core.x)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
941 best_offer = XtGeometryAlmost;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
942 else
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
943 reply->request_mode &= ~CWX;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
944 if ((request->request_mode & CWY) && request->y != tab->core.y)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
945 best_offer = XtGeometryAlmost;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
946 else
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
947 reply->request_mode &= ~CWY;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
948
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
949 /* Make all three fields in the reply valid */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
950 reply->width = (request->request_mode & CWWidth)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
951 ? request->width : tab->core.width;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
952 reply->height = (request->request_mode & CWHeight)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
953 ? request->height : tab->core.height;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
954 reply->border_width = (request->request_mode & CWBorderWidth)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
955 ? request->border_width : tab->core.border_width;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
956
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
957 /* check if we can already offer a compromise */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
958 if (best_offer == XtGeometryAlmost &&
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
959 reply->width == tab->core.width &&
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
960 reply->height == tab->core.height &&
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
961 reply->border_width == tab->core.border_width)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
962 {
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
963 reply->request_mode &= ~(CWWidth | CWHeight | CWBorderWidth);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
964 return best_offer;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
965 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
966
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
967 #ifndef DONT_DEBUG_REQUESTS
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
968 #define DBG_REQUEST_PRINT(name,field,size) \
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
969 do { \
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
970 if (reply->field > size) \
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
971 { \
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
972 if (++debug_count == debug_mask) \
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
973 { \
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
974 debug_mask <<= 1; \
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
975 fprintf (stderr, "ridiculous %s request #%d: %d > %d\n", \
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
976 name, debug_count, reply->field, size); \
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
977 } \
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
978 reply->field = tab->core.field; \
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
979 } \
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
980 } while (0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
981
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
982 DBG_REQUEST_PRINT ("width",width,1024);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
983 DBG_REQUEST_PRINT ("height",height,768);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
984 DBG_REQUEST_PRINT ("border_width",border_width,30);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
985 #undef DBG_REQUEST_PRINT
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
986 #endif
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
987
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
988 rw = reply->width + 2 * reply->border_width;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
989 rh = reply->height + 2 * reply->border_width;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
990
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
991 /* find out how big the children want to be now */
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
992 MaxChild (control, tab, rw, rh);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
993
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
994
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
995 /* Size changes must see if the new size can be accommodated.
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
996 * The Tabs widget keeps all of its children the same height, but
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
997 * widths may vary.
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
998 * A request to shrink will be accepted only if the
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
999 * new size is still big enough for all other children. A
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1000 * request to shrink that is not big enough for all children
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1001 * returns an "almost" response with the new proposed size
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1002 * or a "no" response if unable to shrink at all.
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1003 *
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1004 * A request to grow will be accepted only if the Tabs control can
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1005 * grow to accommodate.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1006 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1007 * TODO:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1008 * We could get fancy here and re-arrange the tabs if it is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1009 * necessary to compromise with the parent, but we'll save that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1010 * for another day.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1011 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1012
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1013 if (request->request_mode & (CWWidth | CWHeight | CWBorderWidth))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1014 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1015 Dimension cw,ch ; /* children's preferred size */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1016 Dimension aw,ah ; /* available size we can give child */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1017 Dimension th ; /* space used by tabs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1018 Dimension wid,hgt ; /* Tabs widget size */
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1019 int check_nrows;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1020
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1021 cw = control->tabs.max_cw ;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1022 ch = control->tabs.max_ch ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1023
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1024 /* find out what *my* resulting preferred size would be */
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1025 /* #### this whole API is wrong; what should happen is
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1026 1. app should hint as to #rows and/or aspect ratio
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1027 2. tab control should attempt to layout in current space
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1028 3. if not all tabs fit, should request resize to achieve
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1029 layout hints
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1030 Probably can and should cache preferred size in widget, with
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1031 cache cleared when labels or core size changes. */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1032 PreferredSize2(control, cw, ch, &wid, &hgt) ;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1033
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1034 /* Would my size change? If so, ask to be resized. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1036 if (wid != control->core.width || hgt != control->core.height)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1037 {
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1038 Dimension oldWid = control->core.width,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1039 oldHgt = control->core.height;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1040 XtWidgetGeometry myrequest, myreply ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1041
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1042 myrequest.width = wid ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1043 myrequest.height = hgt ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1044 myrequest.request_mode = CWWidth | CWHeight ;
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1045
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1046 assert (wid > 0 && hgt > 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1047 /* If child is only querying, or if we're going to have to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1048 * offer the child a compromise, then make this a query only.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1049 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1050
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1051 if ((request->request_mode & XtCWQueryOnly) || rw < cw || rh < ch)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1052 myrequest.request_mode |= XtCWQueryOnly;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1054 result = XtMakeGeometryRequest ((Widget) control,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1055 &myrequest, &myreply);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1057 /* !$@# Athena Box widget changes the core size even if QueryOnly
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 * is set. I'm convinced this is a bug. At any rate, to work
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059 * around the bug, we need to restore the core size after every
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1060 * query geometry request. This is only partly effective,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061 * as there may be other boxes further up the tree.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1062 */
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1063 if (myrequest.request_mode & XtCWQueryOnly) {
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1064 control->core.width = oldWid;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1065 control->core.height = oldHgt;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1066 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1067
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1068 /* based on the parent's response, determine what the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1069 * resulting Tabs widget size would be.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1070 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1071
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1072 switch (result) {
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1073 case XtGeometryYes:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074 case XtGeometryDone:
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1075 control->tabs.needs_layout = True;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1076 break;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1078 case XtGeometryNo:
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1079 wid = control->core.width;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1080 hgt = control->core.height;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1081 break;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1082
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1083 case XtGeometryAlmost:
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1084 wid = myreply.width;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1085 hgt = myreply.height;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1086 control->tabs.needs_layout = True;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1087 break;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1088 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1089 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1090
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1091 /* Within the constraints imposed by the parent, what is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1092 * the max size we can give the child?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1093 */
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1094 check_nrows = TabLayout (control, wid, hgt, &th, True);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1095 aw = wid - 2*s;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1096 if (check_nrows == 1)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1097 {
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1098 ah = hgt - th - 2*s;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1099 }
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1100 else
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1101 {
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1102 /* this rarely gets triggered, but when it does it seems to
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1103 get triggered forever after */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1104 int n = control->composite.num_children;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1105 ah = control->tabs.tab_height;
3397
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
1106 if (debug_tabs > 1)
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1107 fprintf (stderr, "Kludging around %d != 1 rows,"
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1108 " #children = %d, total height %d, using %d.\n",
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1109 check_nrows, n, th, ah);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1110 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1111
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1112 /* OK, make our decision. If requested size is >= max sibling
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1113 * preferred size, AND requested size <= available size, then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1114 * we accept. Otherwise, we offer a compromise.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1115 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1116
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1117 if (rw == aw && rh == ah)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1118 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1119 /* Acceptable. If this wasn't a query, change *all* children
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1120 * to this size.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1121 */
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1122 if (request->request_mode & XtCWQueryOnly)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1123 {
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1124 control->tabs.needs_layout = False;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1125 return XtGeometryYes ;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1126 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1127 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1128 {
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1129 Widget *childP = control->composite.children;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1130 int i, bw;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1131 tab->core.border_width = request->border_width;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1132 for (i = TabsNumChildren (control); --i >= 0; ++childP)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1133 if (TabVisible (*childP))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1134 {
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1135 bw = (*childP)->core.border_width;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1136 XtConfigureWidget (*childP, s, control->tabs.tab_total+s,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1137 rw-2*bw, rh-2*bw, bw);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1138 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1139 #ifdef COMMENT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1140 /* TODO: under what conditions will we need to redraw? */
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1141 XClearWindow (XtDisplay ((Widget) control),
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1142 XtWindow ((Widget) control));
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1143 XtClass (control)->core_class.expose ((Widget)control,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1144 NULL, NULL);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1145 #endif /* COMMENT */
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1146 return XtGeometryDone;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1147 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1148 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1149
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1150 /* Cannot grant child's request. Describe what we *can* do
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1151 * and return counter-offer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1152 */
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1153 control->tabs.needs_layout = False;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1154 reply->width = aw - 2 * request->border_width ;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1155 reply->height = ah - 2 * request->border_width ;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1156 reply->request_mode &=
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1157 ~((reply->border_width == tab->core.border_width
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1158 ? CWBorderWidth : 0)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1159 |(reply->width == tab->core.width ? CWWidth : 0)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1160 |(reply->height == tab->core.height ? CWHeight : 0));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1161 return XtGeometryAlmost ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1162 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1163
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1164 return XtGeometryYes ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1165 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1166
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1167
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1168
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1169
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1170 /* The number of children we manage has changed; recompute
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1171 * size from scratch.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1172 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1173
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1174 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1175 TabsChangeManaged(Widget w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1176 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1177 TabsWidget tw = (TabsWidget)w ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1178 Widget *childP = tw->composite.children ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1179 int i ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1180
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1181 if( tw->tabs.topWidget != NULL &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1182 ( !XtIsManaged(tw->tabs.topWidget) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1183 tw->tabs.topWidget->core.being_destroyed ) )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1184 tw->tabs.topWidget = NULL ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1185
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 436
diff changeset
1186 /* Check whether the highlight tab is still valid. */
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 436
diff changeset
1187 if( tw->tabs.hilight != NULL &&
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 436
diff changeset
1188 ( !XtIsManaged(tw->tabs.hilight) ||
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 436
diff changeset
1189 tw->tabs.hilight->core.being_destroyed ) )
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 436
diff changeset
1190 tw->tabs.hilight = NULL ;
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 436
diff changeset
1191
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1192 GetPreferredSizes(tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1193 MakeSizeRequest(tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1194
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1195 XtClass(w)->core_class.resize(w) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1196 if( XtIsRealized(w) )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1197 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1198 Display *dpy = XtDisplay(w) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1199 XClearWindow(dpy, XtWindow(w)) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1200 XtClass(w)->core_class.expose(w,NULL,NULL) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1201
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1202 /* make sure the top widget stays on top. This requires
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1203 * making sure that all new children are realized first.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1204 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1205 if( tw->tabs.topWidget != NULL && XtIsRealized(tw->tabs.topWidget) )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1206 {
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1207 for(i=TabsNumChildren (tw); --i >= 0; ++childP)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1208 if( !XtIsRealized(*childP) )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1209 XtRealizeWidget(*childP) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1210
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1211 XRaiseWindow(dpy, XtWindow(tw->tabs.topWidget)) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1212 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1213 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1214
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1215 #ifdef NEED_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1216 /* Only top widget may receive input */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1217
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1218 for(childP = tw->composite.children, i=tw->composite.num_children;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1219 --i >= 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1220 ++childP)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1221 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1222 XtVaSetValues(*childP, XmNtraversalOn, False, 0) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1223 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1224
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1225 if( tw->tabs.topWidget != NULL )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1226 XtVaSetValues(tw->tabs.topWidget, XmNtraversalOn, True, 0) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1227 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1228 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1229
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1230
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1231
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1232
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1233 /****************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1234 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1235 * Action Procedures
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1236 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1237 ****************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1238
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1239
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1240 /* User clicks on a tab, figure out which one it was. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1241
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1242 /* ARGSUSED */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1243 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 647
diff changeset
1244 TabsSelect(Widget w, XEvent *event, String *UNUSED (params),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 647
diff changeset
1245 Cardinal *UNUSED (num_params))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1246 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1247 TabsWidget tw = (TabsWidget) w ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1248 Widget *childP ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1249 Position x,y ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1250 Dimension h = tw->tabs.tab_height ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1251 int i ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1252
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1253 #ifdef NEED_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1254 XmProcessTraversal (w, XmTRAVERSE_CURRENT) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1255 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1256
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1257 /* TODO: is there an Xmu function or something to do this instead? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1258 switch( event->type ) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1259 case ButtonPress:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1260 case ButtonRelease:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1261 x = event->xbutton.x ; y = event->xbutton.y ; break ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1262 case KeyPress:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1263 case KeyRelease:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1264 x = event->xkey.x ; y = event->xkey.y ; break ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1265 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1266 return ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1267 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1268
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1269 /* TODO: determine which tab was clicked, if any. Set that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1270 * widget to be top of stacking order with XawTabsSetTop().
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1271 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1272 for(i=0, childP=tw->composite.children;
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 448
diff changeset
1273 i < (int) TabsNumChildren (tw);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1274 ++i, ++childP)
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1275 if( TabVisible(*childP) )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1276 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1277 TabsConstraints tab = (TabsConstraints)(*childP)->core.constraints;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1278 if( x > tab->tabs.x && x < tab->tabs.x + tab->tabs.width &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1279 y > tab->tabs.y && y < tab->tabs.y + h )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1280 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1281 if( *childP != tw->tabs.topWidget &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1282 (XtIsSensitive(*childP) || tw->tabs.selectInsensitive) )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1283 XawTabsSetTop(*childP, True) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1284 break ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1285 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1286 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1287 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1288
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1289
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1290 /* User hits a key */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1291
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1292 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 647
diff changeset
1293 TabsPage(Widget w, XEvent *UNUSED (event), String *params,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 647
diff changeset
1294 Cardinal *num_params)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1295 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1296 TabsWidget tw = (TabsWidget) w ;
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
1297 Widget newtop = NULL;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1298 Widget *childP ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1299 int idx ;
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1300 int nc = TabsNumChildren (tw) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1301
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1302 if( nc <= 0 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1303 return ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1304
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1305 if( *num_params < 1 ) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1306 XtAppWarning(XtWidgetToApplicationContext(w),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1307 "Tabs: page() action called with no arguments") ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1308 return ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1309 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1310
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1311 if( tw->tabs.topWidget == NULL )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1312 tw->tabs.topWidget = tw->composite.children[0] ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1313
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1314 for(idx=0, childP=tw->composite.children; idx < nc; ++idx, ++childP )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1315 if( tw->tabs.topWidget == *childP )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1316 break ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1317
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1318 switch( params[0][0] ) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1319 case 'u': /* up */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1320 case 'U':
432
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 430
diff changeset
1321 if( --idx < 0 )
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 430
diff changeset
1322 idx = nc-1 ;
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 430
diff changeset
1323 newtop = tw->composite.children[idx] ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1324 break ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1325
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1326 case 'd': /* down */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1327 case 'D':
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1328 if( ++idx >= nc )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1329 idx = 0 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1330 newtop = tw->composite.children[idx] ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1331 break ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1332
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1333 case 'h':
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1334 case 'H':
432
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 430
diff changeset
1335 default:
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1336 newtop = tw->composite.children[0] ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1337 break ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1338
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1339 case 'e':
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1340 case 'E':
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1341 newtop = tw->composite.children[nc-1] ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1342 break ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1343
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1344 case 's': /* selected */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1345 case 'S':
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1346 if( (newtop = tw->tabs.hilight) == NULL )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1347 return ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1348 break ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1349 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1350
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1351 XawTabsSetTop(newtop, True) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1352 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1353
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1354
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1355 /* User hits up/down key */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1356
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1357 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 647
diff changeset
1358 TabsHighlight(Widget w, XEvent *UNUSED (event), String *params,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 647
diff changeset
1359 Cardinal *num_params)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1360 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1361 TabsWidget tw = (TabsWidget) w ;
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
1362 Widget newhl = NULL;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1363 Widget *childP ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1364 int idx ;
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1365 int nc = TabsNumChildren (tw) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1366
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1367 if( nc <= 0 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1368 return ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1369
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1370 if( *num_params < 1 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1371 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1372 if( tw->tabs.hilight != NULL )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1373 DrawHighlight(tw, tw->tabs.hilight, False) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1374 return ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1375 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1376
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1377 if( tw->tabs.hilight == NULL )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1378 newhl = tw->composite.children[0] ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1379
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1380 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1381 {
432
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 430
diff changeset
1382 /* find index of currently highlit child */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1383 for(idx=0, childP=tw->composite.children; idx < nc; ++idx, ++childP )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1384 if( tw->tabs.hilight == *childP )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1385 break ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1386
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1387 switch( params[0][0] ) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1388 case 'u': /* up */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1389 case 'U':
432
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 430
diff changeset
1390 if( --idx < 0 )
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 430
diff changeset
1391 idx = nc-1 ;
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 430
diff changeset
1392 newhl = tw->composite.children[idx] ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1393 break ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1394
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1395 case 'd': /* down */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1396 case 'D':
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1397 if( ++idx >= nc )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1398 idx = 0 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1399 newhl = tw->composite.children[idx] ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1400 break ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1401
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1402 case 'h':
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1403 case 'H':
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1404 newhl = tw->composite.children[0] ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1405 break ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1406
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1407 case 'e':
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1408 case 'E':
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1409 newhl = tw->composite.children[nc-1] ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1410 break ;
432
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 430
diff changeset
1411
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 430
diff changeset
1412 default:
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 430
diff changeset
1413 newhl = tw->tabs.hilight ;
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 430
diff changeset
1414 break ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1415 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1416 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1417
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1418 XawTabsSetHighlight(w, newhl) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1419 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1420
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1421
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1422
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1423 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 647
diff changeset
1424 TabsUnhighlight(Widget w, XEvent *UNUSED (event), String *UNUSED (params),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 647
diff changeset
1425 Cardinal *UNUSED (num_params))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1426 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1427 TabsWidget tw = (TabsWidget) w ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1428 int nc = tw->composite.num_children ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1429
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1430 if( nc <= 0 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1431 return ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1432
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1433 if( tw->tabs.hilight != NULL )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1434 DrawHighlight(tw, tw->tabs.hilight, True) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1435 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1436
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1437
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1438
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1439
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1440
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1441 /****************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1442 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1443 * Public Procedures
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1444 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1445 ****************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1446
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1447
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1448 /* Set the top tab, optionally call all callbacks. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1449 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1450 XawTabsSetTop(Widget w, Bool callCallbacks)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1451 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1452 TabsWidget tw = (TabsWidget)w->core.parent ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1453 TabsConstraints tab ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1454 Widget oldtop = tw->tabs.topWidget ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1455
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1456 if( !XtIsSubclass(w->core.parent, tabsWidgetClass) )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1457 {
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1458 char line[256] ;
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1459 sprintf(line, "XawTabsSetTop: widget \"%.64s\" is not the child of a tabs widget.", XtName(w)) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1460 XtAppWarning(XtWidgetToApplicationContext(w), line) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1461 return ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1462 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1463
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1464 if( callCallbacks )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1465 XtCallCallbackList(w, tw->tabs.popdownCallbacks,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1466 (XtPointer)tw->tabs.topWidget) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1467
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1468 if( !XtIsRealized(w) ) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1469 tw->tabs.topWidget = w ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1470 tw->tabs.needs_layout = True ;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 436
diff changeset
1471 tw->tabs.hilight = NULL; /* The highlight tab might disappear. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1472 return ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1473 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1474
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1475 XRaiseWindow(XtDisplay(w), XtWindow(w)) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1476 #ifdef NEED_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1477 XtVaSetValues(oldtop, XmNtraversalOn, False, 0) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1478 XtVaSetValues(w, XmNtraversalOn, True, 0) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1479 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1480
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1481 tab = (TabsConstraints) w->core.constraints ;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 436
diff changeset
1482
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 436
diff changeset
1483 /* Unhighlight before we start messing with the stacking order. */
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 436
diff changeset
1484 if( tw->tabs.hilight != NULL )
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 436
diff changeset
1485 {
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 436
diff changeset
1486 DrawHighlight(tw, tw->tabs.hilight, True) ;
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 436
diff changeset
1487 tw->tabs.hilight = NULL;
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 436
diff changeset
1488 }
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 436
diff changeset
1489
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1490 if( tab->tabs.row == 0 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1491 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1492 /* Easy case; undraw current top, undraw new top, assign new
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1493 * top, redraw all borders.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1494 * We *could* just erase and execute a full redraw, but I like to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1495 * reduce screen flicker.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1496 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1497 UndrawTab(tw, oldtop) ; /* undraw old */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1498 DrawBorder(tw, oldtop, True) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1499 UndrawTab(tw, w) ; /* undraw new */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1500 DrawBorder(tw, w, True) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1501 tw->tabs.topWidget = w ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1502 DrawTab(tw, oldtop, True) ; /* redraw old */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1503 DrawTab(tw, w, True) ; /* redraw new */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1504 DrawTabs(tw, False) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1505 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1506 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1507 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1508 tw->tabs.topWidget = w ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1509 TabsShuffleRows(tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1510 XClearWindow(XtDisplay((Widget)tw), XtWindow((Widget)tw)) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1511 XtClass(tw)->core_class.expose((Widget)tw,NULL,None) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1512 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1513
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1514 XawTabsSetHighlight((Widget)tw, w) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1515
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1516 if( callCallbacks )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1517 XtCallCallbackList(w, tw->tabs.callbacks, (XtPointer)w) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1518 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1519
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1520
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1521 /* Set the top tab, optionally call all callbacks. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1522 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1523 XawTabsSetHighlight(Widget t, Widget w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1524 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1525 TabsWidget tw = (TabsWidget)t ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1526
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1527 if( !XtIsSubclass(t, tabsWidgetClass) )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1528 return ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1529
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1530 if( XtIsRealized(t) && w != tw->tabs.hilight )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1531 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1532 if( w != NULL )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1533 DrawHighlight(tw, w, False) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1534 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1535
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1536 tw->tabs.hilight = w ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1537 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1538
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1539
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1540
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1541
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1542 /****************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1543 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1544 * Private Procedures
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1545 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1546 ****************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1547
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1548
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1549 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1550 TabsAllocGCs(TabsWidget tw)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1551 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1552 TabsAllocFgGC(tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1553 TabsAllocGreyGC(tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1554 tw->tabs.backgroundGC = AllocBackgroundGC((Widget)tw, None) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1555 tw->tabs.topGC = AllocTopShadowGC((Widget)tw,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1556 tw->tabs.top_shadow_contrast, tw->tabs.be_nice_to_cmap) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1557 tw->tabs.botGC = AllocBotShadowGC((Widget)tw,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1558 tw->tabs.bot_shadow_contrast, tw->tabs.be_nice_to_cmap) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1559 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1560
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1561
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1562 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1563 TabsFreeGCs(TabsWidget tw)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1564 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1565 Widget w = (Widget) tw;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1566
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1567 XtReleaseGC(w, tw->tabs.foregroundGC) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1568 XtReleaseGC(w, tw->tabs.greyGC) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1569 XtReleaseGC(w, tw->tabs.backgroundGC) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1570 XtReleaseGC(w, tw->tabs.topGC) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1571 XtReleaseGC(w, tw->tabs.botGC) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1572 XmuReleaseStippledPixmap(XtScreen(w), tw->tabs.grey50) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1573 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1574
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1575
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1576
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1577
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1578
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1579 /* Redraw entire Tabs widget */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1580
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1581 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1582 DrawTabs(TabsWidget tw, Bool labels)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1583 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1584 Widget *childP ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1585 int i,j ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1586 Dimension s = SHADWID ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1587 Dimension th = tw->tabs.tab_height ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1588 Position y ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1589 TabsConstraints tab ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1590
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1591 if( !XtIsRealized((Widget)tw))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1592 return ;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1593
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1594 /* draw tabs and frames by row except for the top tab, which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1595 * is drawn last. (This is inefficiently written, but should not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1596 * be too slow as long as there are not a lot of rows.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1597 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1598
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1599 y = tw->tabs.numRows == 1 ? TABDELTA : 0 ;
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 448
diff changeset
1600 for(i=0; i < (int) tw->tabs.numRows; ++i, y += th)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1601 {
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1602 for( j=TabsNumChildren (tw), childP=tw->composite.children;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1603 --j >= 0; ++childP )
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1604 if( TabVisible(*childP) )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1605 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1606 tab = (TabsConstraints)(*childP)->core.constraints;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1607 if( tab->tabs.row == i && *childP != tw->tabs.topWidget )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1608 DrawTab(tw, *childP, labels) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1609 }
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 448
diff changeset
1610 if( i != (int) tw->tabs.numRows -1 )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1611 DrawTrim(tw, 0,y+th, tw->core.width, th+s, False,False) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1612 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1613
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1614 DrawFrame(tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1615
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1616 /* and now the top tab */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1617 if( tw->tabs.topWidget != NULL )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1618 DrawTab(tw, tw->tabs.topWidget, labels) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1619 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1620
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1621
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1622
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1623 /* Draw one tab. Corners are rounded very slightly. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1624
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1625 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1626 DrawTab(TabsWidget tw, Widget child, Bool labels)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1627 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1628 GC gc ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1629 int x,y ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1630
3397
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
1631 if (debug_tabs > 2) fprintf (stderr, "DrawTab called.\n");
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1632
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1633 if( !XtIsRealized((Widget)tw))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1634 return ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1635
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1636 DrawBorder(tw, child, False) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1637
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1638 if( labels )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1639 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1640 TabsConstraints tab = (TabsConstraints)child->core.constraints;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1641 Display *dpy = XtDisplay((Widget)tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1642 Window win = XtWindow((Widget)tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1643 String lbl = tab->tabs.label != NULL ?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1644 tab->tabs.label : XtName(child) ;
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
1645 #ifdef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1646 XftColor color;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1647 XftColor colorBG;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1648 Colormap cmap = tw->core.colormap;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1649 Visual *visual;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1650 int ignored;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1651
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1652 visual_info_from_widget ((Widget) tw, &visual, &ignored);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1653 colorBG = xft_convert_color (dpy, cmap, visual,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1654 tw->core.background_pixel, 0);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1655 #endif
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1656
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1657 if (debug_tabs > 2)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1658 fprintf (stderr, "(Re)drawing labels.\n");
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1659
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1660 if (XtIsSensitive(child))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1661 {
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1662 gc = tw->tabs.foregroundGC;
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
1663 #ifdef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1664 color = xft_convert_color (dpy, cmap, visual,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1665 tab->tabs.foreground, 0);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1666 #else
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1667 XSetForeground(dpy, gc, tab->tabs.foreground);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1668 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1669 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1670 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1671 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1672 /* grey pixel allocation deferred until now */
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1673 if (!tab->tabs.greyAlloc)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1674 {
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1675 if (tw->tabs.be_nice_to_cmap || tw->core.depth == 1)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1676 tab->tabs.grey = tab->tabs.foreground;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1677 else
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1678 tab->tabs.grey = AllocGreyPixel ((Widget) tw,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1679 tab->tabs.foreground,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1680 tw->core.background_pixel,
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1681 tw->tabs.insensitive_contrast);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1682 tab->tabs.greyAlloc = True;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1683 }
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1684 gc = tw->tabs.greyGC;
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
1685 #ifdef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1686 color = xft_convert_color (dpy, cmap, visual, tab->tabs.grey, 0);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1687 #else
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1688 XSetForeground(dpy, gc, tab->tabs.grey);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1689 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1690 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1691
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1692 x = tab->tabs.x;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1693 y = tab->tabs.y;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1694 if (child == tw->tabs.topWidget)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1695 y -= TABLDELTA;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1696
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1697 if (tab->tabs.left_bitmap != None && tab->tabs.lbm_width > 0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1698 {
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1699 if (tab->tabs.lbm_depth == 1)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1700 XCopyPlane(dpy, tab->tabs.left_bitmap, win,gc,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1701 0,0, tab->tabs.lbm_width, tab->tabs.lbm_height,
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1702 x+tab->tabs.lbm_x, y+tab->tabs.lbm_y, 1L);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1703 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1704 XCopyArea(dpy, tab->tabs.left_bitmap, win,gc,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1705 0,0, tab->tabs.lbm_width, tab->tabs.lbm_height,
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1706 x+tab->tabs.lbm_x, y+tab->tabs.lbm_y);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1707 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1708
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1709 if (lbl != NULL &&
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
1710 #ifdef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1711 tw->tabs.renderFont != NULL
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1712 #else
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1713 tw->tabs.font != NULL
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1714 #endif
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1715 )
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1716 {
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
1717 #ifdef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1718 XftDraw *xftDraw = XftDrawCreate (dpy, win, visual, cmap);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1719 XftFont *renderFont = tw->tabs.renderFont;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1720 XGlyphInfo glyphinfo;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1721 XftColor colorDBG;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1722 XftColorAllocName (dpy, visual, cmap, "wheat", &colorDBG);
3374
174eb4da74fb [xemacs-hg @ 2006-05-02 15:30:31 by james]
james
parents: 3094
diff changeset
1723 XftTextExtents8 (dpy, renderFont, (FcChar8 *) lbl,
174eb4da74fb [xemacs-hg @ 2006-05-02 15:30:31 by james]
james
parents: 3094
diff changeset
1724 (int) strlen (lbl), &glyphinfo);
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1725 /* #### unnecessary? for the moment, give visual extent */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1726 /* draw background rect */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1727 if (debug_tabs > 2)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1728 {
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1729 fprintf (stderr, "background color: pixel=%08lx, r=%04x,"
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1730 " g=%04x, b=%04x, alpha=%04x.\n",
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1731 colorDBG.pixel, colorDBG.color.red,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1732 colorDBG.color.green, colorDBG.color.blue,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1733 colorDBG.color.alpha);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1734 fprintf (stderr, "label geometry: x=%d, y=%d, xOff=%d,"
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1735 " yOff=%d, width=%d, height=%d\n",
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1736 glyphinfo.x, glyphinfo.y, glyphinfo.xOff,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1737 glyphinfo.yOff, glyphinfo.width, glyphinfo.height);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1738 }
3397
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
1739 if (debug_tabs > 2)
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
1740 XftDrawRect (xftDraw, &colorDBG,
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
1741 /* left, top, width, height */
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
1742 x+tab->tabs.l_x-glyphinfo.x,
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
1743 y+tab->tabs.l_y-glyphinfo.y,
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
1744 glyphinfo.width, glyphinfo.height);
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
1745
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1746 /* draw text */
3397
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
1747 if (debug_tabs > 1)
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1748 {
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1749 fprintf (stderr, "label: %s.\n", lbl);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1750 fprintf (stderr, "foreground color: pixel=%08lx, r=%04x,"
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1751 " g=%04x, b=%04x, alpha=%04x.\n",
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1752 color.pixel, color.color.red, color.color.green,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1753 color.color.blue, color.color.alpha);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1754 fprintf (stderr, "extent: x=%d, y=%d, xOffset=%d,"
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1755 " yOffset=%d, height=%d, width=%d.\n",
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1756 glyphinfo.x, glyphinfo.y, glyphinfo.xOff,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1757 glyphinfo.yOff, glyphinfo.height, glyphinfo.width);
3397
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
1758 }
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
1759 if (debug_tabs > 0)
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
1760 {
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
1761 FcValue name;
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
1762 FcValue size;
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
1763 FcPatternGet (renderFont->pattern, FC_FAMILY, 0, &name);
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
1764 FcPatternGet (renderFont->pattern, FC_SIZE, 0, &size);
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1765 fprintf (stderr, "font: name=%s-%.1f,"
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1766 " height=%d, ascent=%d, descent=%d.\n",
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1767 name.u.s, size.u.d, renderFont->height,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1768 renderFont->ascent, renderFont->descent);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1769 }
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1770 XftDrawString8 (xftDraw, &color, renderFont,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1771 x+tab->tabs.l_x, y+tab->tabs.l_y,
3374
174eb4da74fb [xemacs-hg @ 2006-05-02 15:30:31 by james]
james
parents: 3094
diff changeset
1772 (FcChar8 *) lbl, (int) strlen (lbl));
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1773 XftDrawDestroy (xftDraw);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1774 #else
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1775 XDrawString(dpy,win,gc,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1776 x+tab->tabs.l_x, y+tab->tabs.l_y,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1777 lbl, (int)strlen(lbl));
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1778 #endif
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1779 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1780 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1781
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1782 if (child == tw->tabs.hilight)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1783 DrawHighlight(tw, child, False);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1784 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1785
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1786
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1787 /* draw frame all the way around the child windows. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1788
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1789 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1790 DrawFrame(TabsWidget tw)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1791 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1792 GC topgc = tw->tabs.topGC ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1793 GC botgc = tw->tabs.botGC ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1794 Dimension s = SHADWID ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1795 Dimension ch = tw->tabs.child_height ;
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1796 if (ch > 0)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1797 Draw3dBox((Widget)tw, 0,tw->tabs.tab_total,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1798 tw->core.width, ch+2*s, s, topgc, botgc) ;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1799 else
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1800 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1801 Widget w = tw->tabs.topWidget ;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1802 if (w != NULL)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1803 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1804 TabsConstraints tab = (TabsConstraints) w->core.constraints ;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1805 Draw3dBox((Widget)tw, 0,tw->core.height - 2*s,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1806 tab->tabs.x, 2*s, s, topgc, botgc);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1807 Draw3dBox((Widget)tw, tab->tabs.x + tab->tabs.width,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1808 tw->core.height - 2*s,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1809 tw->core.width - tab->tabs.x - tab->tabs.width, 2*s, s,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1810 topgc, botgc);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1811 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1812 else
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1813 Draw3dBox((Widget)tw, 0,tw->core.height - 2*s,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1814 tw->core.width, 2*s, s, topgc, botgc) ;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1815 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1816 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1817
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1818
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1819 /* draw trim around a tab or underneath a row of tabs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1820
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1821 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1822 DrawTrim(TabsWidget tw, /* widget */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1823 int x, /* upper-left corner */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1824 int y,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1825 int wid, /* total size */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1826 int hgt,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1827 Bool bottom, /* draw bottom? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1828 Bool undraw) /* undraw all */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1829 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1830 Display *dpy = XtDisplay((Widget)tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1831 Window win = XtWindow((Widget)tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1832 GC bggc = tw->tabs.backgroundGC ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1833 GC topgc = undraw ? bggc : tw->tabs.topGC ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1834 GC botgc = undraw ? bggc : tw->tabs.botGC ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1835 if( bottom )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1836 XDrawLine(dpy,win,bggc, x,y+hgt-1, x+wid-1,y+hgt-1) ; /* bottom */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1837 XDrawLine(dpy,win,topgc, x,y+2, x,y+hgt-2) ; /* left */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1838 XDrawPoint(dpy,win,topgc, x+1,y+1) ; /* corner */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1839 XDrawLine(dpy,win,topgc, x+2,y, x+wid-3,y) ; /* top */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1840 XDrawLine(dpy,win,botgc, x+wid-2,y+1, x+wid-2,y+hgt-2) ; /* right */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1841 XDrawLine(dpy,win,botgc, x+wid-1,y+2, x+wid-1,y+hgt-2) ; /* right */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1842 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1843
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1844
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1845 /* Draw one tab border. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1846
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1847 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1848 DrawBorder(TabsWidget tw, Widget child, Bool undraw)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1849 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1850 TabsConstraints tab = (TabsConstraints)child->core.constraints;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1851 Position x = tab->tabs.x ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1852 Position y = tab->tabs.y ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1853 Dimension twid = tab->tabs.width ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1854 Dimension thgt = tw->tabs.tab_height ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1855
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1856 /* top tab requires a little special attention; it overlaps
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1857 * neighboring tabs slightly, so the background must be cleared
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1858 * in the region of the overlap to partially erase those neighbors.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1859 * TODO: is this worth doing with regions instead?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1860 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1861 if( child == tw->tabs.topWidget )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1862 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1863 Display *dpy = XtDisplay((Widget)tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1864 Window win = XtWindow((Widget)tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1865 GC bggc = tw->tabs.backgroundGC ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1866 XRectangle rects[3] ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1867 x -= TABDELTA ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1868 y -= TABDELTA ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1869 twid += TABDELTA*2 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1870 thgt += TABDELTA ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1871 AddRect(0, x,y+1,twid,TABDELTA) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1872 AddRect(1, x+1,y,TABDELTA,thgt) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1873 AddRect(2, x+twid-TABDELTA-1,y,TABDELTA,thgt) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1874 XFillRectangles(dpy,win,bggc, rects, 3) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1875 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1876
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1877 DrawTrim(tw, x,y,twid,thgt+1, child == tw->tabs.topWidget, undraw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1878 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1879
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1880
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1881 /* Draw highlight around tab that has focus */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1882
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1883 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1884 DrawHighlight(TabsWidget tw, Widget child, Bool undraw)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1885 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1886 TabsConstraints tab = (TabsConstraints)child->core.constraints;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1887 Display *dpy = XtDisplay((Widget)tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1888 Window win = XtWindow((Widget)tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1889 GC gc ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1890 Position x = tab->tabs.x ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1891 Position y = tab->tabs.y ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1892 Dimension wid = tab->tabs.width ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1893 Dimension hgt = tw->tabs.tab_height ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1894 XPoint points[6] ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1895
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1896 /* top tab does not have a highlight */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1897
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1898 if( child == tw->tabs.topWidget )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1899 return ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1900
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1901 if( undraw )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1902 gc = tw->tabs.backgroundGC ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1903
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1904 else if( XtIsSensitive(child) )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1905 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1906 gc = tw->tabs.foregroundGC ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1907 XSetForeground(dpy, gc, tab->tabs.foreground) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1908 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1909 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1910 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1911 gc = tw->tabs.greyGC ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1912 XSetForeground(dpy, gc, tab->tabs.grey) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1913 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1914
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1915 points[0].x = x+1 ; points[0].y = y+hgt-1 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1916 points[1].x = x+1 ; points[1].y = y+2 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1917 points[2].x = x+2 ; points[2].y = y+1 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1918 points[3].x = x+wid-4 ; points[3].y = y+1 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1919 points[4].x = x+wid-3 ; points[4].y = y+2 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1920 points[5].x = x+wid-3 ; points[5].y = y+hgt-1 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1921
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1922 XDrawLines(dpy,win,gc, points,6, CoordModeOrigin) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1923 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1924
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1925
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1926 /* Undraw one tab interior */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1927
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1928 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1929 UndrawTab(TabsWidget tw, Widget child)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1930 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1931 TabsConstraints tab = (TabsConstraints)child->core.constraints;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1932 Position x = tab->tabs.x ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1933 Position y = tab->tabs.y ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1934 Dimension twid = tab->tabs.width ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1935 Dimension thgt = tw->tabs.tab_height ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1936 Display *dpy = XtDisplay((Widget)tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1937 Window win = XtWindow((Widget)tw) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1938 GC bggc = tw->tabs.backgroundGC ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1939
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1940 XFillRectangle(dpy,win,bggc, x,y, twid,thgt) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1941 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1942
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1943
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1944
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1945
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1946
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1947 /* GEOMETRY UTILITIES */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1948
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1949 /* Overview:
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1950 *
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1951 * MaxChild(): ask all children (except possibly one) their
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1952 * preferred sizes, set max_cw, max_ch accordingly.
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1953 *
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1954 * GetPreferredSizes(): ask all children their preferred sizes,
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1955 * set max_cw, max_ch accordingly.
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1956 *
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1957 * PreferredSize(): given max_cw, max_ch, return tabs widget
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1958 * preferred size. Iterate with other widths in order to get
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1959 * a reasonable aspect ratio.
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1960 *
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1961 * PreferredSize2(): Given child dimensions, return Tabs
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1962 * widget dimensions.
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1963 *
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1964 * PreferredSize3(): Same, except given child dimensions plus
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1965 * shadow.
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1966 */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1967
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1968
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
1969 /* Compute the width of one child's tab. Positions will be computed
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1970 * elsewhere.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1971 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1972 * height: font height + vertical_space*2 + shadowWid*2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1973 * width: string width + horizontal_space*2 + shadowWid*2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1974 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1975 * All tabs are the same height, so that is computed elsewhere.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1976 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1977
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1978 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1979 TabWidth(Widget w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1980 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1981 TabsConstraints tab = (TabsConstraints) w->core.constraints ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1982 TabsWidget tw = (TabsWidget)XtParent(w) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1983 String lbl = tab->tabs.label != NULL ?
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1984 tab->tabs.label : XtName(w);
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
1985 #ifdef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1986 XftFont *font = tw->tabs.renderFont;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1987 #else
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1988 XFontStruct *font = tw->tabs.font;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1989 #endif
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
1990 int iw = tw->tabs.internalWidth;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1991
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1992 tab->tabs.width = iw + SHADWID*2 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1993 tab->tabs.l_x = tab->tabs.lbm_x = SHADWID + iw ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1994
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1995 if( tab->tabs.left_bitmap != None )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1996 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1997 tab->tabs.width += tab->tabs.lbm_width + iw ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1998 tab->tabs.l_x += tab->tabs.lbm_width + iw ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1999 tab->tabs.lbm_y = (tw->tabs.tab_height - tab->tabs.lbm_height)/2 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2000 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2001
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2002 if( lbl != NULL && font != NULL )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2003 {
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
2004 #ifdef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2005 tab->tabs.width += x_xft_text_width (XtDisplay(tw), font,
3374
174eb4da74fb [xemacs-hg @ 2006-05-02 15:30:31 by james]
james
parents: 3094
diff changeset
2006 (FcChar8 *) lbl,
174eb4da74fb [xemacs-hg @ 2006-05-02 15:30:31 by james]
james
parents: 3094
diff changeset
2007 (int)strlen(lbl)) + iw;
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2008 tab->tabs.l_y = (tw->tabs.tab_height
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2009 + tw->tabs.renderFont->ascent
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2010 /* #### how can this subtraction be correct? */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2011 - tw->tabs.renderFont->descent)/2;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2012 if (debug_tabs > 2)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2013 fprintf (stderr, "tab: height=%d, width=%d, baseline=%d.\n",
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2014 tw->tabs.tab_height, tab->tabs.width, tab->tabs.l_y);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2015 if (debug_tabs > 1)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2016 fprintf (stderr, "font: height=%d, ascent=%d, descent=%d.\n",
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2017 tw->tabs.renderFont->height,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2018 tw->tabs.renderFont->ascent,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2019 tw->tabs.renderFont->descent);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2020 #else
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2021 tab->tabs.width += XTextWidth (font, lbl, (int)strlen(lbl)) + iw;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2022 tab->tabs.l_y = (tw->tabs.tab_height +
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
2023 tw->tabs.font->max_bounds.ascent -
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2024 tw->tabs.font->max_bounds.descent)/2;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2025 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2026 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2027 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2028
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2029
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2030
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2031 /* Lay out tabs to fit in given width. Compute x,y position and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2032 * row number for each tab. Return number of rows and total height
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2033 * required by all tabs. If there is only one row, add TABDELTA
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2034 * height to the total. Rows are assigned bottom to top.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2035 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2036 * Tabs are indented from the edges by INDENT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2037 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2038 * TODO: if they require more than two rows and the total height:width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2039 * ratio is more than 2:1, then try something else.
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2040 * Gaak! This is actually already done in PreferredSize()!
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2041 *
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2042 * TODO SOONER: for reasons unclear, some applications (specifically
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2043 * XEmacs) give a nominal geometry (in the core record) which doesn't
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2044 * make much sense (eg, may be smaller than some of the tab children).
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2045 * This results in bizarre values for DISPLAY_ROWS and REPLY_HEIGHT.
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2046 * Specify a way to say "tell me what you really want" (eg, with WID
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2047 * and/or HGT == 0 or == Dimension_MAX), and use it where appropriate.
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2048 * LATE-BREAKING LOSE: This happens in PreferredSize(), not XEmacs!
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2049 *
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2050 * TODO EVEN SOONER: some applications lay out the tab control by
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2051 * repeatedly querying until a fixed width and height has been filled
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2052 * by the tabs (XEmacs). There should be an API to cache this?
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2053 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2054
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2055 static int
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
2056 TabLayout(TabsWidget tw,
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2057 Dimension wid, /* if 0, use core.width as guess */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2058 Dimension hgt, /* if 0, use core.height as guess */
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
2059 Dimension *reply_height, Bool query_only)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2060 {
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2061 int i, row, done = 0, display_rows = 0 ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2062 int num_children = tw->composite.num_children ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2063 Widget *childP ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2064 Dimension w ;
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2065 Position x,y ; /* #### gaak, these are dimensions! */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2066 TabsConstraints tab ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2067
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2068 /* Algorithm: loop through children, assign X positions. If a tab
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2069 * would extend beyond the right edge, start a new row. After all
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2070 * rows are assigned, make a second pass and assign Y positions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2071 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2072
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2073 if( num_children > 0 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2074 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2075 /* Loop through the tabs and see how much space they need. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2076
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2077 row = 0 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2078 x = INDENT ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2079 y = 0 ;
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2080 /* If wid or hgt is 0, we want to guess our own dimensions.
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2081 Currently the guessing functions are broken....
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2082 #### When PreferredSize*() get fixed, fix this too. */
3397
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
2083 if (debug_tabs > 1)
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2084 fprintf (stderr, "arg=%d,", wid);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2085 wid = (wid ? wid : tw->core.width) - INDENT ;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2086 hgt = hgt ? hgt : tw->core.height;
3397
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
2087 if (debug_tabs > 1)
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2088 fprintf (stderr, "wid=%d: x,w,y=", wid);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2089 for(i=num_children, childP=tw->composite.children; --i >= 0; ++childP)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2090 if( XtIsManaged(*childP) )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2091 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2092 tab = (TabsConstraints) (*childP)->core.constraints ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2093 w = tab->tabs.width ;
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2094
3397
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
2095 if (debug_tabs > 1)
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2096 fprintf (stderr, "%d,%d,%d;", x, w, y);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2097 if( x + w > wid ) { /* new row */
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2098 /* #### algorithm is not robust to wid < child's width */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2099 ++row;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2100 x = INDENT ;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2101 y += tw->tabs.tab_height ;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2102 if (y > hgt && !done)
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2103 {
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2104 display_rows = row;
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2105 done = 1;
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2106 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2107 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2108 if( !query_only ) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2109 tab->tabs.x = x ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2110 tab->tabs.y = y ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2111 tab->tabs.row = row ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2112 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2113 x += w + SPACING ;
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2114 if (!query_only && !done)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2115 tab->tabs.visible = 1;
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2116
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2117 }
3397
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
2118 if (debug_tabs > 1)
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2119 fprintf (stderr, "\n");
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2120 /* If there was only one row, increase the height by TABDELTA */
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2121 if( ++display_rows == 1 )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2122 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2123 y = TABDELTA ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2124 if( !query_only )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2125 for(i=num_children, childP=tw->composite.children;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2126 --i >= 0 ; ++childP)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2127 if( XtIsManaged(*childP) )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2128 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2129 tab = (TabsConstraints) (*childP)->core.constraints ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2130 tab->tabs.y = y ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2131 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2132 }
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2133 row++;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2134 y += tw->tabs.tab_height ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2135 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2136 else
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2137 display_rows = row = y = 0 ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2138
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2139 if( !query_only ) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2140 tw->tabs.tab_total = y ;
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2141 tw->tabs.numRows = display_rows ;
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2142 tw->tabs.realRows = row;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2143 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2144
3397
6aa26bef0527 [xemacs-hg @ 2006-05-12 19:25:28 by stephent]
stephent
parents: 3374
diff changeset
2145 if (debug_tabs > 1 && (row > 1 || display_rows > 1))
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2146 fprintf (stderr, "tab: %d display rows, #children = %d,"
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2147 " total height %d, total rows %d%s.\n",
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2148 display_rows, num_children, y, row,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2149 query_only ? " (query)" : "");
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2150
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2151 if( reply_height != NULL )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2152 *reply_height = y ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2153
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2154 return display_rows ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2155 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2156
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2157
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2158
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2159 /* Find max preferred child size. Returned sizes include child
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
2160 * border widths.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2161 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2162
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2163 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2164 GetPreferredSizes(TabsWidget tw)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2165 {
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
2166 MaxChild(tw, NULL, 0,0) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2167 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2168
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2169
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2170
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2171 /* Find max preferred child size and store in control widget.
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2172 * If except is non-null, don't ask that one.
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
2173 */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2174
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2175 static void
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
2176 MaxChild(TabsWidget tw, Widget except, Dimension cw, Dimension ch)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2177 {
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
2178 int i ;
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
2179 Widget *childP = tw->composite.children ;
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
2180 XtWidgetGeometry preferred ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2181
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2182 for(i=tw->composite.num_children; --i >=0; ++childP)
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
2183 if( TabVisible (*childP) /*XtIsManaged(*childP)*/ && *childP != except )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2184 {
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
2185 (void) XtQueryGeometry(*childP, NULL, &preferred) ;
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
2186 cw = Max(cw, preferred.width + preferred.border_width * 2 ) ;
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
2187 ch = Max(ch, preferred.height + preferred.border_width * 2 ) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2188 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2189
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2190 tw->tabs.max_cw = cw ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2191 tw->tabs.max_ch = ch ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2192 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2193
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2194
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2195
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2196 /* rotate row numbers to bring current widget to bottom row,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2197 * compute y positions for all tabs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2198 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2199
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2200 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2201 TabsShuffleRows(TabsWidget tw)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2202 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2203 TabsConstraints tab ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2204 int move ;
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2205 int real_rows, display_rows ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2206 Widget *childP ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2207 Dimension th = tw->tabs.tab_height ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2208 Position bottom ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2209 int i ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2210
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2211 /* There must be a top widget. If not, assign one. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2212 if( tw->tabs.topWidget == NULL && tw->composite.children != NULL )
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2213 for(i=TabsNumChildren (tw), childP=tw->composite.children;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2214 --i >= 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2215 ++childP)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2216 if( XtIsManaged(*childP) ) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2217 tw->tabs.topWidget = *childP ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2218 break ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2219 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2220
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2221 if( tw->tabs.topWidget != NULL )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2222 {
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2223 display_rows = tw->tabs.numRows ;
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2224 real_rows = tw->tabs.realRows ;
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
2225 assert( display_rows <= real_rows ) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2226
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2227 if( real_rows > 1 )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2228 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2229 tab = (TabsConstraints) tw->tabs.topWidget->core.constraints ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2230 assert( tab != NULL ) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2231
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2232 /* How far to move top row. The selected tab must be on
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2233 the bottom row of the *visible* rows. */
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2234 move = (real_rows + 1 - display_rows) - tab->tabs.row ;
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2235 if (move < 0)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2236 move = real_rows - move;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2237 bottom = tw->tabs.tab_total - th ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2238
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2239 for(i=tw->composite.num_children, childP=tw->composite.children;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2240 --i >= 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2241 ++childP)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2242 if( XtIsManaged(*childP) )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2243 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2244 tab = (TabsConstraints) (*childP)->core.constraints ;
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2245 tab->tabs.row = (tab->tabs.row + move) % real_rows ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2246 tab->tabs.y = bottom - tab->tabs.row * th ;
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2247 tab->tabs.visible = (tab->tabs.row < display_rows);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2248 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2249 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2250 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2251 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2252
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2253
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
2254 /* Find preferred size. Ask children, find size of largest,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2255 * add room for tabs & return. This can get a little involved,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2256 * as we don't want to have too many rows of tabs; we may widen
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2257 * the widget to reduce # of rows.
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
2258 *
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
2259 * This function requires that max_cw, max_ch already be set.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2260 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2261 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2262 PreferredSize(
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2263 TabsWidget tw,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2264 Dimension *reply_width, /* total widget size */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2265 Dimension *reply_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2266 Dimension *reply_cw, /* child widget size */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2267 Dimension *reply_ch)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2268 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2269 Dimension cw,ch ; /* child width, height */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2270 Dimension wid,hgt ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2271 Dimension rwid,rhgt ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2272 int nrow ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2273
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2274 wid = cw = tw->tabs.max_cw ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2275 hgt = ch = tw->tabs.max_ch ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2276
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2277 nrow = PreferredSize2(tw, wid,hgt, &rwid, &rhgt) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2278
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2279 /* Check for absurd results (more than 2 rows, high aspect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2280 * ratio). Try wider size if needed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2281 * TODO: make sure this terminates.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2282 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2283
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2284 if( nrow > 2 && rhgt > rwid )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2285 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2286 Dimension w0, w1 ;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
2287 int maxloop = 20 ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2288
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2289 /* step 1: start doubling size until it's too big */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2290 do {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2291 w0 = wid ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2292 wid = Max(wid*2, wid+20) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2293 nrow = PreferredSize2(tw, wid,hgt, &rwid,&rhgt) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2294 } while( nrow > 2 && rhgt > rwid ) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2295 w1 = wid ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2296
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2297 /* step 2: use Newton's method to find ideal size. Stop within
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2298 * 8 pixels.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2299 */
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
2300 while( --maxloop > 0 && w1 > w0 + 8 )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2301 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2302 wid = (w0+w1)/2 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2303 nrow = PreferredSize2(tw, wid,hgt, &rwid,&rhgt) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2304 if( nrow > 2 && rhgt > rwid )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2305 w0 = wid ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2306 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2307 w1 = wid ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2308 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2309 wid = w1 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2310 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2311
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2312 *reply_width = rwid ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2313 *reply_height = rhgt ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2314 if( reply_cw != NULL ) *reply_cw = cw ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2315 if( reply_ch != NULL ) *reply_ch = ch ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2316 return nrow ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2317 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2318
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2319
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2320 /* Find preferred size, given size of children. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2321
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2322 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2323 PreferredSize2(
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2324 TabsWidget tw,
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
2325 Dimension cw, /* child width, height */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
2326 Dimension ch,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2327 Dimension *reply_width, /* total widget size */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2328 Dimension *reply_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2329 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2330 Dimension s = SHADWID ;
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
2331 int ret;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2332
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2333 /* make room for shadow frame */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2334 cw += s*2 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2335 ch += s*2 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2336
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
2337 ret = PreferredSize3(tw, cw, ch, reply_width, reply_height) ;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
2338
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
2339 assert (*reply_width > 0 && *reply_height > 0);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
2340 return ret;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2341 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2342
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2343
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2344 /* Find preferred size, given size of children+shadow. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2345
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2346 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2347 PreferredSize3(
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2348 TabsWidget tw,
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
2349 Dimension wid, /* child width, height */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
2350 Dimension hgt,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2351 Dimension *reply_width, /* total widget size */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2352 Dimension *reply_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2353 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2354 Dimension th ; /* space used by tabs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2355 int nrows ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2356
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2357 if( tw->composite.num_children > 0 )
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2358 /* used to be wid, hgt not 0, 0 but that's obviously wrong
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2359 since TabLayout wants dimensions of control parent but
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2360 wid, hgt are dimensions of some child */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2361 nrows = TabLayout(tw, 0, 0, &th, True) ;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2362 else {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2363 th = 0 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2364 nrows = 0 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2365 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2366
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2367 *reply_width = Max(wid, MIN_WID) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2368 *reply_height = Max(th+hgt, MIN_HGT) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2369
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2370 return nrows ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2371 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2372
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2373
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2374 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2375 MakeSizeRequest(TabsWidget tw)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2376 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2377 Widget w = (Widget)tw ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2378 XtWidgetGeometry request, reply ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2379 XtGeometryResult result ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2380 Dimension cw,ch ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2381
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2382 request.request_mode = CWWidth | CWHeight ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2383 PreferredSize(tw, &request.width, &request.height, &cw, &ch) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2384
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2385 if( request.width == tw->core.width &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2386 request.height == tw->core.height )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2387 return ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2388
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2389 result = XtMakeGeometryRequest(w, &request, &reply) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2390
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2391 if( result == XtGeometryAlmost )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2392 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2393 /* Bugger. Didn't get what we want, but were offered a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2394 * compromise. If the width was too small, recompute
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2395 * based on the too-small width and try again.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2396 * If the height was too small, make a wild-ass guess
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2397 * at a wider width and try again.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2398 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2399
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2400 if( reply.width < request.width && reply.height >= request.height )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2401 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2402 Dimension s = SHADWID ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2403 ch += s*2 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2404 PreferredSize3(tw, reply.width,ch, &request.width, &request.height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2405 result = XtMakeGeometryRequest(w, &request, &reply) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2406 if( result == XtGeometryAlmost )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2407 (void) XtMakeGeometryRequest(w, &reply, NULL) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2408 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2409
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2410 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2411 (void) XtMakeGeometryRequest(w, &reply, NULL) ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2412 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2413 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2414
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2415
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2416 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2417 getBitmapInfo(TabsWidget tw, TabsConstraints tab)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2418 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2419 Window root ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2420 int x,y ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2421 unsigned int bw ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2422
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2423 if( tab->tabs.left_bitmap == None ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2424 !XGetGeometry(XtDisplay(tw), tab->tabs.left_bitmap, &root, &x, &y,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 432
diff changeset
2425 &tab->tabs.lbm_width, &tab->tabs.lbm_height,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2426 &bw, &tab->tabs.lbm_depth) )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2427 tab->tabs.lbm_width = tab->tabs.lbm_height = 0 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2428 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2429
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2430
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2431
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2432
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2433 /* Code copied & modified from Gcs.c. This version has dynamic
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2434 * foreground.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2435 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2436
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2437 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2438 TabsAllocFgGC(TabsWidget tw)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2439 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2440 Widget w = (Widget) tw;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2441 XGCValues values ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2442
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2443 values.background = tw->core.background_pixel;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2444 values.font =
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
2445 #ifdef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2446 None;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2447 #else
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2448 tw->tabs.font->fid;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2449 #endif
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2450 values.line_style = LineOnOffDash;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2451 values.line_style = LineSolid;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2452
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2453 tw->tabs.foregroundGC =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2454 XtAllocateGC(w, w->core.depth,
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
2455 #ifndef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2456 GCFont|
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2457 #endif
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2458 GCBackground|GCLineStyle,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2459 &values,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2460 GCForeground,
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
2461 #ifdef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2462 GCFont|
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2463 #endif
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2464 GCSubwindowMode|GCGraphicsExposures|GCDashOffset|
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2465 GCDashList|GCArcMode);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2466 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2467
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2468 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2469 TabsAllocGreyGC(TabsWidget tw)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2470 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2471 Widget w = (Widget) tw;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2472 XGCValues values ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2473
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2474 values.background = tw->core.background_pixel;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2475 values.font =
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
2476 #ifdef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2477 None;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2478 #else
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2479 tw->tabs.font->fid;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2480 #endif
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2481 if (tw->tabs.be_nice_to_cmap || w->core.depth == 1)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2482 {
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2483 values.fill_style = FillStippled;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2484 tw->tabs.grey50 =
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2485 values.stipple = XmuCreateStippledPixmap(XtScreen(w), 1L, 0L, 1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2486
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2487 tw->tabs.greyGC =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2488 XtAllocateGC(w, w->core.depth,
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
2489 #ifndef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2490 GCFont|
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2491 #endif
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2492 GCBackground|GCStipple|GCFillStyle, &values,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2493 GCForeground,
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
2494 #ifdef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2495 GCFont|
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2496 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2497 GCSubwindowMode|GCGraphicsExposures|GCDashOffset|
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2498 GCDashList|GCArcMode);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2499 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2500 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2501 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2502 tw->tabs.greyGC =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2503 XtAllocateGC(w, w->core.depth,
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
2504 #ifdef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2505 0L,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2506 #else
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2507 GCFont,
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2508 #endif
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2509 &values,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2510 GCForeground,
4916
a6c778975d7d split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents: 4769
diff changeset
2511 #ifdef HAVE_XFT_TABS
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2512 GCFont|
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2513 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2514 GCBackground|GCSubwindowMode|GCGraphicsExposures|GCDashOffset|
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3025
diff changeset
2515 GCDashList|GCArcMode);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2516 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2517 }