]> git.saurik.com Git - wxWidgets.git/blame - src/motif/utils.cpp
Added missing includes
[wxWidgets.git] / src / motif / utils.cpp
CommitLineData
4bb6408c 1/////////////////////////////////////////////////////////////////////////////
355b4d3d 2// Name: src/motif/utils.cpp
4bb6408c
JS
3// Purpose: Various utilities
4// Author: Julian Smart
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
4bb6408c
JS
10/////////////////////////////////////////////////////////////////////////////
11
518b5d2f
VZ
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
4bb6408c 19
1248b41f
MB
20// For compilers that support precompilation, includes "wx.h".
21#include "wx/wxprec.h"
22
bcd055ae
JJ
23#ifdef __VMS
24#define XtDisplay XTDISPLAY
2b5f62a0 25#endif
1248b41f 26
2b5f62a0 27#include "wx/utils.h"
670f9935
WS
28
29#ifndef WX_PRECOMP
30 #include "wx/app.h"
f38924e8 31 #include "wx/dcmemory.h"
0bca0373 32 #include "wx/bitmap.h"
670f9935
WS
33#endif
34
d48568a5 35#include "wx/apptrait.h"
eb6fa4b4 36#include "wx/evtloop.h"
c2ca375c 37#include "wx/motif/private/timer.h"
2b5f62a0 38
2b5f62a0 39#include <string.h>
2b5f62a0
VZ
40
41#if (defined(__SUNCC__) || defined(__CLCC__))
42 #include <sysent.h>
43#endif
44
45#ifdef __VMS__
46#pragma message disable nosimpint
47#endif
48
49#include "wx/unix/execute.h"
50
2b5f62a0 51#include <Xm/Xm.h>
6769d0cb
MB
52#include <Xm/Frame.h>
53
2b5f62a0 54#include "wx/motif/private.h"
2b5f62a0 55
2b5f62a0
VZ
56#include "X11/Xutil.h"
57
58#ifdef __VMS__
59#pragma message enable nosimpint
60#endif
61
2b5f62a0
VZ
62
63// ============================================================================
64// implementation
65// ============================================================================
66
67// ----------------------------------------------------------------------------
68// async event processing
69// ----------------------------------------------------------------------------
70
71// Consume all events until no more left
eb6fa4b4 72void wxFlushEvents(WXDisplay* wxdisplay)
2b5f62a0 73{
eb6fa4b4
MB
74 Display *display = (Display*)wxdisplay;
75 wxEventLoop evtLoop;
2b5f62a0 76
96be256b 77 XSync (display, False);
2b5f62a0 78
eb6fa4b4 79 while (evtLoop.Pending())
2b5f62a0 80 {
eb6fa4b4
MB
81 XFlush (display);
82 evtLoop.Dispatch();
2b5f62a0 83 }
2b5f62a0
VZ
84}
85
2b5f62a0
VZ
86// ----------------------------------------------------------------------------
87// wxExecute stuff
88// ----------------------------------------------------------------------------
b229c8a9 89
2b5f62a0
VZ
90static void xt_notify_end_process(XtPointer data, int *WXUNUSED(fid),
91 XtInputId *id)
92{
93 wxEndProcessData *proc_data = (wxEndProcessData *)data;
94
95 wxHandleProcessTermination(proc_data);
96
97 // VZ: I think they should be the same...
98 wxASSERT( (int)*id == proc_data->tag );
99
100 XtRemoveInput(*id);
101}
2b5f62a0
VZ
102
103int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
104{
2b5f62a0
VZ
105 XtInputId id = XtAppAddInput((XtAppContext) wxTheApp->GetAppContext(),
106 fd,
107 (XtPointer *) XtInputReadMask,
108 (XtInputCallbackProc) xt_notify_end_process,
109 (XtPointer) proc_data);
bcd055ae 110
2b5f62a0 111 return (int)id;
2b5f62a0
VZ
112}
113
114// ----------------------------------------------------------------------------
115// misc
116// ----------------------------------------------------------------------------
117
118// Emit a beeeeeep
189d1ae7
SN
119#ifndef __EMX__
120// on OS/2, we use the wxBell from wxBase library (src/os2/utils.cpp)
2b5f62a0
VZ
121void wxBell()
122{
123 // Use current setting for the bell
eb6fa4b4 124 XBell (wxGlobalDisplay(), 0);
2b5f62a0 125}
189d1ae7 126#endif
2b5f62a0 127
8bb6b2c0 128wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
2b5f62a0 129{
8bb6b2c0
VZ
130 // XmVERSION and XmREVISION are defined in Xm/Xm.h
131 if ( verMaj )
132 *verMaj = XmVERSION;
133 if ( verMin )
134 *verMin = XmREVISION;
f9788a11 135
8bb6b2c0 136 return wxPORT_MOTIF;
2b5f62a0
VZ
137}
138
2ddff00c 139wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
b46b1d59
VZ
140{
141 return new wxEventLoop;
142}
143
c2ca375c
VZ
144wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer* timer)
145{
146 return new wxMotifTimerImpl(timer);
147}
148
2b5f62a0
VZ
149// ----------------------------------------------------------------------------
150// display info
151// ----------------------------------------------------------------------------
152
153void wxGetMousePosition( int* x, int* y )
154{
155#if wxUSE_NANOX
156 // TODO
157 *x = 0;
158 *y = 0;
159#else
160 XMotionEvent xev;
161 Window root, child;
eb6fa4b4
MB
162 XQueryPointer(wxGlobalDisplay(),
163 DefaultRootWindow(wxGlobalDisplay()),
2b5f62a0
VZ
164 &root, &child,
165 &(xev.x_root), &(xev.y_root),
166 &(xev.x), &(xev.y),
167 &(xev.state));
168 *x = xev.x_root;
169 *y = xev.y_root;
170#endif
e933b5bc 171}
2b5f62a0 172
ea76a6a5 173// Return true if we have a colour display
2b5f62a0
VZ
174bool wxColourDisplay()
175{
176 return wxDisplayDepth() > 1;
177}
178
179// Returns depth of screen
180int wxDisplayDepth()
181{
eb6fa4b4 182 Display *dpy = wxGlobalDisplay();
2b5f62a0
VZ
183
184 return DefaultDepth (dpy, DefaultScreen (dpy));
185}
186
187// Get size of display
188void wxDisplaySize(int *width, int *height)
189{
eb6fa4b4 190 Display *dpy = wxGlobalDisplay();
2b5f62a0
VZ
191
192 if ( width )
193 *width = DisplayWidth (dpy, DefaultScreen (dpy));
194 if ( height )
195 *height = DisplayHeight (dpy, DefaultScreen (dpy));
196}
197
198void wxDisplaySizeMM(int *width, int *height)
199{
eb6fa4b4 200 Display *dpy = wxGlobalDisplay();
2b5f62a0
VZ
201
202 if ( width )
203 *width = DisplayWidthMM(dpy, DefaultScreen (dpy));
204 if ( height )
205 *height = DisplayHeightMM(dpy, DefaultScreen (dpy));
206}
207
2b5f62a0
VZ
208// Configurable display in wxX11 and wxMotif
209static WXDisplay *gs_currentDisplay = NULL;
210static wxString gs_displayName;
211
212WXDisplay *wxGetDisplay()
213{
214 if (gs_currentDisplay)
215 return gs_currentDisplay;
2b5f62a0
VZ
216 else if (wxTheApp)
217 return wxTheApp->GetInitialDisplay();
218 return NULL;
2b5f62a0
VZ
219}
220
221bool wxSetDisplay(const wxString& display_name)
222{
223 gs_displayName = display_name;
224
ea76a6a5 225 if ( display_name.empty() )
2b5f62a0
VZ
226 {
227 gs_currentDisplay = NULL;
228
ea76a6a5 229 return true;
2b5f62a0
VZ
230 }
231 else
232 {
2b5f62a0
VZ
233 Cardinal argc = 0;
234
235 Display *display = XtOpenDisplay((XtAppContext) wxTheApp->GetAppContext(),
3e2d47e1
MB
236 display_name.c_str(),
237 wxTheApp->GetAppName().c_str(),
238 wxTheApp->GetClassName().c_str(),
2b5f62a0
VZ
239 NULL,
240#if XtSpecificationRelease < 5
241 0, &argc,
242#else
243 0, (int *)&argc,
244#endif
245 NULL);
246
247 if (display)
248 {
249 gs_currentDisplay = (WXDisplay*) display;
ea76a6a5 250 return true;
2b5f62a0
VZ
251 }
252 else
96be256b 253 return false;
2b5f62a0
VZ
254 }
255}
256
257wxString wxGetDisplayName()
258{
259 return gs_displayName;
260}
261
262wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
263{
264 return wxGenericFindWindowAtPoint(pt);
265}
266
2b5f62a0
VZ
267// ----------------------------------------------------------------------------
268// Some colour manipulation routines
269// ----------------------------------------------------------------------------
270
271void wxHSVToXColor(wxHSV *hsv,XColor *rgb)
272{
273 int h = hsv->h;
274 int s = hsv->s;
275 int v = hsv->v;
276 int r = 0, g = 0, b = 0;
277 int i, f;
278 int p, q, t;
279 s = (s * wxMAX_RGB) / wxMAX_SV;
280 v = (v * wxMAX_RGB) / wxMAX_SV;
281 if (h == 360) h = 0;
282 if (s == 0) { h = 0; r = g = b = v; }
283 i = h / 60;
284 f = h % 60;
285 p = v * (wxMAX_RGB - s) / wxMAX_RGB;
286 q = v * (wxMAX_RGB - s * f / 60) / wxMAX_RGB;
287 t = v * (wxMAX_RGB - s * (60 - f) / 60) / wxMAX_RGB;
288 switch (i)
289 {
290 case 0: r = v, g = t, b = p; break;
291 case 1: r = q, g = v, b = p; break;
292 case 2: r = p, g = v, b = t; break;
293 case 3: r = p, g = q, b = v; break;
294 case 4: r = t, g = p, b = v; break;
295 case 5: r = v, g = p, b = q; break;
296 }
355b4d3d
WS
297 rgb->red = (unsigned short)(r << 8);
298 rgb->green = (unsigned short)(g << 8);
299 rgb->blue = (unsigned short)(b << 8);
2b5f62a0
VZ
300}
301
302void wxXColorToHSV(wxHSV *hsv,XColor *rgb)
303{
304 int r = rgb->red >> 8;
305 int g = rgb->green >> 8;
306 int b = rgb->blue >> 8;
307 int maxv = wxMax3(r, g, b);
308 int minv = wxMin3(r, g, b);
309 int h = 0, s, v;
310 v = maxv;
311 if (maxv) s = (maxv - minv) * wxMAX_RGB / maxv;
312 else s = 0;
313 if (s == 0) h = 0;
314 else
315 {
316 int rc, gc, bc, hex = 0;
317 rc = (maxv - r) * wxMAX_RGB / (maxv - minv);
318 gc = (maxv - g) * wxMAX_RGB / (maxv - minv);
319 bc = (maxv - b) * wxMAX_RGB / (maxv - minv);
320 if (r == maxv) { h = bc - gc, hex = 0; }
321 else if (g == maxv) { h = rc - bc, hex = 2; }
322 else if (b == maxv) { h = gc - rc, hex = 4; }
323 h = hex * 60 + (h * 60 / wxMAX_RGB);
324 if (h < 0) h += 360;
325 }
326 hsv->h = h;
327 hsv->s = (s * wxMAX_SV) / wxMAX_RGB;
328 hsv->v = (v * wxMAX_SV) / wxMAX_RGB;
329}
330
331void wxAllocNearestColor(Display *d,Colormap cmp,XColor *xc)
332{
333#if !wxUSE_NANOX
334 int llp;
335
336 int screen = DefaultScreen(d);
337 int num_colors = DisplayCells(d,screen);
338
339 XColor *color_defs = new XColor[num_colors];
340 for(llp = 0;llp < num_colors;llp++) color_defs[llp].pixel = llp;
341 XQueryColors(d,cmp,color_defs,num_colors);
342
343 wxHSV hsv_defs, hsv;
344 wxXColorToHSV(&hsv,xc);
345
346 int diff, min_diff = 0, pixel = 0;
347
348 for(llp = 0;llp < num_colors;llp++)
349 {
350 wxXColorToHSV(&hsv_defs,&color_defs[llp]);
351 diff = wxSIGN(wxH_WEIGHT * (hsv.h - hsv_defs.h)) +
352 wxSIGN(wxS_WEIGHT * (hsv.s - hsv_defs.s)) +
353 wxSIGN(wxV_WEIGHT * (hsv.v - hsv_defs.v));
354 if (llp == 0) min_diff = diff;
355 if (min_diff > diff) { min_diff = diff; pixel = llp; }
356 if (min_diff == 0) break;
357 }
358
359 xc -> red = color_defs[pixel].red;
360 xc -> green = color_defs[pixel].green;
361 xc -> blue = color_defs[pixel].blue;
362 xc -> flags = DoRed | DoGreen | DoBlue;
363
364/* FIXME, TODO
365 if (!XAllocColor(d,cmp,xc))
366 cout << "wxAllocNearestColor : Warning : Cannot find nearest color !\n";
367*/
368
369 delete[] color_defs;
370#endif
371}
372
373void wxAllocColor(Display *d,Colormap cmp,XColor *xc)
374{
375 if (!XAllocColor(d,cmp,xc))
376 {
377 // cout << "wxAllocColor : Warning : Can not allocate color, attempt find nearest !\n";
378 wxAllocNearestColor(d,cmp,xc);
379 }
380}
381
382#ifdef __WXDEBUG__
383wxString wxGetXEventName(XEvent& event)
384{
385#if wxUSE_NANOX
386 wxString str(wxT("(some event)"));
387 return str;
388#else
389 int type = event.xany.type;
ea76a6a5 390 static char* event_name[] = {
f1db433a
VZ
391 wxMOTIF_STR(""), wxMOTIF_STR("unknown(-)"), // 0-1
392 wxMOTIF_STR("KeyPress"), wxMOTIF_STR("KeyRelease"), wxMOTIF_STR("ButtonPress"), wxMOTIF_STR("ButtonRelease"), // 2-5
393 wxMOTIF_STR("MotionNotify"), wxMOTIF_STR("EnterNotify"), wxMOTIF_STR("LeaveNotify"), wxMOTIF_STR("FocusIn"), // 6-9
394 wxMOTIF_STR("FocusOut"), wxMOTIF_STR("KeymapNotify"), wxMOTIF_STR("Expose"), wxMOTIF_STR("GraphicsExpose"), // 10-13
395 wxMOTIF_STR("NoExpose"), wxMOTIF_STR("VisibilityNotify"), wxMOTIF_STR("CreateNotify"), // 14-16
396 wxMOTIF_STR("DestroyNotify"), wxMOTIF_STR("UnmapNotify"), wxMOTIF_STR("MapNotify"), wxMOTIF_STR("MapRequest"),// 17-20
397 wxMOTIF_STR("ReparentNotify"), wxMOTIF_STR("ConfigureNotify"), wxMOTIF_STR("ConfigureRequest"), // 21-23
398 wxMOTIF_STR("GravityNotify"), wxMOTIF_STR("ResizeRequest"), wxMOTIF_STR("CirculateNotify"), // 24-26
399 wxMOTIF_STR("CirculateRequest"), wxMOTIF_STR("PropertyNotify"), wxMOTIF_STR("SelectionClear"), // 27-29
400 wxMOTIF_STR("SelectionRequest"), wxMOTIF_STR("SelectionNotify"), wxMOTIF_STR("ColormapNotify"), // 30-32
401 wxMOTIF_STR("ClientMessage"), wxMOTIF_STR("MappingNotify"), // 33-34
402 wxMOTIF_STR("unknown(+)")}; // 35
ea76a6a5
WS
403 type = wxMin(35, type); type = wxMax(1, type);
404 wxString str(event_name[type]);
405 return str;
2b5f62a0
VZ
406#endif
407}
408#endif
409
2b5f62a0
VZ
410// ----------------------------------------------------------------------------
411// accelerators
412// ----------------------------------------------------------------------------
413
414// Find the letter corresponding to the mnemonic, for Motif
415char wxFindMnemonic (const char *s)
416{
417 char mnem = 0;
418 int len = strlen (s);
419 int i;
eb6fa4b4 420
2b5f62a0
VZ
421 for (i = 0; i < len; i++)
422 {
423 if (s[i] == '&')
424 {
425 // Carefully handle &&
426 if ((i + 1) <= len && s[i + 1] == '&')
427 i++;
428 else
429 {
430 mnem = s[i + 1];
431 break;
432 }
433 }
434 }
435 return mnem;
436}
437
eb6fa4b4 438char* wxFindAccelerator( const char *s )
2b5f62a0 439{
eb6fa4b4 440#if 1
355b4d3d 441 wxUnusedVar(s);
2b5f62a0
VZ
442 // VZ: this function returns incorrect keysym which completely breaks kbd
443 // handling
444 return NULL;
eb6fa4b4
MB
445#else
446 // The accelerator text is after the \t char.
447 s = strchr( s, '\t' );
448
449 if( !s ) return NULL;
2b5f62a0 450
2b5f62a0
VZ
451 /*
452 Now we need to format it as X standard:
453
454 input output
455
456 F7 --> <Key>F7
457 Ctrl+N --> Ctrl<Key>N
458 Alt+k --> Meta<Key>k
459 Ctrl+Shift+A --> Ctrl Shift<Key>A
460
eb6fa4b4 461 and handle Ctrl-N & similia
2b5f62a0
VZ
462 */
463
464 static char buf[256];
eb6fa4b4 465
2b5f62a0 466 buf[0] = '\0';
eb6fa4b4
MB
467 wxString tmp = s + 1; // skip TAB
468 size_t index = 0;
2b5f62a0 469
eb6fa4b4 470 while( index < tmp.length() )
2b5f62a0 471 {
eb6fa4b4
MB
472 size_t plus = tmp.find( '+', index );
473 size_t minus = tmp.find( '-', index );
474
475 // neither '+' nor '-', add <Key>
476 if( plus == wxString::npos && minus == wxString::npos )
2b5f62a0 477 {
eb6fa4b4
MB
478 strcat( buf, "<Key>" );
479 strcat( buf, tmp.c_str() + index );
480
481 return buf;
2b5f62a0 482 }
eb6fa4b4
MB
483
484 // OK: npos is big and positive
485 size_t sep = wxMin( plus, minus );
486 wxString mod = tmp.substr( index, sep - index );
487
488 // Ctrl -> Ctrl
489 // Shift -> Shift
490 // Alt -> Meta
491 if( mod == "Alt" )
492 mod = "Meta";
493
494 if( buf[0] )
495 strcat( buf, " " );
496
497 strcat( buf, mod.c_str() );
498
499 index = sep + 1;
2b5f62a0 500 }
eb6fa4b4
MB
501
502 return NULL;
2b5f62a0
VZ
503#endif
504}
505
506XmString wxFindAcceleratorText (const char *s)
507{
eb6fa4b4 508#if 1
355b4d3d 509 wxUnusedVar(s);
2b5f62a0
VZ
510 // VZ: this function returns incorrect keysym which completely breaks kbd
511 // handling
512 return NULL;
eb6fa4b4
MB
513#else
514 // The accelerator text is after the \t char.
515 s = strchr( s, '\t' );
2b5f62a0 516
eb6fa4b4
MB
517 if( !s ) return NULL;
518
519 return wxStringToXmString( s + 1 ); // skip TAB!
2b5f62a0
VZ
520#endif
521}
522
2b5f62a0 523// Change a widget's foreground and background colours.
2b5f62a0
VZ
524void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour)
525{
105fbe1f
MB
526 if (!foregroundColour.Ok())
527 return;
528
2b5f62a0
VZ
529 // When should we specify the foreground, if it's calculated
530 // by wxComputeColours?
531 // Solution: say we start with the default (computed) foreground colour.
532 // If we call SetForegroundColour explicitly for a control or window,
533 // then the foreground is changed.
534 // Therefore SetBackgroundColour computes the foreground colour, and
535 // SetForegroundColour changes the foreground colour. The ordering is
536 // important.
537
538 XtVaSetValues ((Widget) widget,
539 XmNforeground, foregroundColour.AllocColour(XtDisplay((Widget) widget)),
540 NULL);
541}
542
f516d986 543void wxDoChangeBackgroundColour(WXWidget widget, const wxColour& backgroundColour, bool changeArmColour)
2b5f62a0 544{
105fbe1f
MB
545 if (!backgroundColour.Ok())
546 return;
547
2b5f62a0
VZ
548 wxComputeColours (XtDisplay((Widget) widget), & backgroundColour,
549 (wxColour*) NULL);
550
551 XtVaSetValues ((Widget) widget,
552 XmNbackground, g_itemColors[wxBACK_INDEX].pixel,
553 XmNtopShadowColor, g_itemColors[wxTOPS_INDEX].pixel,
554 XmNbottomShadowColor, g_itemColors[wxBOTS_INDEX].pixel,
555 XmNforeground, g_itemColors[wxFORE_INDEX].pixel,
556 NULL);
557
558 if (changeArmColour)
559 XtVaSetValues ((Widget) widget,
560 XmNarmColor, g_itemColors[wxSELE_INDEX].pixel,
561 NULL);
562}
563
fbfb8bcc 564extern void wxDoChangeFont(WXWidget widget, const wxFont& font)
e1aae528 565{
101b4778
MB
566 // Lesstif 0.87 hangs here, but 0.93 does not; MBN: sometimes it does
567#if !wxCHECK_LESSTIF() // || wxCHECK_LESSTIF_VERSION( 0, 93 )
e1aae528 568 Widget w = (Widget)widget;
e1aae528 569 XtVaSetValues( w,
73608949 570 wxFont::GetFontTag(), font.GetFontTypeC( XtDisplay(w) ),
e1aae528 571 NULL );
355b4d3d
WS
572#else
573 wxUnusedVar(widget);
574 wxUnusedVar(font);
e1aae528
MB
575#endif
576
577}
578
e1aae528
MB
579wxString wxXmStringToString( const XmString& xmString )
580{
581 char *txt;
582 if( XmStringGetLtoR( xmString, XmSTRING_DEFAULT_CHARSET, &txt ) )
583 {
584 wxString str(txt);
585 XtFree (txt);
586 return str;
587 }
588
589 return wxEmptyString;
590}
591
3e2d47e1
MB
592XmString wxStringToXmString( const char* str )
593{
594 return XmStringCreateLtoR((char *)str, XmSTRING_DEFAULT_CHARSET);
595}
aae0472b
MB
596
597// ----------------------------------------------------------------------------
598// wxBitmap utility functions
599// ----------------------------------------------------------------------------
600
601// Creates a bitmap with transparent areas drawn in
602// the given colour.
fbfb8bcc 603wxBitmap wxCreateMaskedBitmap(const wxBitmap& bitmap, const wxColour& colour)
aae0472b
MB
604{
605 wxBitmap newBitmap(bitmap.GetWidth(),
606 bitmap.GetHeight(),
607 bitmap.GetDepth());
608 wxMemoryDC destDC;
609 wxMemoryDC srcDC;
610
f536319d 611 srcDC.SelectObjectAsSource(bitmap);
aae0472b
MB
612 destDC.SelectObject(newBitmap);
613
614 wxBrush brush(colour, wxSOLID);
aae0472b
MB
615 destDC.SetBackground(brush);
616 destDC.Clear();
617 destDC.Blit(0, 0, bitmap.GetWidth(), bitmap.GetHeight(),
ea76a6a5 618 &srcDC, 0, 0, wxCOPY, true);
aae0472b
MB
619
620 return newBitmap;
621}
6769d0cb
MB
622
623// ----------------------------------------------------------------------------
624// Miscellaneous functions
625// ----------------------------------------------------------------------------
626
627WXWidget wxCreateBorderWidget( WXWidget parent, long style )
628{
629 Widget borderWidget = (Widget)NULL, parentWidget = (Widget)parent;
630
631 if (style & wxSIMPLE_BORDER)
632 {
633 borderWidget = XtVaCreateManagedWidget
634 (
635 "simpleBorder",
636 xmFrameWidgetClass, parentWidget,
637 XmNshadowType, XmSHADOW_ETCHED_IN,
638 XmNshadowThickness, 1,
639 NULL
640 );
641 }
cce69fec 642 else if ((style & wxSUNKEN_BORDER) || (style & wxBORDER_THEME))
6769d0cb
MB
643 {
644 borderWidget = XtVaCreateManagedWidget
645 (
646 "sunkenBorder",
647 xmFrameWidgetClass, parentWidget,
648 XmNshadowType, XmSHADOW_IN,
649 NULL
650 );
651 }
652 else if (style & wxRAISED_BORDER)
653 {
654 borderWidget = XtVaCreateManagedWidget
655 (
656 "raisedBorder",
657 xmFrameWidgetClass, parentWidget,
658 XmNshadowType, XmSHADOW_OUT,
659 NULL
660 );
661 }
662
663 return borderWidget;
664}