1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Various utilities
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
24 #define XtDisplay XTDISPLAY
29 #include "wx/apptrait.h"
31 #include "wx/dcmemory.h"
32 #include "wx/bitmap.h"
33 #include "wx/evtloop.h"
37 #if (defined(__SUNCC__) || defined(__CLCC__))
42 #pragma message disable nosimpint
45 #include "wx/unix/execute.h"
50 #include "wx/motif/private.h"
53 #include "X11/Xresource.h"
56 #include "X11/Xutil.h"
59 #pragma message enable nosimpint
62 // ----------------------------------------------------------------------------
64 // ----------------------------------------------------------------------------
66 // Yuck this is really BOTH site and platform dependent
67 // so we should use some other strategy!
69 #define DEFAULT_XRESOURCE_DIR "/usr/openwin/lib/app-defaults"
71 #define DEFAULT_XRESOURCE_DIR "/usr/lib/X11/app-defaults"
75 static char *GetIniFile (char *dest
, const char *filename
);
78 // ============================================================================
80 // ============================================================================
82 // ----------------------------------------------------------------------------
83 // async event processing
84 // ----------------------------------------------------------------------------
86 // Consume all events until no more left
87 void wxFlushEvents(WXDisplay
* wxdisplay
)
89 Display
*display
= (Display
*)wxdisplay
;
92 XSync (display
, False
);
94 while (evtLoop
.Pending())
101 // ----------------------------------------------------------------------------
103 // ----------------------------------------------------------------------------
105 static void xt_notify_end_process(XtPointer data
, int *WXUNUSED(fid
),
108 wxEndProcessData
*proc_data
= (wxEndProcessData
*)data
;
110 wxHandleProcessTermination(proc_data
);
112 // VZ: I think they should be the same...
113 wxASSERT( (int)*id
== proc_data
->tag
);
118 int wxAddProcessCallback(wxEndProcessData
*proc_data
, int fd
)
120 XtInputId id
= XtAppAddInput((XtAppContext
) wxTheApp
->GetAppContext(),
122 (XtPointer
*) XtInputReadMask
,
123 (XtInputCallbackProc
) xt_notify_end_process
,
124 (XtPointer
) proc_data
);
129 // ----------------------------------------------------------------------------
131 // ----------------------------------------------------------------------------
135 // on OS/2, we use the wxBell from wxBase library (src/os2/utils.cpp)
138 // Use current setting for the bell
139 XBell (wxGlobalDisplay(), 0);
143 wxToolkitInfo
& wxGUIAppTraits::GetToolkitInfo()
145 static wxToolkitInfo info
;
147 info
.shortName
= _T("motif");
148 info
.name
= _T("wxMotif");
149 #ifdef __WXUNIVERSAL__
150 info
.shortName
<< _T("univ");
151 info
.name
<< _T("/wxUniversal");
154 // This code is WRONG!! Does NOT return the
155 // Motif version of the libs but the X protocol
157 Display
*display
= wxGlobalDisplay();
158 info
.versionMajor
= ProtocolVersion (display
);
159 info
.versionMinor
= ProtocolRevision (display
);
164 // ----------------------------------------------------------------------------
165 // Reading and writing resources (eg WIN.INI, .Xdefaults)
166 // ----------------------------------------------------------------------------
170 // Read $HOME for what it says is home, if not
171 // read $USER or $LOGNAME for user name else determine
172 // the Real User, then determine the Real home dir.
173 static char * GetIniFile (char *dest
, const char *filename
)
176 if (filename
&& wxIsAbsolutePath(filename
))
178 strcpy(dest
, filename
);
180 else if ((home
= wxGetUserHome("")) != NULL
)
183 if (dest
[strlen(dest
) - 1] != '/')
185 if (filename
== NULL
)
187 if ((filename
= getenv ("XENVIRONMENT")) == NULL
)
188 filename
= ".Xdefaults";
190 else if (*filename
!= '.')
192 strcat (dest
, filename
);
200 static char *GetResourcePath(char *buf
, const char *name
, bool create
= false)
202 if (create
&& wxFileExists (name
) ) {
204 return buf
; // Exists so ...
210 // Put in standard place for resource files if not absolute
211 strcpy (buf
, DEFAULT_XRESOURCE_DIR
);
213 strcat (buf
, wxFileNameFromPath (name
).c_str());
217 // Touch the file to create it
218 FILE *fd
= fopen (buf
, "w");
225 * We have a cache for writing different resource files,
226 * which will only get flushed when we call wxFlushResources().
227 * Build up a list of resource databases waiting to be written.
231 wxList
wxResourceCache (wxKEY_STRING
);
234 wxFlushResources (void)
236 char nameBuffer
[512];
238 wxNode
*node
= wxResourceCache
.First ();
241 const char *file
= node
->GetKeyString();
242 // If file doesn't exist, create it first.
243 (void)GetResourcePath(nameBuffer
, file
, true);
245 XrmDatabase database
= (XrmDatabase
) node
->Data ();
246 XrmPutFileDatabase (database
, nameBuffer
);
247 XrmDestroyDatabase (database
);
248 wxNode
*next
= node
->Next ();
254 static XrmDatabase wxResourceDatabase
= 0;
256 void wxXMergeDatabases (wxApp
* theApp
, Display
* display
);
258 bool wxWriteResource(const wxString
& section
, const wxString
& entry
, const wxString
& value
, const wxString
& file
)
262 (void) GetIniFile (buffer
, file
);
264 XrmDatabase database
;
265 wxNode
*node
= wxResourceCache
.Find (buffer
);
267 database
= (XrmDatabase
) node
->Data ();
270 database
= XrmGetFileDatabase (buffer
);
271 wxResourceCache
.Append (buffer
, (wxObject
*) database
);
275 strcpy (resName
, section
.c_str());
276 strcat (resName
, ".");
277 strcat (resName
, entry
.c_str());
279 XrmPutStringResource (&database
, resName
, value
);
283 bool wxWriteResource(const wxString
& section
, const wxString
& entry
, float value
, const wxString
& file
)
286 sprintf(buf
, "%.4f", value
);
287 return wxWriteResource(section
, entry
, buf
, file
);
290 bool wxWriteResource(const wxString
& section
, const wxString
& entry
, long value
, const wxString
& file
)
293 sprintf(buf
, "%ld", value
);
294 return wxWriteResource(section
, entry
, buf
, file
);
297 bool wxWriteResource(const wxString
& section
, const wxString
& entry
, int value
, const wxString
& file
)
300 sprintf(buf
, "%d", value
);
301 return wxWriteResource(section
, entry
, buf
, file
);
304 bool wxGetResource(const wxString
& section
, const wxString
& entry
, char **value
, const wxString
& file
)
306 if (!wxResourceDatabase
)
308 Display
*display
= wxGlobalDisplay();
309 wxXMergeDatabases (wxTheApp
, display
);
312 XrmDatabase database
;
318 // Is this right? Trying to get it to look in the user's
319 // home directory instead of current directory -- JACS
320 (void) GetIniFile (buffer
, file
);
322 wxNode
*node
= wxResourceCache
.Find (buffer
);
324 database
= (XrmDatabase
) node
->Data ();
327 database
= XrmGetFileDatabase (buffer
);
328 wxResourceCache
.Append (buffer
, (wxObject
*) database
);
332 database
= wxResourceDatabase
;
337 strcpy (buf
, section
);
341 Bool success
= XrmGetResource (database
, buf
, "*", str_type
,
343 // Try different combinations of upper/lower case, just in case...
346 buf
[0] = (isupper (buf
[0]) ? tolower (buf
[0]) : toupper (buf
[0]));
347 success
= XrmGetResource (database
, buf
, "*", str_type
,
355 *value
= new char[xvalue
.size
+ 1];
356 strncpy (*value
, xvalue
.addr
, (int) xvalue
.size
);
362 bool wxGetResource(const wxString
& section
, const wxString
& entry
, float *value
, const wxString
& file
)
365 bool succ
= wxGetResource(section
, entry
, (char **)&s
, file
);
368 *value
= (float)strtod(s
, NULL
);
375 bool wxGetResource(const wxString
& section
, const wxString
& entry
, long *value
, const wxString
& file
)
378 bool succ
= wxGetResource(section
, entry
, (char **)&s
, file
);
381 *value
= strtol(s
, NULL
, 10);
388 bool wxGetResource(const wxString
& section
, const wxString
& entry
, int *value
, const wxString
& file
)
391 bool succ
= wxGetResource(section
, entry
, (char **)&s
, file
);
394 // Handle True, False here
395 // True, Yes, Enables, Set or Activated
396 if (*s
== 'T' || *s
== 'Y' || *s
== 'E' || *s
== 'S' || *s
== 'A')
398 // False, No, Disabled, Reset, Cleared, Deactivated
399 else if (*s
== 'F' || *s
== 'N' || *s
== 'D' || *s
== 'R' || *s
== 'C')
403 *value
= (int) strtol (s
, NULL
, 10);
411 void wxXMergeDatabases (wxApp
* theApp
, Display
* display
)
413 XrmDatabase homeDB
, serverDB
, applicationDB
;
414 char filenamebuf
[1024];
416 char *filename
= &filenamebuf
[0];
418 wxString classname
= theApp
->GetClassName();
420 (void) strcpy (name
, "/usr/lib/X11/app-defaults/");
421 (void) strcat (name
, classname
.c_str());
423 /* Get application defaults file, if any */
424 applicationDB
= XrmGetFileDatabase (name
);
425 (void) XrmMergeDatabases (applicationDB
, &wxResourceDatabase
);
427 /* Merge server defaults, created by xrdb, loaded as a property of the root
428 * window when the server initializes and loaded into the display
429 * structure on XOpenDisplay;
430 * if not defined, use .Xdefaults
433 if (XResourceManagerString (display
) != NULL
)
435 serverDB
= XrmGetStringDatabase (XResourceManagerString (display
));
439 (void) GetIniFile (filename
, NULL
);
440 serverDB
= XrmGetFileDatabase (filename
);
442 XrmMergeDatabases (serverDB
, &wxResourceDatabase
);
444 /* Open XENVIRONMENT file, or if not defined, the .Xdefaults,
445 * and merge into existing database
448 if ((environment
= getenv ("XENVIRONMENT")) == NULL
)
451 environment
= GetIniFile (filename
, NULL
);
452 len
= strlen (environment
);
453 wxString hostname
= wxGetHostName();
455 strncat(environment
, hostname
, 1024 - len
);
457 homeDB
= XrmGetFileDatabase (environment
);
458 XrmMergeDatabases (homeDB
, &wxResourceDatabase
);
464 * Not yet used but may be useful.
468 wxSetDefaultResources (const Widget w
, const char **resourceSpec
, const char *name
)
471 Display
*dpy
= XtDisplay (w
); // Retrieve the display pointer
473 XrmDatabase rdb
= NULL
; // A resource data base
475 // Create an empty resource database
476 rdb
= XrmGetStringDatabase ("");
478 // Add the Component resources, prepending the name of the component
481 while (resourceSpec
[i
] != NULL
)
485 sprintf (buf
, "*%s%s", name
, resourceSpec
[i
++]);
486 XrmPutLineResource (&rdb
, buf
);
489 // Merge them into the Xt database, with lowest precendence
493 #if (XlibSpecificationRelease>=5)
494 XrmDatabase db
= XtDatabase (dpy
);
495 XrmCombineDatabase (rdb
, &db
, False
);
497 XrmMergeDatabases (dpy
->db
, &rdb
);
505 #endif // wxUSE_RESOURCES
507 // ----------------------------------------------------------------------------
509 // ----------------------------------------------------------------------------
511 void wxGetMousePosition( int* x
, int* y
)
520 XQueryPointer(wxGlobalDisplay(),
521 DefaultRootWindow(wxGlobalDisplay()),
523 &(xev
.x_root
), &(xev
.y_root
),
531 // Return true if we have a colour display
532 bool wxColourDisplay()
534 return wxDisplayDepth() > 1;
537 // Returns depth of screen
540 Display
*dpy
= wxGlobalDisplay();
542 return DefaultDepth (dpy
, DefaultScreen (dpy
));
545 // Get size of display
546 void wxDisplaySize(int *width
, int *height
)
548 Display
*dpy
= wxGlobalDisplay();
551 *width
= DisplayWidth (dpy
, DefaultScreen (dpy
));
553 *height
= DisplayHeight (dpy
, DefaultScreen (dpy
));
556 void wxDisplaySizeMM(int *width
, int *height
)
558 Display
*dpy
= wxGlobalDisplay();
561 *width
= DisplayWidthMM(dpy
, DefaultScreen (dpy
));
563 *height
= DisplayHeightMM(dpy
, DefaultScreen (dpy
));
566 void wxClientDisplayRect(int *x
, int *y
, int *width
, int *height
)
568 // This is supposed to return desktop dimensions minus any window
569 // manager panels, menus, taskbars, etc. If there is a way to do that
570 // for this platform please fix this function, otherwise it defaults
571 // to the entire desktop.
574 wxDisplaySize(width
, height
);
578 // Configurable display in wxX11 and wxMotif
579 static WXDisplay
*gs_currentDisplay
= NULL
;
580 static wxString gs_displayName
;
582 WXDisplay
*wxGetDisplay()
584 if (gs_currentDisplay
)
585 return gs_currentDisplay
;
587 return wxTheApp
->GetInitialDisplay();
591 bool wxSetDisplay(const wxString
& display_name
)
593 gs_displayName
= display_name
;
595 if ( display_name
.empty() )
597 gs_currentDisplay
= NULL
;
605 Display
*display
= XtOpenDisplay((XtAppContext
) wxTheApp
->GetAppContext(),
606 display_name
.c_str(),
607 wxTheApp
->GetAppName().c_str(),
608 wxTheApp
->GetClassName().c_str(),
610 #if XtSpecificationRelease < 5
619 gs_currentDisplay
= (WXDisplay
*) display
;
627 wxString
wxGetDisplayName()
629 return gs_displayName
;
632 wxWindow
* wxFindWindowAtPoint(const wxPoint
& pt
)
634 return wxGenericFindWindowAtPoint(pt
);
637 // ----------------------------------------------------------------------------
638 // Some colour manipulation routines
639 // ----------------------------------------------------------------------------
641 void wxHSVToXColor(wxHSV
*hsv
,XColor
*rgb
)
646 int r
= 0, g
= 0, b
= 0;
649 s
= (s
* wxMAX_RGB
) / wxMAX_SV
;
650 v
= (v
* wxMAX_RGB
) / wxMAX_SV
;
652 if (s
== 0) { h
= 0; r
= g
= b
= v
; }
655 p
= v
* (wxMAX_RGB
- s
) / wxMAX_RGB
;
656 q
= v
* (wxMAX_RGB
- s
* f
/ 60) / wxMAX_RGB
;
657 t
= v
* (wxMAX_RGB
- s
* (60 - f
) / 60) / wxMAX_RGB
;
660 case 0: r
= v
, g
= t
, b
= p
; break;
661 case 1: r
= q
, g
= v
, b
= p
; break;
662 case 2: r
= p
, g
= v
, b
= t
; break;
663 case 3: r
= p
, g
= q
, b
= v
; break;
664 case 4: r
= t
, g
= p
, b
= v
; break;
665 case 5: r
= v
, g
= p
, b
= q
; break;
672 void wxXColorToHSV(wxHSV
*hsv
,XColor
*rgb
)
674 int r
= rgb
->red
>> 8;
675 int g
= rgb
->green
>> 8;
676 int b
= rgb
->blue
>> 8;
677 int maxv
= wxMax3(r
, g
, b
);
678 int minv
= wxMin3(r
, g
, b
);
681 if (maxv
) s
= (maxv
- minv
) * wxMAX_RGB
/ maxv
;
686 int rc
, gc
, bc
, hex
= 0;
687 rc
= (maxv
- r
) * wxMAX_RGB
/ (maxv
- minv
);
688 gc
= (maxv
- g
) * wxMAX_RGB
/ (maxv
- minv
);
689 bc
= (maxv
- b
) * wxMAX_RGB
/ (maxv
- minv
);
690 if (r
== maxv
) { h
= bc
- gc
, hex
= 0; }
691 else if (g
== maxv
) { h
= rc
- bc
, hex
= 2; }
692 else if (b
== maxv
) { h
= gc
- rc
, hex
= 4; }
693 h
= hex
* 60 + (h
* 60 / wxMAX_RGB
);
697 hsv
->s
= (s
* wxMAX_SV
) / wxMAX_RGB
;
698 hsv
->v
= (v
* wxMAX_SV
) / wxMAX_RGB
;
701 void wxAllocNearestColor(Display
*d
,Colormap cmp
,XColor
*xc
)
706 int screen
= DefaultScreen(d
);
707 int num_colors
= DisplayCells(d
,screen
);
709 XColor
*color_defs
= new XColor
[num_colors
];
710 for(llp
= 0;llp
< num_colors
;llp
++) color_defs
[llp
].pixel
= llp
;
711 XQueryColors(d
,cmp
,color_defs
,num_colors
);
714 wxXColorToHSV(&hsv
,xc
);
716 int diff
, min_diff
= 0, pixel
= 0;
718 for(llp
= 0;llp
< num_colors
;llp
++)
720 wxXColorToHSV(&hsv_defs
,&color_defs
[llp
]);
721 diff
= wxSIGN(wxH_WEIGHT
* (hsv
.h
- hsv_defs
.h
)) +
722 wxSIGN(wxS_WEIGHT
* (hsv
.s
- hsv_defs
.s
)) +
723 wxSIGN(wxV_WEIGHT
* (hsv
.v
- hsv_defs
.v
));
724 if (llp
== 0) min_diff
= diff
;
725 if (min_diff
> diff
) { min_diff
= diff
; pixel
= llp
; }
726 if (min_diff
== 0) break;
729 xc
-> red
= color_defs
[pixel
].red
;
730 xc
-> green
= color_defs
[pixel
].green
;
731 xc
-> blue
= color_defs
[pixel
].blue
;
732 xc
-> flags
= DoRed
| DoGreen
| DoBlue
;
735 if (!XAllocColor(d,cmp,xc))
736 cout << "wxAllocNearestColor : Warning : Cannot find nearest color !\n";
743 void wxAllocColor(Display
*d
,Colormap cmp
,XColor
*xc
)
745 if (!XAllocColor(d
,cmp
,xc
))
747 // cout << "wxAllocColor : Warning : Can not allocate color, attempt find nearest !\n";
748 wxAllocNearestColor(d
,cmp
,xc
);
753 wxString
wxGetXEventName(XEvent
& event
)
756 wxString
str(wxT("(some event)"));
759 int type
= event
.xany
.type
;
760 static char* event_name
[] = {
761 "", "unknown(-)", // 0-1
762 "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", // 2-5
763 "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", // 6-9
764 "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose", // 10-13
765 "NoExpose", "VisibilityNotify", "CreateNotify", // 14-16
766 "DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest",// 17-20
767 "ReparentNotify", "ConfigureNotify", "ConfigureRequest", // 21-23
768 "GravityNotify", "ResizeRequest", "CirculateNotify", // 24-26
769 "CirculateRequest", "PropertyNotify", "SelectionClear", // 27-29
770 "SelectionRequest", "SelectionNotify", "ColormapNotify", // 30-32
771 "ClientMessage", "MappingNotify", // 33-34
773 type
= wxMin(35, type
); type
= wxMax(1, type
);
774 wxString
str(event_name
[type
]);
780 // ----------------------------------------------------------------------------
782 // ----------------------------------------------------------------------------
784 // Find the letter corresponding to the mnemonic, for Motif
785 char wxFindMnemonic (const char *s
)
788 int len
= strlen (s
);
791 for (i
= 0; i
< len
; i
++)
795 // Carefully handle &&
796 if ((i
+ 1) <= len
&& s
[i
+ 1] == '&')
808 char* wxFindAccelerator( const char *s
)
811 // VZ: this function returns incorrect keysym which completely breaks kbd
815 // The accelerator text is after the \t char.
816 s
= strchr( s
, '\t' );
818 if( !s
) return NULL
;
821 Now we need to format it as X standard:
826 Ctrl+N --> Ctrl<Key>N
828 Ctrl+Shift+A --> Ctrl Shift<Key>A
830 and handle Ctrl-N & similia
833 static char buf
[256];
836 wxString tmp
= s
+ 1; // skip TAB
839 while( index
< tmp
.length() )
841 size_t plus
= tmp
.find( '+', index
);
842 size_t minus
= tmp
.find( '-', index
);
844 // neither '+' nor '-', add <Key>
845 if( plus
== wxString::npos
&& minus
== wxString::npos
)
847 strcat( buf
, "<Key>" );
848 strcat( buf
, tmp
.c_str() + index
);
853 // OK: npos is big and positive
854 size_t sep
= wxMin( plus
, minus
);
855 wxString mod
= tmp
.substr( index
, sep
- index
);
866 strcat( buf
, mod
.c_str() );
875 XmString
wxFindAcceleratorText (const char *s
)
878 // VZ: this function returns incorrect keysym which completely breaks kbd
882 // The accelerator text is after the \t char.
883 s
= strchr( s
, '\t' );
885 if( !s
) return NULL
;
887 return wxStringToXmString( s
+ 1 ); // skip TAB!
891 // Change a widget's foreground and background colours.
892 void wxDoChangeForegroundColour(WXWidget widget
, wxColour
& foregroundColour
)
894 // When should we specify the foreground, if it's calculated
895 // by wxComputeColours?
896 // Solution: say we start with the default (computed) foreground colour.
897 // If we call SetForegroundColour explicitly for a control or window,
898 // then the foreground is changed.
899 // Therefore SetBackgroundColour computes the foreground colour, and
900 // SetForegroundColour changes the foreground colour. The ordering is
903 XtVaSetValues ((Widget
) widget
,
904 XmNforeground
, foregroundColour
.AllocColour(XtDisplay((Widget
) widget
)),
908 void wxDoChangeBackgroundColour(WXWidget widget
, wxColour
& backgroundColour
, bool changeArmColour
)
910 wxComputeColours (XtDisplay((Widget
) widget
), & backgroundColour
,
913 XtVaSetValues ((Widget
) widget
,
914 XmNbackground
, g_itemColors
[wxBACK_INDEX
].pixel
,
915 XmNtopShadowColor
, g_itemColors
[wxTOPS_INDEX
].pixel
,
916 XmNbottomShadowColor
, g_itemColors
[wxBOTS_INDEX
].pixel
,
917 XmNforeground
, g_itemColors
[wxFORE_INDEX
].pixel
,
921 XtVaSetValues ((Widget
) widget
,
922 XmNarmColor
, g_itemColors
[wxSELE_INDEX
].pixel
,
926 extern void wxDoChangeFont(WXWidget widget
, wxFont
& font
)
928 // Lesstif 0.87 hangs here, but 0.93 does not
929 #if !wxCHECK_LESSTIF() || wxCHECK_LESSTIF_VERSION( 0, 93 )
930 Widget w
= (Widget
)widget
;
932 wxFont::GetFontTag(), font
.GetFontType( XtDisplay(w
) ),
938 wxString
wxXmStringToString( const XmString
& xmString
)
941 if( XmStringGetLtoR( xmString
, XmSTRING_DEFAULT_CHARSET
, &txt
) )
948 return wxEmptyString
;
951 XmString
wxStringToXmString( const wxString
& str
)
953 return XmStringCreateLtoR((char *)str
.c_str(), XmSTRING_DEFAULT_CHARSET
);
956 XmString
wxStringToXmString( const char* str
)
958 return XmStringCreateLtoR((char *)str
, XmSTRING_DEFAULT_CHARSET
);
961 // ----------------------------------------------------------------------------
962 // wxBitmap utility functions
963 // ----------------------------------------------------------------------------
965 // Creates a bitmap with transparent areas drawn in
967 wxBitmap
wxCreateMaskedBitmap(const wxBitmap
& bitmap
, wxColour
& colour
)
969 wxBitmap
newBitmap(bitmap
.GetWidth(),
975 srcDC
.SelectObject(bitmap
);
976 destDC
.SelectObject(newBitmap
);
978 wxBrush
brush(colour
, wxSOLID
);
979 destDC
.SetBackground(brush
);
981 destDC
.Blit(0, 0, bitmap
.GetWidth(), bitmap
.GetHeight(),
982 &srcDC
, 0, 0, wxCOPY
, true);
987 // ----------------------------------------------------------------------------
988 // Miscellaneous functions
989 // ----------------------------------------------------------------------------
991 WXWidget
wxCreateBorderWidget( WXWidget parent
, long style
)
993 Widget borderWidget
= (Widget
)NULL
, parentWidget
= (Widget
)parent
;
995 if (style
& wxSIMPLE_BORDER
)
997 borderWidget
= XtVaCreateManagedWidget
1000 xmFrameWidgetClass
, parentWidget
,
1001 XmNshadowType
, XmSHADOW_ETCHED_IN
,
1002 XmNshadowThickness
, 1,
1006 else if (style
& wxSUNKEN_BORDER
)
1008 borderWidget
= XtVaCreateManagedWidget
1011 xmFrameWidgetClass
, parentWidget
,
1012 XmNshadowType
, XmSHADOW_IN
,
1016 else if (style
& wxRAISED_BORDER
)
1018 borderWidget
= XtVaCreateManagedWidget
1021 xmFrameWidgetClass
, parentWidget
,
1022 XmNshadowType
, XmSHADOW_OUT
,
1027 return borderWidget
;