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