annotate src/gui_xmebw.c @ 24799:7aa2abb13864

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