annotate src/gui_xmebw.c @ 633:7437be625546

updated for version 7.0183
author vimboss
date Fri, 20 Jan 2006 23:02:51 +0000
parents 6df0106fc595
children 23f82b5d2814
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1 /* vi:set ts=8 sts=4 sw=4:
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
2 *
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
4 *
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
7 * See README.txt for an overview of the Vim source code.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
8 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
9 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
10 *
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
11 * (C) 2002,2005 by Marcin Dalecki <martin@dalecki.de>
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
12 *
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
13 * MARCIN DALECKI ASSUMES NO RESPONSIBILITY FOR THE USE OR INABILITY TO USE ANY
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
14 * OF THIS SOFTWARE . THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
15 * KIND, AND MARCIN DALECKI EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
16 * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
17 * FITNESS FOR A PARTICULAR PURPOSE.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
18 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
19
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
20 /*
158
78423945b251 updated for version 7.0048
vimboss
parents: 147
diff changeset
21 * Enhanced Motif PushButton widget with move over behavior.
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
22 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
23
158
78423945b251 updated for version 7.0048
vimboss
parents: 147
diff changeset
24 #include "vim.h"
78423945b251 updated for version 7.0048
vimboss
parents: 147
diff changeset
25
78423945b251 updated for version 7.0048
vimboss
parents: 147
diff changeset
26 #ifdef FEAT_TOOLBAR
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
27
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
28 #include <Xm/XmP.h>
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
29 #include <Xm/DrawP.h>
147
2f5a3b881ada updated for version 7.0046
vimboss
parents: 129
diff changeset
30 #if defined(HAVE_XM_TRAITP_H) && defined(HAVE_XM_MANAGER_H) \
2f5a3b881ada updated for version 7.0046
vimboss
parents: 129
diff changeset
31 && defined(HAVE_XM_UNHIGHLIGHT_H) && defined(HAVE_XM_XPMP_H)
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
32 # include <Xm/TraitP.h>
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
33 # include <Xm/Manager.h>
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
34 # include <Xm/UnhighlightT.h>
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
35 # include <Xm/XpmP.h>
147
2f5a3b881ada updated for version 7.0046
vimboss
parents: 129
diff changeset
36 # define UNHIGHLIGHTT
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
37 #else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
38 # include <X11/xpm.h>
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
39 #endif
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
40 #include <Xm/ManagerP.h>
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
41 #include <Xm/Display.h>
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
42 #include <Xm/DisplayP.h>
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
43
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
44 #include <X11/Shell.h>
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
45 #include <X11/ShellP.h>
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
46
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
47 #include "gui_xmebwp.h"
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
49 /* Provide some missing wrappers, which are missed from the LessTif
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
50 * implementation.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
51 *
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
52 * We neither use XmeGetPixmapData or _XmGetPixmapData, since with LessTif the
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
53 * pixmap will not appear in it's caches properly. We cache the interresting
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
54 * values in XmEnhancedButtonPart instead ourself.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
55 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
56 #ifdef LESSTIF_VERSION
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
57 # ifndef Lab_IsMenupane
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
58 # define Lab_IsMenupane(w) (Lab_MenuType(w) == (int)XmMENU_POPUP || \
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
59 Lab_MenuType(w) == (int)XmMENU_PULLDOWN)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
60 # endif
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
61 # define XmeClearBorder _XmClearBorder
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
62 # define XmeDrawShadows _XmDrawShadows
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
63 # define XmeDrawHighlight(a, b, c, d, e, f, g, h) \
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
64 _XmDrawHighlight(a, b, c, d, e, f, g, h, LineSolid)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
65 #endif
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
66
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
67 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
68 * Motif internals we have to cheat around with.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
69 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
70
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
71 /* Hopefully this will never change... */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
72 #ifndef XmFOCUS_IGNORE
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
73 # define XmFOCUS_IGNORE 1<<1
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
74 #endif
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
75
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
76 extern Boolean _XmGetInDragMode(Widget widget);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
77 extern void _XmPrimitiveEnter(Widget wid,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
78 XEvent * event,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
79 String * params, Cardinal * num_params);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
80 extern void _XmPrimitiveLeave(Widget wid,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
81 XEvent * event,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
82 String * params, Cardinal * num_params);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
83 extern void _XmSetFocusFlag(Widget w, unsigned int mask, Boolean value);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
84 extern void _XmCalcLabelDimensions(Widget wid);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
85
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
86 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
87 * Declaration of class methods.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
88 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
89 static void Destroy(Widget w);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
90 static void Initialize(Widget rq, Widget eb, ArgList args, Cardinal *n);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
91 static Boolean SetValues(Widget current, Widget request, Widget new, ArgList args, Cardinal *n);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
92 static void Redisplay(Widget, XEvent *, Region);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
93
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
94 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
95 * Declaration of action methods.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
96 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
97 static void Enter(Widget, XEvent *, String *, Cardinal *);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
98 static void Leave(Widget, XEvent *, String *, Cardinal *);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
99 static void BorderHighlight(Widget);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
100 static void BorderUnhighlight(Widget);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
101
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
102 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
103 * 4 x 4 stipple for desensitized widgets
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
104 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
105 #define stipple_width 4
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
106 #define stipple_height 4
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
107 static char stipple_bits[] = { 0x0a, 0x05, 0x0a, 0x05 };
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
108 #define STIPPLE_BITMAP xmEnhancedButtonClassRec.enhancedbutton_class.stipple_bitmap
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
109
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
110 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
111 * Override actions.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
112 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
113 static XtActionsRec actionsList[] =
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
114 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
115 {"Enter", Enter},
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
116 {"Leave", Leave},
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
117 };
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
118
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
119 static XtResource resources[] =
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
120 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
121 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
122 XmNpixmapData, XmCPixmap, XmRString, sizeof(String),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
123 XtOffsetOf(XmEnhancedButtonRec, enhancedbutton.pixmap_data),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
124 XmRImmediate, (XtPointer) NULL
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
125 }, {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
126 XmNpixmapFile, XmCPixmap, XmRString, sizeof(String),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
127 XtOffsetOf(XmEnhancedButtonRec, enhancedbutton.pixmap_file),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
128 XmRImmediate, (XtPointer) NULL
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
129 }, {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
130 XmNspacing, XmCSpacing, XmRHorizontalDimension, sizeof(Dimension),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
131 XtOffsetOf(XmEnhancedButtonRec, enhancedbutton.spacing),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
132 XmRImmediate, (XtPointer) 2
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
133 },
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
134 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
135 XmNlabelLocation, XmCLocation, XmRInt, sizeof(int),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
136 XtOffsetOf(XmEnhancedButtonRec, enhancedbutton.label_location),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
137 XtRImmediate, (XtPointer) XmRIGHT
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
138 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
139 };
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
140
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
141 XmEnhancedButtonClassRec xmEnhancedButtonClassRec =
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
142 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
143 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
144 /* core_class fields */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
145 /* superclass */ (WidgetClass) & xmPushButtonClassRec,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
146 /* class_name */ "XmEnhancedButton",
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
147 /* widget_size */ sizeof(XmEnhancedButtonRec),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
148 /* class_initialize */ NULL,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
149 /* class_part_initialize */ NULL,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
150 /* class_inited */ False,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
151 /* initialize */ Initialize,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
152 /* initialize_hook */ NULL,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
153 /* realize */ XtInheritRealize,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
154 /* actions */ actionsList,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
155 /* num_actions */ XtNumber(actionsList),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
156 /* resources */ resources,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
157 /* num_resources */ XtNumber(resources),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
158 /* xrm_class */ NULLQUARK,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
159 /* compress_motion */ True,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
160 /* compress_exposure */ XtExposeCompressMaximal,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
161 /* compress_enterleave */ True,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
162 /* visible_interest */ False,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
163 /* destroy */ Destroy,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
164 /* resize */ XtInheritResize,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
165 /* expose */ Redisplay,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
166 /* set_values */ SetValues,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
167 /* set_values_hook */ NULL,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
168 /* set_values_almost */ XtInheritSetValuesAlmost,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
169 /* get_values_hook */ NULL,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
170 /* accept_focus */ XtInheritAcceptFocus,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
171 /* version */ XtVersion,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
172 /* callback_private */ NULL,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
173 /* tm_table */ NULL,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
174 /* query_geometry */ NULL,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
175 /* display_accelerator */ XtInheritDisplayAccelerator,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
176 /* extension */ NULL
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
177 },
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
178
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
179 /* primitive_class fields */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
180 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
181 /* border highlight */ BorderHighlight,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
182 /* border_unhighlight */ BorderUnhighlight,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
183 /* translations */ XtInheritTranslations,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
184 /* arm and activate */ XmInheritArmAndActivate,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
185 /* synthetic resources */ NULL,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
186 /* number of syn res */ 0,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
187 /* extension */ NULL,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
188 },
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
189
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
190 /* label_class fields */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
191 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
192 /* setOverrideCallback */ XmInheritSetOverrideCallback,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
193 /* menuProcs */ XmInheritMenuProc,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
194 /* translations */ XtInheritTranslations,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
195 /* extension */ NULL,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
196 },
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
197
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
198 /* pushbutton_class record */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
199 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
200 /* extension */ (XtPointer) NULL,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
201 },
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
202
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
203 /* enhancedbutton_class fields */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
204 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
205 /* stipple_bitmap */ None
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
206 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
207 };
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
208
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
209
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
210 WidgetClass xmEnhancedButtonWidgetClass =
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
211 (WidgetClass)&xmEnhancedButtonClassRec;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
212
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
213
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
214 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
215 * Create a slightly fainter pixmap to be shown on button entry.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
216 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
217 static unsigned short
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
218 bump_color(unsigned short value)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
219 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
220 int tmp = 2 * (((int) value - 65535) / 3) + 65535;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
221
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
222 return tmp;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
223 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
224
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
225 /*ARGSUSED*/
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
226 static int
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
227 alloc_color(Display *display,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
228 Colormap colormap,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
229 char *colorname,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
230 XColor *xcolor,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
231 void *closure)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
232 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
233 int status;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
234
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
235 if (colorname)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
236 if (!XParseColor(display, colormap, colorname, xcolor))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
237 return -1;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
238
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
239 xcolor->red = bump_color(xcolor->red);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
240 xcolor->green = bump_color(xcolor->green);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
241 xcolor->blue = bump_color(xcolor->blue);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
242
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
243 status = XAllocColor(display, colormap, xcolor);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
244 return status != 0 ? 1 : 0;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
245 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
246
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
247 /* XPM */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
248 static char * blank_xpm[] =
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
249 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
250 /* width height ncolors cpp [x_hot y_hot] */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
251 "12 12 4 1 0 0",
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
252 /* colors */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
253 " s iconColor1 m black c #000000",
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
254 ". s none m none c none",
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
255 "X s topShadowColor m none c #DCDEE5",
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
256 "o s bottomShadowColor m black c #5D6069",
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
257 /* pixels */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
258 " ..",
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
259 " XXXXXXXX ..",
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
260 " X....... o.",
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
261 " X....... o.",
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
262 " X....... o.",
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
263 " X....... o.",
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
264 " X....... o.",
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
265 " X....... o.",
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
266 " X....... o.",
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
267 " o.",
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
268 "..ooooooooo.",
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
269 "............"};
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
270
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
271 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
272 * Set the pixmap.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
273 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
274 static void
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
275 set_pixmap(XmEnhancedButtonWidget eb)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
276 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
277 XpmAttributes attr;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
278 Pixmap sen_pix;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
279 Window root;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
280 static XpmColorSymbol color[8] = {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
281 {"none", "none", 0},
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
282 {"None", "none", 0},
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
283 {"background", NULL, 0},
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
284 {"foreground", NULL, 0},
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
285 {"bottomShadowColor", NULL, 0},
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
286 {"topShadowColor", NULL, 0},
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
287 {"highlightColor", NULL, 0},
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
288 {"armColor", NULL, 0}
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
289 };
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
290 int scr;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
291 Display *dpy = XtDisplay(eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
292 int x;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
293 int y;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
294 unsigned int height, width, border, depth;
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 158
diff changeset
295 int status = 0;
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
296 Pixmap mask;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
297 Pixmap pix = None;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
298 Pixmap arm_pix = None;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
299 Pixmap ins_pix = None;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
300 Pixmap high_pix = None;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
301 char **data = (char **) eb->enhancedbutton.pixmap_data;
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 158
diff changeset
302 char *fname = (char *) eb->enhancedbutton.pixmap_file;
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
303 int shift;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
304 GC gc;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
305
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
306 /* Make sure there is a default value for the pixmap.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
307 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
308 if (!data)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
309 return;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
310
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
311 gc = XtGetGC((Widget)eb, (XtGCMask)0, NULL);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
312
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
313 scr = DefaultScreen(dpy);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
314 root = RootWindow(dpy, scr);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
315
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
316 eb->label.pixmap = None;
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 158
diff changeset
317
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
318 eb->enhancedbutton.pixmap_depth = 0;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
319 eb->enhancedbutton.pixmap_width = 0;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
320 eb->enhancedbutton.pixmap_height = 0;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
321 eb->enhancedbutton.normal_pixmap = None;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
322 eb->enhancedbutton.armed_pixmap = None;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
323 eb->enhancedbutton.highlight_pixmap = None;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
324 eb->enhancedbutton.insensitive_pixmap = None;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
325
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 158
diff changeset
326 /* We use dynamic colors, get them now. */
6df0106fc595 updated for version 7.0049
vimboss
parents: 158
diff changeset
327 motif_get_toolbar_colors(
6df0106fc595 updated for version 7.0049
vimboss
parents: 158
diff changeset
328 &eb->core.background_pixel,
6df0106fc595 updated for version 7.0049
vimboss
parents: 158
diff changeset
329 &eb->primitive.foreground,
6df0106fc595 updated for version 7.0049
vimboss
parents: 158
diff changeset
330 &eb->primitive.bottom_shadow_color,
6df0106fc595 updated for version 7.0049
vimboss
parents: 158
diff changeset
331 &eb->primitive.top_shadow_color,
6df0106fc595 updated for version 7.0049
vimboss
parents: 158
diff changeset
332 &eb->primitive.highlight_color);
6df0106fc595 updated for version 7.0049
vimboss
parents: 158
diff changeset
333
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
334 /* Setup color subsititution table. */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
335 color[0].pixel = eb->core.background_pixel;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
336 color[1].pixel = eb->core.background_pixel;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
337 color[2].pixel = eb->core.background_pixel;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
338 color[3].pixel = eb->primitive.foreground;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
339 color[4].pixel = eb->core.background_pixel;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
340 color[5].pixel = eb->primitive.top_shadow_color;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
341 color[6].pixel = eb->primitive.highlight_color;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
342 color[7].pixel = eb->pushbutton.arm_color;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
343
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
344 /* Create the "sensitive" pixmap. */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
345 attr.valuemask = XpmColorSymbols | XpmCloseness;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
346 attr.closeness = 65535; /* accuracy isn't crucial */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
347 attr.colorsymbols = color;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
348 attr.numsymbols = XtNumber(color);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
349
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 158
diff changeset
350 if (fname)
6df0106fc595 updated for version 7.0049
vimboss
parents: 158
diff changeset
351 status = XpmReadFileToPixmap(dpy, root, fname, &pix, &mask, &attr);
6df0106fc595 updated for version 7.0049
vimboss
parents: 158
diff changeset
352 if (!fname || status != XpmSuccess)
6df0106fc595 updated for version 7.0049
vimboss
parents: 158
diff changeset
353 status = XpmCreatePixmapFromData(dpy, root, data, &pix, &mask, &attr);
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
354
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 158
diff changeset
355 /* If something failed, we will fill in the default pixmap. */
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
356 if (status != XpmSuccess)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
357 status = XpmCreatePixmapFromData(dpy, root, blank_xpm, &pix,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
358 &mask, &attr);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
359
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
360 XpmFreeAttributes(&attr);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
361
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
362 XGetGeometry(dpy, pix, &root, &x, &y, &width, &height, &border, &depth);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
363
129
2983cde45542 updated for version 7.0044
vimboss
parents: 48
diff changeset
364 if (eb->enhancedbutton.label_location == (int)XmTOP
2983cde45542 updated for version 7.0044
vimboss
parents: 48
diff changeset
365 || eb->enhancedbutton.label_location == (int)XmBOTTOM)
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
366 shift = eb->primitive.shadow_thickness / 2;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
367 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
368 shift = eb->primitive.shadow_thickness / 2;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
369
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
370 if (shift < 1)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
371 shift = 1;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
372
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
373 sen_pix = XCreatePixmap(dpy, root, width + shift, height + shift, depth);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
374
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
375 XSetForeground(dpy, gc, eb->core.background_pixel);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
376 XFillRectangle(dpy, sen_pix, gc, 0, 0, width + shift, height + shift);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
377 XSetClipMask(dpy, gc, mask);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
378 XSetClipOrigin(dpy, gc, shift, shift);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
379 XCopyArea(dpy, pix, sen_pix, gc, 0, 0, width, height, shift, shift);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
380
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
381 /* Create the "highlight" pixmap. */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
382 color[4].pixel = eb->primitive.bottom_shadow_color;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
383 attr.valuemask = XpmColorSymbols | XpmCloseness | XpmAllocColor;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
384 attr.closeness = 65535; /* accuracy isn't crucial */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
385 attr.colorsymbols = color;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
386 attr.numsymbols = XtNumber(color);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
387 attr.alloc_color = alloc_color;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
388
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
389 status = XpmCreatePixmapFromData(dpy, root, data, &pix, NULL, &attr);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
390 XpmFreeAttributes(&attr);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
391
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
392 high_pix = XCreatePixmap(dpy, root, width + shift, height + shift, depth);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
393
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
394 #if 1
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
395 XSetForeground(dpy, gc, eb->core.background_pixel);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
396 #else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
397 XSetForeground(dpy, gc, eb->primitive.top_shadow_color);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
398 #endif
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
399 XSetClipMask(dpy, gc, None);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
400 XFillRectangle(dpy, high_pix, gc, 0, 0, width + shift, height + shift);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
401 XSetClipMask(dpy, gc, mask);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
402 XSetClipOrigin(dpy, gc, 0, 0);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
403 XCopyArea(dpy, pix, high_pix, gc, 0, 0, width, height, 0, 0);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
404
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
405 arm_pix = XCreatePixmap(dpy, pix, width + shift, height + shift, depth);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
406
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
407 if (eb->pushbutton.fill_on_arm)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
408 XSetForeground(dpy, gc, eb->pushbutton.arm_color);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
409 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
410 XSetForeground(dpy, gc, eb->core.background_pixel);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
411 XSetClipOrigin(dpy, gc, shift, shift);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
412 XSetClipMask(dpy, gc, None);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
413 XFillRectangle(dpy, arm_pix, gc, 0, 0, width + shift, height + shift);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
414 XSetClipMask(dpy, gc, mask);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
415 XSetClipOrigin(dpy, gc, 2 * shift, 2 * shift);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
416 XCopyArea(dpy, pix, arm_pix, gc, 0, 0, width, height, 2 * shift, 2 * shift);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
417
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
418 XFreePixmap(dpy, pix);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
419 XFreePixmap(dpy, mask);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
420
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
421 /* Create the "insensitive" pixmap. */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
422 attr.valuemask = XpmColorSymbols | XpmCloseness | XpmColorKey;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
423 attr.closeness = 65535; /* accuracy isn't crucial */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
424 attr.colorsymbols = color;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
425 attr.numsymbols = sizeof(color) / sizeof(color[0]);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
426 attr.color_key = XPM_MONO;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
427 status = XpmCreatePixmapFromData(dpy, root, data, &pix, &mask, &attr);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
428
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
429 /* Need to create new Pixmaps with the mask applied. */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
430
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
431 ins_pix = XCreatePixmap(dpy, root, width + shift, height + shift, depth);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
432
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
433 XSetForeground(dpy, gc, eb->core.background_pixel);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
434 XSetClipOrigin(dpy, gc, 0, 0);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
435 XSetClipMask(dpy, gc, None);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
436 XFillRectangle(dpy, ins_pix, gc, 0, 0, width + shift, height + shift);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
437 XSetClipMask(dpy, gc, mask);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
438 XSetForeground(dpy, gc, eb->primitive.top_shadow_color);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
439 XSetClipOrigin(dpy, gc, 2 * shift, 2 * shift);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
440 XFillRectangle(dpy, ins_pix, gc, 2 * shift, 2 * shift, width, height);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
441 XSetForeground(dpy, gc, eb->primitive.bottom_shadow_color);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
442 XSetClipOrigin(dpy, gc, shift, shift);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
443 XFillRectangle(dpy, ins_pix, gc, 0, 0, width + shift, height + shift);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
444 XtReleaseGC((Widget) eb, gc);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
445
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
446 XpmFreeAttributes(&attr);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
447
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
448 eb->enhancedbutton.pixmap_depth = depth;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
449 eb->enhancedbutton.pixmap_width = width;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
450 eb->enhancedbutton.pixmap_height = height;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
451 eb->enhancedbutton.normal_pixmap = sen_pix;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
452 eb->enhancedbutton.highlight_pixmap = high_pix;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
453 eb->enhancedbutton.insensitive_pixmap = ins_pix;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
454 eb->enhancedbutton.armed_pixmap = arm_pix;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
455
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
456 eb->enhancedbutton.doing_setvalues = True;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
457 eb->enhancedbutton.doing_setvalues = False;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
458
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
459 XFreePixmap(dpy, pix);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
460 XFreePixmap(dpy, mask);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
461 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
462
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
463 #define BUTTON_MASK ( \
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
464 Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask \
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
465 )
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
466
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
467 static void
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
468 draw_shadows(XmEnhancedButtonWidget eb)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
469 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
470 GC top_gc;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
471 GC bottom_gc;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
472 Boolean etched_in;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
473
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
474 if (!eb->primitive.shadow_thickness)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
475 return;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
476
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
477 if ((eb->core.width <= 2 * eb->primitive.highlight_thickness)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
478 || (eb->core.height <= 2 * eb->primitive.highlight_thickness))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
479 return;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
480
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
481 #ifndef LESSTIF_VERSION
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
482 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
483 XmDisplay dpy;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
484
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
485 dpy = (XmDisplay) XmGetXmDisplay(XtDisplay(eb));
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
486 etched_in = dpy->display.enable_etched_in_menu;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
487 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
488 #else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
489 etched_in = False;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
490 #endif
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
491 if (!etched_in ^ eb->pushbutton.armed)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
492 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
493 top_gc = eb->primitive.top_shadow_GC;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
494 bottom_gc = eb->primitive.bottom_shadow_GC;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
495 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
496 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
497 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
498 top_gc = eb->primitive.bottom_shadow_GC;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
499 bottom_gc = eb->primitive.top_shadow_GC;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
500 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
501
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
502 XmeDrawShadows(XtDisplay(eb), XtWindow(eb),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
503 top_gc,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
504 bottom_gc,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
505 eb->primitive.highlight_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
506 eb->primitive.highlight_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
507 eb->core.width - 2 * eb->primitive.highlight_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
508 eb->core.height - 2 * eb->primitive.highlight_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
509 eb->primitive.shadow_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
510 (unsigned)(etched_in ? XmSHADOW_IN : XmSHADOW_OUT));
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
511 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
512
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
513 static void
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
514 draw_highlight(XmEnhancedButtonWidget eb)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
515 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
516 eb->primitive.highlighted = True;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
517 eb->primitive.highlight_drawn = True;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
518
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
519 if (!XtWidth(eb) || !XtHeight(eb) || !eb->primitive.highlight_thickness)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
520 return;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
521
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
522 XmeDrawHighlight(XtDisplay(eb), XtWindow(eb),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
523 eb->primitive.highlight_GC, 0, 0,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
524 XtWidth(eb), XtHeight(eb),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
525 eb->primitive.highlight_thickness);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
526 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
527
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
528 static void
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
529 draw_unhighlight(XmEnhancedButtonWidget eb)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
530 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
531 GC manager_background_GC;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
532
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
533 eb->primitive.highlighted = False;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
534 eb->primitive.highlight_drawn = False;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
535
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
536 if (!XtWidth(eb) || !XtHeight(eb) || !eb->primitive.highlight_thickness)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
537 return;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
538
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
539 if (XmIsManager(eb->core.parent))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
540 {
147
2f5a3b881ada updated for version 7.0046
vimboss
parents: 129
diff changeset
541 #ifdef UNHIGHLIGHTT
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
542 XmSpecifyUnhighlightTrait UnhighlightT;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
543
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
544 if (((UnhighlightT = (XmSpecifyUnhighlightTrait) XmeTraitGet((XtPointer)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
545 XtClass(eb->core.parent), XmQTspecifyUnhighlight))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
546 != NULL) && (UnhighlightT->getUnhighlightGC != NULL))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
547 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
548 /* if unhighlight trait in parent use specified GC... */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
549 manager_background_GC =
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
550 UnhighlightT->getUnhighlightGC(eb->core.parent, (Widget) eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
551 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
552 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
553 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
554 /* ...otherwise, use parent's background GC */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
555 manager_background_GC = ((XmManagerWidget)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
556 (eb->core.parent))->manager.background_GC;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
557 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
558 #else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
559 manager_background_GC = ((XmManagerWidget)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
560 (eb->core.parent))->manager.background_GC;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
561 #endif
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
562 XmeDrawHighlight(XtDisplay(eb), XtWindow(eb),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
563 manager_background_GC,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
564 0, 0, XtWidth(eb), XtHeight(eb),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
565 eb->primitive.highlight_thickness);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
566 if (!eb->pushbutton.armed && eb->primitive.shadow_thickness)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
567 XmeClearBorder(XtDisplay(eb), XtWindow(eb),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
568 eb->primitive.highlight_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
569 eb->primitive.highlight_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
570 eb->core.width - 2 * eb->primitive.highlight_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
571 eb->core.height - 2 * eb->primitive.highlight_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
572 eb->primitive.shadow_thickness);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
573 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
574 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
575 XmeClearBorder(XtDisplay(eb), XtWindow(eb), 0, 0, XtWidth(eb),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
576 XtHeight(eb), eb->primitive.highlight_thickness);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
577 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
578
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
579 /*ARGSUSED*/
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
580 static void
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
581 draw_pixmap(XmEnhancedButtonWidget eb, XEvent *event, Region region)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
582 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
583 Pixmap pix;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
584 GC gc = eb->label.normal_GC;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
585 int depth;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
586 Cardinal width;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
587 Cardinal height;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
588 Cardinal w;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
589 Cardinal h;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
590 int x;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
591 int y;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
592
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
593 if (!XtIsSensitive((Widget) eb))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
594 pix = eb->enhancedbutton.insensitive_pixmap;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
595 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
596 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
597 if (eb->primitive.highlighted && !eb->pushbutton.armed)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
598 pix = eb->enhancedbutton.highlight_pixmap;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
599 else if (eb->pushbutton.armed)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
600 pix = eb->enhancedbutton.armed_pixmap;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
601 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
602 pix = eb->enhancedbutton.normal_pixmap;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
603 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
604
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
605 if (pix == None || !eb->enhancedbutton.pixmap_data)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
606 return;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
607
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
608 depth = eb->enhancedbutton.pixmap_depth;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
609 w = eb->enhancedbutton.pixmap_width;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
610 h = eb->enhancedbutton.pixmap_height;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
611
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
612 gc = eb->label.normal_GC;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
613 x = eb->primitive.highlight_thickness
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
614 + eb->primitive.shadow_thickness
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
615 + eb->label.margin_width;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
616 y = eb->primitive.highlight_thickness
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
617 + eb->primitive.shadow_thickness
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
618 + eb->label.margin_height;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
619 width = eb->core.width - 2 * x;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
620 if (w < width)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
621 width = w;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
622 height = eb->core.height - 2 * y;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
623 if (h < height)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
624 height = h;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
625 if (depth == eb->core.depth)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
626 XCopyArea(XtDisplay(eb), pix, XtWindow(eb), gc, 0, 0,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
627 width, height, x, y);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
628 else if (depth == 1)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
629 XCopyPlane(XtDisplay(eb), pix, XtWindow(eb), gc, 0, 0,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
630 width, height, x, y, (unsigned long)1);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
631 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
632
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
633 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
634 * Draw the label contained in the pushbutton.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
635 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
636 static void
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
637 draw_label(XmEnhancedButtonWidget eb, XEvent *event, Region region)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
638 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
639 GC tmp_gc = NULL;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
640 Boolean replaceGC = False;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
641 Boolean deadjusted = False;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
642 #ifndef LESSTIF_VERSION
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
643 XmDisplay dpy = (XmDisplay)XmGetXmDisplay(XtDisplay(eb));
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
644 Boolean etched_in = dpy->display.enable_etched_in_menu;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
645 #else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
646 Boolean etched_in = False;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
647 #endif
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
648
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
649 if (eb->pushbutton.armed
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
650 && ((!Lab_IsMenupane(eb) && eb->pushbutton.fill_on_arm)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
651 || (Lab_IsMenupane(eb) && etched_in)))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
652 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
653 if (eb->label.label_type == (int)XmSTRING
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
654 && eb->pushbutton.arm_color == eb->primitive.foreground)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
655 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
656 tmp_gc = eb->label.normal_GC;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
657 eb->label.normal_GC = eb->pushbutton.background_gc;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
658 replaceGC = True;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
659 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
660 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
661
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
662 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
663 * If the button contains a labeled pixmap, we will take it instead of our
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
664 * own pixmap.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
665 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
666
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
667 if (eb->label.label_type == (int)XmPIXMAP)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
668 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
669 if (eb->pushbutton.armed)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
670 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
671 if (eb->pushbutton.arm_pixmap != XmUNSPECIFIED_PIXMAP)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
672 eb->label.pixmap = eb->pushbutton.arm_pixmap;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
673 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
674 eb->label.pixmap = eb->pushbutton.unarm_pixmap;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
675 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
676 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
677 /* pushbutton is not armed */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
678 eb->label.pixmap = eb->pushbutton.unarm_pixmap;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
679 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
680
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
681 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
682 * Temporarily remove the Xm3D_ENHANCE_PIXEL hack ("adjustment") from the
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
683 * margin values, so we don't confuse Label.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
684 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
685 if (eb->pushbutton.default_button_shadow_thickness > 0)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
686 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
687 deadjusted = True;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
688 Lab_MarginLeft(eb) -= Xm3D_ENHANCE_PIXEL;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
689 Lab_MarginRight(eb) -= Xm3D_ENHANCE_PIXEL;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
690 Lab_MarginTop(eb) -= Xm3D_ENHANCE_PIXEL;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
691 Lab_MarginBottom(eb) -= Xm3D_ENHANCE_PIXEL;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
692 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
693
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
694 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
695 XtExposeProc expose;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
696
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
697 XtProcessLock();
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
698 expose = xmLabelClassRec.core_class.expose;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
699 XtProcessUnlock();
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
700 (*expose)((Widget) eb, event, region);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
701 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
702
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
703 if (deadjusted)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
704 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
705 Lab_MarginLeft(eb) += Xm3D_ENHANCE_PIXEL;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
706 Lab_MarginRight(eb) += Xm3D_ENHANCE_PIXEL;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
707 Lab_MarginTop(eb) += Xm3D_ENHANCE_PIXEL;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
708 Lab_MarginBottom(eb) += Xm3D_ENHANCE_PIXEL;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
709 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
710
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
711 if (replaceGC)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
712 eb->label.normal_GC = tmp_gc;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
713 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
714
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
715 /*ARGSUSED*/
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
716 static void
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
717 Enter(Widget wid, XEvent *event, String *params, Cardinal *num_params)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
718 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
719 XmEnhancedButtonWidget eb = (XmEnhancedButtonWidget) wid;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
720 XmPushButtonCallbackStruct call_value;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
721
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
722 if (Lab_IsMenupane(eb))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
723 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
724 if ((((ShellWidget) XtParent(XtParent(eb)))->shell.popped_up)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
725 && _XmGetInDragMode((Widget) eb))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
726 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
727 #ifndef LESSTIF_VERSION
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
728 XmDisplay dpy = (XmDisplay) XmGetXmDisplay(XtDisplay(wid));
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
729 Boolean etched_in = dpy->display.enable_etched_in_menu;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
730 #else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
731 Boolean etched_in = False;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
732 #endif
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
733
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
734 if (eb->pushbutton.armed)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
735 return;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
736
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
737 /* ...so KHelp event is delivered correctly. */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
738 _XmSetFocusFlag(XtParent(XtParent(eb)), XmFOCUS_IGNORE, TRUE);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
739 XtSetKeyboardFocus(XtParent(XtParent(eb)), (Widget) eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
740 _XmSetFocusFlag(XtParent(XtParent(eb)), XmFOCUS_IGNORE, FALSE);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
741
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
742 eb->pushbutton.armed = TRUE;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
743
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
744 ((XmManagerWidget) XtParent(wid))->manager.active_child = wid;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
745
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
746 /* etched in menu button */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
747 if (etched_in && !XmIsTearOffButton(eb))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
748 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
749 XFillRectangle(XtDisplay(eb), XtWindow(eb),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
750 eb->pushbutton.fill_gc,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
751 0, 0, eb->core.width, eb->core.height);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
752 draw_label(eb, event, NULL);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
753 draw_pixmap(eb, event, NULL);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
754 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
755
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
756 if ((eb->core.width > 2 * eb->primitive.highlight_thickness)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
757 && (eb->core.height >
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
758 2 * eb->primitive.highlight_thickness))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
759 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
760 XmeDrawShadows(XtDisplay(eb), XtWindow(eb),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
761 eb->primitive.top_shadow_GC,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
762 eb->primitive.bottom_shadow_GC,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
763 eb->primitive.highlight_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
764 eb->primitive.highlight_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
765 eb->core.width - 2 * eb->primitive.highlight_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
766 eb->core.height - 2 * eb->primitive.highlight_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
767 eb->primitive.shadow_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
768 (unsigned)(etched_in ? XmSHADOW_IN : XmSHADOW_OUT));
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
769 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
770
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
771 if (eb->pushbutton.arm_callback)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
772 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
773 XFlush(XtDisplay(eb));
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
774
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
775 call_value.reason = (int)XmCR_ARM;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
776 call_value.event = event;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
777 XtCallCallbackList((Widget) eb,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
778 eb->pushbutton.arm_callback,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
779 &call_value);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
780 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
781 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
782 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
783 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
784 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
785 XtExposeProc expose;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
786
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
787 _XmPrimitiveEnter((Widget) eb, event, NULL, NULL);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
788 if (eb->pushbutton.armed == TRUE)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
789 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
790 XtProcessLock();
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
791 expose = XtClass(eb)->core_class.expose;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
792 XtProcessUnlock();
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
793 (*expose) (wid, event, (Region) NULL);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
794 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
795
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
796 draw_highlight(eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
797 draw_shadows(eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
798 draw_pixmap(eb, event, NULL);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
799 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
800 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
801
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
802 /*ARGSUSED*/
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
803 static void
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
804 Leave(Widget wid, XEvent *event, String *params, Cardinal *num_params)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
805 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
806 XmEnhancedButtonWidget eb = (XmEnhancedButtonWidget)wid;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
807 XmPushButtonCallbackStruct call_value;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
808
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
809 if (Lab_IsMenupane(eb))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
810 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
811 #ifndef LESSTIF_VERSION
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
812 XmDisplay dpy = (XmDisplay) XmGetXmDisplay(XtDisplay(wid));
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
813 Boolean etched_in = dpy->display.enable_etched_in_menu;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
814 #else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
815 Boolean etched_in = False;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
816 #endif
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
817
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
818 if (_XmGetInDragMode((Widget)eb)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
819 && eb->pushbutton.armed
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
820 && ( /* !ActiveTearOff || */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
821 event->xcrossing.mode == NotifyNormal))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
822 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
823 eb->pushbutton.armed = FALSE;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
824
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
825 ((XmManagerWidget) XtParent(wid))->manager.active_child = NULL;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
826
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
827 if (etched_in && !XmIsTearOffButton(eb))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
828 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
829 XFillRectangle(XtDisplay(eb), XtWindow(eb),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
830 eb->pushbutton.background_gc,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
831 0, 0, eb->core.width, eb->core.height);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
832 draw_label(eb, event, NULL);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
833 draw_pixmap(eb, event, NULL);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
834 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
835 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
836 XmeClearBorder
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
837 (XtDisplay(eb), XtWindow(eb),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
838 eb->primitive.highlight_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
839 eb->primitive.highlight_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
840 eb->core.width -
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
841 2 * eb->primitive.highlight_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
842 eb->core.height -
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
843 2 * eb->primitive.highlight_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
844 eb->primitive.shadow_thickness);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
845
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
846 if (eb->pushbutton.disarm_callback)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
847 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
848 XFlush(XtDisplay(eb));
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
849
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
850 call_value.reason = (int)XmCR_DISARM;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
851 call_value.event = event;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
852 XtCallCallbackList((Widget) eb,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
853 eb->pushbutton.disarm_callback,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
854 &call_value);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
855 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
856 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
857 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
858 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
859 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
860 _XmPrimitiveLeave((Widget) eb, event, NULL, NULL);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
861
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
862 if (eb->pushbutton.armed == TRUE)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
863 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
864 XtExposeProc expose;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
865 eb->pushbutton.armed = FALSE;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
866 XtProcessLock();
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
867 expose = XtClass(eb)->core_class.expose;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
868 XtProcessUnlock();
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
869 (*expose) (wid, event, (Region)NULL);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
870 draw_unhighlight(eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
871 draw_pixmap(eb, event, NULL);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
872 eb->pushbutton.armed = TRUE;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
873 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
874 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
875 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
876 draw_unhighlight(eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
877 draw_pixmap(eb, event, NULL);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
878 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
879 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
880 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
881
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
882 #define IsNull(p) ((p) == XmUNSPECIFIED_PIXMAP)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
883
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
884 static void
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
885 set_size(XmEnhancedButtonWidget newtb)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
886 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
887 unsigned int w = 0;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
888 unsigned int h = 0;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
889
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
890 _XmCalcLabelDimensions((Widget) newtb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
891
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
892 /* Find out how big the pixmap is */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
893 if (newtb->enhancedbutton.pixmap_data
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
894 && !IsNull(newtb->label.pixmap)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
895 && !IsNull(newtb->enhancedbutton.normal_pixmap))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
896 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
897 w = newtb->enhancedbutton.pixmap_width;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
898 h = newtb->enhancedbutton.pixmap_height;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
899 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
900
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
901 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
902 * Plase note that we manipulate the width only in case of push buttons not
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
903 * used in the context of a menu pane.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
904 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
905 if (Lab_IsMenupane(newtb))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
906 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
907 newtb->label.margin_left = w + 2 * (newtb->primitive.shadow_thickness
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
908 + newtb->primitive.highlight_thickness)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
909 + newtb->label.margin_width;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
910 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
911 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
912 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
913 newtb->label.margin_left = w;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
914 newtb->core.width = w + 2 * (newtb->primitive.shadow_thickness
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
915 + newtb->primitive.highlight_thickness
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
916 + newtb->label.margin_width)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
917 + newtb->label.TextRect.width;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
918
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
919 if (newtb->label.TextRect.width > 0)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
920 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
921 newtb->label.margin_left += newtb->label.margin_width
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
922 + newtb->primitive.shadow_thickness;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
923 newtb->core.width += newtb->label.margin_width
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
924 + newtb->primitive.shadow_thickness;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
925 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
926 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
927 if (newtb->label.TextRect.height < h)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
928 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
929 newtb->core.height = h + 2 * (newtb->primitive.shadow_thickness
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
930 + newtb->primitive.highlight_thickness
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
931 + newtb->label.margin_height);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
932 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
933 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
934 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
935 /* FIXME: We should calculate an drawing offset for the pixmap here to
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
936 * adjust it. */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
937 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
938
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
939 #if 0
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
940 printf("%d %d %d %d %d %d - %d %d\n", newtb->enhancedbutton.normal_pixmap,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
941 h, newtb->core.height,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
942 newtb->primitive.shadow_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
943 newtb->primitive.highlight_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
944 newtb->label.margin_height,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
945 newtb->core.width,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
946 newtb->core.height);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
947 #endif
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
948
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
949 /* Invoke Label's Resize procedure. */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
950 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
951 XtWidgetProc resize;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
952 XtProcessLock();
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
953 resize = xmLabelClassRec.core_class.resize;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
954 XtProcessUnlock();
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
955
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
956 (* resize) ((Widget) newtb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
957 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
958 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
959
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
960 /*ARGSUSED*/
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
961 static void
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
962 Initialize(Widget rq, Widget ebw, ArgList args, Cardinal *n)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
963 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
964 XmEnhancedButtonWidget request = (XmEnhancedButtonWidget)rq;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
965 XmEnhancedButtonWidget eb = (XmEnhancedButtonWidget)ebw;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
966 XtWidgetProc resize;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
967
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
968 XtProcessLock();
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
969 resize = xmLabelClassRec.core_class.resize;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
970 XtProcessUnlock();
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
971
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
972 /* Create a bitmap for stippling (Drawable resources are cheap). */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
973 if (STIPPLE_BITMAP == None)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
974 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
975 Display *dpy = XtDisplay((Widget) request);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
976 Window rootW = DefaultRootWindow(dpy);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
977
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
978 STIPPLE_BITMAP = XCreateBitmapFromData(dpy, rootW, stipple_bits,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
979 stipple_width, stipple_height);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
980 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
981 eb->enhancedbutton.doing_setvalues = False;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
982
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
983 /* First see what type of extended label this is.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
984 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
985 if (eb->enhancedbutton.pixmap_data)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
986 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
987 XmString str;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
988 set_pixmap(eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
989
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
990 /* FIXME: this is not the perfect way to deal with menues, which do not
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
991 * have any string set right now. */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
992 str = XmStringCreateLocalized("");
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
993 XtVaSetValues((Widget) eb, XmNlabelString, str, NULL);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
994 XmStringFree(str);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
995 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
996 eb->label.pixmap = eb->enhancedbutton.normal_pixmap;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
997
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
998 if (request->core.width == 0)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
999 eb->core.width = 0;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1000 if (request->core.height == 0)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1001 eb->core.height = 0;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1002 set_size(eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1003
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1004 (* resize)((Widget)eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1005 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1006
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1007 static void
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1008 free_pixmaps(XmEnhancedButtonWidget eb)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1009 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1010 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1011 * Clear the old pixmaps.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1012 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1013 Pixmap norm_pix = eb->enhancedbutton.normal_pixmap;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1014 Pixmap arm_pix = eb->enhancedbutton.armed_pixmap;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1015 Pixmap insen_pix = eb->enhancedbutton.insensitive_pixmap;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1016 Pixmap high_pix = eb->enhancedbutton.highlight_pixmap;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1017
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1018 if (norm_pix != None && norm_pix != XmUNSPECIFIED_PIXMAP)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1019 XFreePixmap(XtDisplay(eb), norm_pix);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1020
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1021 if (arm_pix != None && arm_pix != XmUNSPECIFIED_PIXMAP)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1022 XFreePixmap(XtDisplay(eb), arm_pix);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1023
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1024 if (insen_pix != None && insen_pix != XmUNSPECIFIED_PIXMAP)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1025 XFreePixmap(XtDisplay(eb), insen_pix);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1026
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1027 if (high_pix != None && high_pix != XmUNSPECIFIED_PIXMAP)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1028 XFreePixmap(XtDisplay(eb), high_pix);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1029 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1030
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1031 static void
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1032 Destroy(Widget w)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1033 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1034 if (!XmIsEnhancedButton(w))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1035 return;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1036
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1037 free_pixmaps((XmEnhancedButtonWidget)w);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1038 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1039
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1040 /*ARGSUSED*/
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1041 static Boolean
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1042 SetValues(Widget current, Widget request, Widget new, ArgList args, Cardinal *n)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1043 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1044 XmEnhancedButtonWidget cur = (XmEnhancedButtonWidget) current;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1045 XmEnhancedButtonWidget eb = (XmEnhancedButtonWidget) new;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1046 Boolean redraw = False;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1047 Boolean change = True;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1048 Display *dpy = XtDisplay(current);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1049
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1050 #define NOT_EQUAL(field) (cur->field != eb->field)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1051
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1052 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1053 * Make sure that lost sensitivity is causing the border to vanish as well.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1054 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1055 if (NOT_EQUAL(core.sensitive) && !Lab_IsMenupane(current))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1056 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1057 if (cur->core.sensitive == True)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1058 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1059 draw_unhighlight(eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1060 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1061 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1062 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1063 int r_x;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1064 int r_y;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1065 unsigned int r_height;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1066 unsigned int r_width;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1067 unsigned int r_border;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1068 unsigned int r_depth;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1069 int root_x;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1070 int root_y;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1071 int win_x;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1072 int win_y;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1073 Window root;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1074 Window root_q;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1075 Window child;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1076 unsigned int mask;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1077
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1078 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1079 * Aritificially let the highlight appear if the mouse is over us.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1080 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1081 /* Best way to get the root window of object: */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1082 XGetGeometry(dpy, XtWindow(cur), &root, &r_x, &r_y, &r_width,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1083 &r_height, &r_border, &r_depth);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1084 XQueryPointer(XtDisplay(cur), XtWindow(cur), &root_q, &child,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1085 &root_x, &root_y, &win_x, &win_y, &mask);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1086
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1087 if (root == root_q)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1088 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1089 if ((win_x < 0) || (win_y < 0))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1090 return False;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1091
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1092 if ((win_x > r_width) || (win_y > r_height))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1093 return False;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1094 draw_highlight(eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1095 draw_shadows(eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1096 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1097 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1098
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1099 return True;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1100 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1101
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1102 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1103 * Check for changed ExtLabelString.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1104 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1105 if (NOT_EQUAL(primitive.shadow_thickness))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1106 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1107 redraw = True;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1108 /* Don't change the pixmaps */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1109 change = False;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1110 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1111
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1112 if (NOT_EQUAL(primitive.foreground))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1113 redraw = True;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1114 if (NOT_EQUAL(core.background_pixel))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1115 redraw = True;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1116 if (NOT_EQUAL(pushbutton.fill_on_arm))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1117 redraw = True;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1118 if (NOT_EQUAL(enhancedbutton.spacing))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1119 redraw = True;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1120 if (NOT_EQUAL(enhancedbutton.label_location))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1121 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1122 redraw = True;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1123 change = False;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1124 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1125 if (NOT_EQUAL(label._label))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1126 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1127 redraw = True;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1128 set_size(eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1129 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1130
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1131 if (redraw == True)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1132 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1133 if (change)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1134 set_pixmap(eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1135 if (eb->primitive.highlighted)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1136 eb->label.pixmap = eb->enhancedbutton.highlight_pixmap;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1137 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1138 eb->label.pixmap = eb->enhancedbutton.normal_pixmap;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1139 if (change)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1140 set_size(eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1141 redraw = False;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1142 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1143
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1144 return redraw;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1145 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1146
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1147 static void
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1148 Redisplay(Widget w, XEvent *event, Region region)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1149 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1150 XmEnhancedButtonWidget eb = (XmEnhancedButtonWidget) w;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1151 #ifndef LESSTIF_VERSION
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1152 XmDisplay dpy;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1153 XtEnum default_button_emphasis;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1154 #endif
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1155 XRectangle box;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1156 int dx;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1157 int adjust;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1158 short fill = 0;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1159
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1160 if (!XtIsRealized((Widget)eb))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1161 return;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1162
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1163 #ifndef LESSTIF_VERSION
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1164 dpy = (XmDisplay)XmGetXmDisplay(XtDisplay(eb));
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1165 default_button_emphasis = dpy->display.default_button_emphasis;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1166 #endif
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1167
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1168 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1169 * Compute the area allocated to the label of the pushbutton; fill in the
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1170 * dimensions in the box.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1171 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1172
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1173 if ((eb->pushbutton.arm_color == eb->primitive.top_shadow_color)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1174 || (eb->pushbutton.arm_color == eb->primitive.bottom_shadow_color))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1175 fill = 1;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1176
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1177 if (eb->pushbutton.compatible)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1178 adjust = eb->pushbutton.show_as_default;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1179 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1180 adjust = eb->pushbutton.default_button_shadow_thickness;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1181
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1182 if (adjust > 0)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1183 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1184 adjust = adjust + eb->primitive.shadow_thickness;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1185 adjust = (adjust << 1);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1186 dx = eb->primitive.highlight_thickness + adjust + fill;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1187 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1188 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1189 dx = (eb->primitive.highlight_thickness
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1190 + eb->primitive.shadow_thickness + fill);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1191
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1192 box.x = dx;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1193 box.y = dx;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1194 adjust = (dx << 1);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1195 box.width = eb->core.width - adjust;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1196 box.height = eb->core.height - adjust;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1197
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1198 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1199 * Redraw the background.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1200 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1201 if (!Lab_IsMenupane(eb))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1202 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1203 GC gc;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1204
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1205 /* Don't shade if the button contains a label with a pixmap, since
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1206 * there is no variant of the label available with the needed
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1207 * background.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1208 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1209 if (eb->pushbutton.armed && eb->pushbutton.fill_on_arm)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1210 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1211 if (eb->label.label_type == (int)XmPIXMAP)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1212 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1213 if (eb->pushbutton.arm_pixmap != XmUNSPECIFIED_PIXMAP)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1214 gc = eb->pushbutton.fill_gc;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1215 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1216 gc = eb->pushbutton.background_gc;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1217 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1218 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1219 gc = eb->pushbutton.fill_gc;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1220 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1221 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1222 gc = eb->pushbutton.background_gc;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1223 /* really need to fill with background if not armed ? */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1224 if (gc)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1225 XFillRectangle(XtDisplay(eb), XtWindow(eb), gc,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1226 box.x, box.y, box.width, box.height);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1227 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1228
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1229 draw_label(eb, event, region);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1230
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1231 if (Lab_IsMenupane(eb))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1232 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1233 if (eb->pushbutton.armed)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1234 (*(((XmPushButtonWidgetClass)XtClass(eb))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1235 ->primitive_class.border_highlight))(w);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1236 draw_pixmap(eb, event, region);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1237 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1238 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1239 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1240 int adjust = 0;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1241
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1242 #ifndef LESSTIF_VERSION
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1243 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1244 * NOTE: PushButton has two types of shadows: primitive-shadow and
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1245 * default-button-shadow. If pushbutton is in a menu only primitive
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1246 * shadows are drawn.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1247 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1248 switch (default_button_emphasis)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1249 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1250 case XmEXTERNAL_HIGHLIGHT:
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1251 adjust = (eb->primitive.highlight_thickness -
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1252 (eb->pushbutton.default_button_shadow_thickness ?
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1253 Xm3D_ENHANCE_PIXEL : 0));
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1254 break;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1255
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1256 case XmINTERNAL_HIGHLIGHT:
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1257 adjust = 0;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1258 break;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1259
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1260 default:
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1261 assert(FALSE);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1262 return;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1263 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1264 #endif
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1265
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1266 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1267 * Clear the area not occupied by label with parents background color.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1268 * Label will invoke BorderUnhighlight() on the highlight_thickness
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1269 * area, which is redundant when XmEXTERNAL_HIGHLIGHT default button
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1270 * shadow emphasis is used.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1271 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1272 if (box.x > adjust)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1273 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1274 int borderwidth =box.x - adjust;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1275 int rectwidth = eb->core.width - 2 * adjust;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1276 int rectheight = eb->core.height - 2 * adjust;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1277
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1278 if (XmIsManager(XtParent(eb)))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1279 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1280 XmeDrawHighlight(XtDisplay(eb), XtWindow(eb),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1281 XmParentBackgroundGC(eb),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1282 adjust, adjust, rectwidth, rectheight, borderwidth);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1283 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1284 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1285 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1286 XmeClearBorder(XtDisplay(eb), XtWindow(eb),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1287 adjust, adjust, rectwidth, rectheight, borderwidth);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1288 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1289
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1290 #ifndef LESSTIF_VERSION
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1291 switch (default_button_emphasis)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1292 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1293 case XmINTERNAL_HIGHLIGHT:
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1294 /* The call above erases the border highlighting. */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1295 if (eb->primitive.highlight_drawn)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1296 (*(((XmPushButtonWidgetClass) XtClass (eb))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1297 ->primitive_class.border_highlight)) ((Widget) eb) ;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1298 break;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1299
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1300 default:
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1301 break;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1302 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1303 #endif
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1304 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1305
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1306 if (eb->pushbutton.default_button_shadow_thickness)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1307 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1308 if (eb->pushbutton.show_as_default)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1309 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1310 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1311 * - get the topShadowColor and bottomShadowColor from the
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1312 * parent; use those colors to construct top and bottom gc;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1313 * use these GCs to draw the shadows of the button.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1314 *
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1315 * - Should not be called if pushbutton is in a row column or
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1316 * in a menu.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1317 *
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1318 * - Should be called only if a defaultbuttonshadow is to be
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1319 * drawn.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1320 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1321 GC top_gc;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1322 GC bottom_gc;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1323 int default_button_shadow_thickness;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1324 int x, y, width, height, delta;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1325 Widget parent;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1326
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1327 if (eb->pushbutton.compatible
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1328 && (eb->pushbutton.show_as_default == 0))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1329 return;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1330
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1331 if (!eb->pushbutton.compatible
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1332 && (eb->pushbutton.default_button_shadow_thickness
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1333 == 0))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1334 return;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1335
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1336 delta = eb->primitive.highlight_thickness;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1337
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1338 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1339 * May need more complex computation for getting the GCs.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1340 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1341 parent = XtParent(eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1342 if (XmIsManager(parent))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1343 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1344 /* Use the parent's GC so monochrome works. */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1345 bottom_gc = XmParentTopShadowGC(eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1346 top_gc = XmParentBottomShadowGC(eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1347 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1348 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1349 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1350 /* Use your own pixel for drawing. */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1351 bottom_gc = eb->primitive.top_shadow_GC;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1352 top_gc = eb->primitive.bottom_shadow_GC;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1353 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1354
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1355 if ((bottom_gc == None) || (top_gc == None))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1356 return;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1357
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1358
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1359 if (eb->pushbutton.compatible)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1360 default_button_shadow_thickness =
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1361 eb->pushbutton.show_as_default;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1362 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1363 default_button_shadow_thickness =
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1364 eb->pushbutton.default_button_shadow_thickness;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1365
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1366 #ifndef LESSTIF_VERSION
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1367 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1368 * Compute location of bounding box to contain the
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1369 * defaultButtonShadow.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1370 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1371 switch (default_button_emphasis)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1372 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1373 case XmEXTERNAL_HIGHLIGHT:
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1374 delta = eb->primitive.highlight_thickness;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1375 break;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1376
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1377 case XmINTERNAL_HIGHLIGHT:
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1378 delta = Xm3D_ENHANCE_PIXEL;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1379 break;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1380
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1381 default:
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1382 assert(FALSE);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1383 return;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1384 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1385 #endif
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1386
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1387 x = y = delta;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1388 width = eb->core.width - 2 * delta;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1389 height = eb->core.height - 2 * delta;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1390
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1391 if ((width > 0) && (height > 0))
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1392 XmeDrawShadows(XtDisplay(eb), XtWindow(eb),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1393 top_gc, bottom_gc, x, y, width, height,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1394 default_button_shadow_thickness,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1395 (unsigned)XmSHADOW_OUT);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1396 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1397 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1398
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1399 if (eb->primitive.highlight_drawn)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1400 draw_shadows(eb);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1401 draw_pixmap(eb, event, region);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1402 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1403 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1404
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1405 static void
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1406 BorderHighlight(Widget w)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1407 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1408 XmEnhancedButtonWidget eb = (XmEnhancedButtonWidget)w;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1409
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1410 (*(xmPushButtonClassRec.primitive_class.border_highlight))(w);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1411 draw_pixmap(eb, NULL, NULL);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1412 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1413
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1414 static void
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1415 BorderUnhighlight(Widget w)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1416 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1417 XmEnhancedButtonWidget eb = (XmEnhancedButtonWidget)w;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1418
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1419 (*(xmPushButtonClassRec.primitive_class.border_unhighlight))(w);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1420 draw_pixmap(eb, NULL, NULL);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents:
diff changeset
1421 }
158
78423945b251 updated for version 7.0048
vimboss
parents: 147
diff changeset
1422
78423945b251 updated for version 7.0048
vimboss
parents: 147
diff changeset
1423 #endif /* FEAT_TOOLBAR */