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();
160 info
.versionMajor
= ProtocolVersion (display
);
161 info
.versionMinor
= ProtocolRevision (display
);
167 // ----------------------------------------------------------------------------
168 // Reading and writing resources (eg WIN.INI, .Xdefaults)
169 // ----------------------------------------------------------------------------
173 // Read $HOME for what it says is home, if not
174 // read $USER or $LOGNAME for user name else determine
175 // the Real User, then determine the Real home dir.
176 static char * GetIniFile (char *dest
, const char *filename
)
179 if (filename
&& wxIsAbsolutePath(filename
))
181 strcpy(dest
, filename
);
183 else if ((home
= wxGetUserHome("")) != NULL
)
186 if (dest
[strlen(dest
) - 1] != '/')
188 if (filename
== NULL
)
190 if ((filename
= getenv ("XENVIRONMENT")) == NULL
)
191 filename
= ".Xdefaults";
193 else if (*filename
!= '.')
195 strcat (dest
, filename
);
203 static char *GetResourcePath(char *buf
, const char *name
, bool create
= false)
205 if (create
&& wxFileExists (name
) ) {
207 return buf
; // Exists so ...
213 // Put in standard place for resource files if not absolute
214 strcpy (buf
, DEFAULT_XRESOURCE_DIR
);
216 strcat (buf
, wxFileNameFromPath (name
).c_str());
220 // Touch the file to create it
221 FILE *fd
= fopen (buf
, "w");
228 * We have a cache for writing different resource files,
229 * which will only get flushed when we call wxFlushResources().
230 * Build up a list of resource databases waiting to be written.
234 wxList
wxResourceCache (wxKEY_STRING
);
237 wxFlushResources (void)
239 char nameBuffer
[512];
241 wxNode
*node
= wxResourceCache
.First ();
244 const char *file
= node
->GetKeyString();
245 // If file doesn't exist, create it first.
246 (void)GetResourcePath(nameBuffer
, file
, true);
248 XrmDatabase database
= (XrmDatabase
) node
->Data ();
249 XrmPutFileDatabase (database
, nameBuffer
);
250 XrmDestroyDatabase (database
);
251 wxNode
*next
= node
->Next ();
257 static XrmDatabase wxResourceDatabase
= 0;
259 void wxXMergeDatabases (wxApp
* theApp
, Display
* display
);
261 bool wxWriteResource(const wxString
& section
, const wxString
& entry
, const wxString
& value
, const wxString
& file
)
265 (void) GetIniFile (buffer
, file
);
267 XrmDatabase database
;
268 wxNode
*node
= wxResourceCache
.Find (buffer
);
270 database
= (XrmDatabase
) node
->Data ();
273 database
= XrmGetFileDatabase (buffer
);
274 wxResourceCache
.Append (buffer
, (wxObject
*) database
);
278 strcpy (resName
, section
.c_str());
279 strcat (resName
, ".");
280 strcat (resName
, entry
.c_str());
282 XrmPutStringResource (&database
, resName
, value
);
286 bool wxWriteResource(const wxString
& section
, const wxString
& entry
, float value
, const wxString
& file
)
289 sprintf(buf
, "%.4f", value
);
290 return wxWriteResource(section
, entry
, buf
, file
);
293 bool wxWriteResource(const wxString
& section
, const wxString
& entry
, long value
, const wxString
& file
)
296 sprintf(buf
, "%ld", value
);
297 return wxWriteResource(section
, entry
, buf
, file
);
300 bool wxWriteResource(const wxString
& section
, const wxString
& entry
, int value
, const wxString
& file
)
303 sprintf(buf
, "%d", value
);
304 return wxWriteResource(section
, entry
, buf
, file
);
307 bool wxGetResource(const wxString
& section
, const wxString
& entry
, char **value
, const wxString
& file
)
309 if (!wxResourceDatabase
)
311 Display
*display
= wxGlobalDisplay();
312 wxXMergeDatabases (wxTheApp
, display
);
315 XrmDatabase database
;
321 // Is this right? Trying to get it to look in the user's
322 // home directory instead of current directory -- JACS
323 (void) GetIniFile (buffer
, file
);
325 wxNode
*node
= wxResourceCache
.Find (buffer
);
327 database
= (XrmDatabase
) node
->Data ();
330 database
= XrmGetFileDatabase (buffer
);
331 wxResourceCache
.Append (buffer
, (wxObject
*) database
);
335 database
= wxResourceDatabase
;
340 strcpy (buf
, section
);
344 Bool success
= XrmGetResource (database
, buf
, "*", str_type
,
346 // Try different combinations of upper/lower case, just in case...
349 buf
[0] = (isupper (buf
[0]) ? tolower (buf
[0]) : toupper (buf
[0]));
350 success
= XrmGetResource (database
, buf
, "*", str_type
,
358 *value
= new char[xvalue
.size
+ 1];
359 strncpy (*value
, xvalue
.addr
, (int) xvalue
.size
);
365 bool wxGetResource(const wxString
& section
, const wxString
& entry
, float *value
, const wxString
& file
)
368 bool succ
= wxGetResource(section
, entry
, (char **)&s
, file
);
371 *value
= (float)strtod(s
, NULL
);
378 bool wxGetResource(const wxString
& section
, const wxString
& entry
, long *value
, const wxString
& file
)
381 bool succ
= wxGetResource(section
, entry
, (char **)&s
, file
);
384 *value
= strtol(s
, NULL
, 10);
391 bool wxGetResource(const wxString
& section
, const wxString
& entry
, int *value
, const wxString
& file
)
394 bool succ
= wxGetResource(section
, entry
, (char **)&s
, file
);
397 // Handle True, False here
398 // True, Yes, Enables, Set or Activated
399 if (*s
== 'T' || *s
== 'Y' || *s
== 'E' || *s
== 'S' || *s
== 'A')
401 // False, No, Disabled, Reset, Cleared, Deactivated
402 else if (*s
== 'F' || *s
== 'N' || *s
== 'D' || *s
== 'R' || *s
== 'C')
406 *value
= (int) strtol (s
, NULL
, 10);
414 void wxXMergeDatabases (wxApp
* theApp
, Display
* display
)
416 XrmDatabase homeDB
, serverDB
, applicationDB
;
417 char filenamebuf
[1024];
419 char *filename
= &filenamebuf
[0];
421 wxString classname
= theApp
->GetClassName();
423 (void) strcpy (name
, "/usr/lib/X11/app-defaults/");
424 (void) strcat (name
, classname
.c_str());
426 /* Get application defaults file, if any */
427 applicationDB
= XrmGetFileDatabase (name
);
428 (void) XrmMergeDatabases (applicationDB
, &wxResourceDatabase
);
430 /* Merge server defaults, created by xrdb, loaded as a property of the root
431 * window when the server initializes and loaded into the display
432 * structure on XOpenDisplay;
433 * if not defined, use .Xdefaults
436 if (XResourceManagerString (display
) != NULL
)
438 serverDB
= XrmGetStringDatabase (XResourceManagerString (display
));
442 (void) GetIniFile (filename
, NULL
);
443 serverDB
= XrmGetFileDatabase (filename
);
445 XrmMergeDatabases (serverDB
, &wxResourceDatabase
);
447 /* Open XENVIRONMENT file, or if not defined, the .Xdefaults,
448 * and merge into existing database
451 if ((environment
= getenv ("XENVIRONMENT")) == NULL
)
454 environment
= GetIniFile (filename
, NULL
);
455 len
= strlen (environment
);
456 wxString hostname
= wxGetHostName();
458 strncat(environment
, hostname
, 1024 - len
);
460 homeDB
= XrmGetFileDatabase (environment
);
461 XrmMergeDatabases (homeDB
, &wxResourceDatabase
);
467 * Not yet used but may be useful.
471 wxSetDefaultResources (const Widget w
, const char **resourceSpec
, const char *name
)
474 Display
*dpy
= XtDisplay (w
); // Retrieve the display pointer
476 XrmDatabase rdb
= NULL
; // A resource data base
478 // Create an empty resource database
479 rdb
= XrmGetStringDatabase ("");
481 // Add the Component resources, prepending the name of the component
484 while (resourceSpec
[i
] != NULL
)
488 sprintf (buf
, "*%s%s", name
, resourceSpec
[i
++]);
489 XrmPutLineResource (&rdb
, buf
);
492 // Merge them into the Xt database, with lowest precendence
496 #if (XlibSpecificationRelease>=5)
497 XrmDatabase db
= XtDatabase (dpy
);
498 XrmCombineDatabase (rdb
, &db
, False
);
500 XrmMergeDatabases (dpy
->db
, &rdb
);
508 #endif // wxUSE_RESOURCES
510 // ----------------------------------------------------------------------------
512 // ----------------------------------------------------------------------------
514 void wxGetMousePosition( int* x
, int* y
)
523 XQueryPointer(wxGlobalDisplay(),
524 DefaultRootWindow(wxGlobalDisplay()),
526 &(xev
.x_root
), &(xev
.y_root
),
534 // Return true if we have a colour display
535 bool wxColourDisplay()
537 return wxDisplayDepth() > 1;
540 // Returns depth of screen
543 Display
*dpy
= wxGlobalDisplay();
545 return DefaultDepth (dpy
, DefaultScreen (dpy
));
548 // Get size of display
549 void wxDisplaySize(int *width
, int *height
)
551 Display
*dpy
= wxGlobalDisplay();
554 *width
= DisplayWidth (dpy
, DefaultScreen (dpy
));
556 *height
= DisplayHeight (dpy
, DefaultScreen (dpy
));
559 void wxDisplaySizeMM(int *width
, int *height
)
561 Display
*dpy
= wxGlobalDisplay();
564 *width
= DisplayWidthMM(dpy
, DefaultScreen (dpy
));
566 *height
= DisplayHeightMM(dpy
, DefaultScreen (dpy
));
569 void wxClientDisplayRect(int *x
, int *y
, int *width
, int *height
)
571 // This is supposed to return desktop dimensions minus any window
572 // manager panels, menus, taskbars, etc. If there is a way to do that
573 // for this platform please fix this function, otherwise it defaults
574 // to the entire desktop.
577 wxDisplaySize(width
, height
);
581 // Configurable display in wxX11 and wxMotif
582 static WXDisplay
*gs_currentDisplay
= NULL
;
583 static wxString gs_displayName
;
585 WXDisplay
*wxGetDisplay()
587 if (gs_currentDisplay
)
588 return gs_currentDisplay
;
590 return wxTheApp
->GetInitialDisplay();
594 bool wxSetDisplay(const wxString
& display_name
)
596 gs_displayName
= display_name
;
598 if ( display_name
.empty() )
600 gs_currentDisplay
= NULL
;
608 Display
*display
= XtOpenDisplay((XtAppContext
) wxTheApp
->GetAppContext(),
609 display_name
.c_str(),
610 wxTheApp
->GetAppName().c_str(),
611 wxTheApp
->GetClassName().c_str(),
613 #if XtSpecificationRelease < 5
622 gs_currentDisplay
= (WXDisplay
*) display
;
630 wxString
wxGetDisplayName()
632 return gs_displayName
;
635 wxWindow
* wxFindWindowAtPoint(const wxPoint
& pt
)
637 return wxGenericFindWindowAtPoint(pt
);
640 // ----------------------------------------------------------------------------
641 // Some colour manipulation routines
642 // ----------------------------------------------------------------------------
644 void wxHSVToXColor(wxHSV
*hsv
,XColor
*rgb
)
649 int r
= 0, g
= 0, b
= 0;
652 s
= (s
* wxMAX_RGB
) / wxMAX_SV
;
653 v
= (v
* wxMAX_RGB
) / wxMAX_SV
;
655 if (s
== 0) { h
= 0; r
= g
= b
= v
; }
658 p
= v
* (wxMAX_RGB
- s
) / wxMAX_RGB
;
659 q
= v
* (wxMAX_RGB
- s
* f
/ 60) / wxMAX_RGB
;
660 t
= v
* (wxMAX_RGB
- s
* (60 - f
) / 60) / wxMAX_RGB
;
663 case 0: r
= v
, g
= t
, b
= p
; break;
664 case 1: r
= q
, g
= v
, b
= p
; break;
665 case 2: r
= p
, g
= v
, b
= t
; break;
666 case 3: r
= p
, g
= q
, b
= v
; break;
667 case 4: r
= t
, g
= p
, b
= v
; break;
668 case 5: r
= v
, g
= p
, b
= q
; break;
675 void wxXColorToHSV(wxHSV
*hsv
,XColor
*rgb
)
677 int r
= rgb
->red
>> 8;
678 int g
= rgb
->green
>> 8;
679 int b
= rgb
->blue
>> 8;
680 int maxv
= wxMax3(r
, g
, b
);
681 int minv
= wxMin3(r
, g
, b
);
684 if (maxv
) s
= (maxv
- minv
) * wxMAX_RGB
/ maxv
;
689 int rc
, gc
, bc
, hex
= 0;
690 rc
= (maxv
- r
) * wxMAX_RGB
/ (maxv
- minv
);
691 gc
= (maxv
- g
) * wxMAX_RGB
/ (maxv
- minv
);
692 bc
= (maxv
- b
) * wxMAX_RGB
/ (maxv
- minv
);
693 if (r
== maxv
) { h
= bc
- gc
, hex
= 0; }
694 else if (g
== maxv
) { h
= rc
- bc
, hex
= 2; }
695 else if (b
== maxv
) { h
= gc
- rc
, hex
= 4; }
696 h
= hex
* 60 + (h
* 60 / wxMAX_RGB
);
700 hsv
->s
= (s
* wxMAX_SV
) / wxMAX_RGB
;
701 hsv
->v
= (v
* wxMAX_SV
) / wxMAX_RGB
;
704 void wxAllocNearestColor(Display
*d
,Colormap cmp
,XColor
*xc
)
709 int screen
= DefaultScreen(d
);
710 int num_colors
= DisplayCells(d
,screen
);
712 XColor
*color_defs
= new XColor
[num_colors
];
713 for(llp
= 0;llp
< num_colors
;llp
++) color_defs
[llp
].pixel
= llp
;
714 XQueryColors(d
,cmp
,color_defs
,num_colors
);
717 wxXColorToHSV(&hsv
,xc
);
719 int diff
, min_diff
= 0, pixel
= 0;
721 for(llp
= 0;llp
< num_colors
;llp
++)
723 wxXColorToHSV(&hsv_defs
,&color_defs
[llp
]);
724 diff
= wxSIGN(wxH_WEIGHT
* (hsv
.h
- hsv_defs
.h
)) +
725 wxSIGN(wxS_WEIGHT
* (hsv
.s
- hsv_defs
.s
)) +
726 wxSIGN(wxV_WEIGHT
* (hsv
.v
- hsv_defs
.v
));
727 if (llp
== 0) min_diff
= diff
;
728 if (min_diff
> diff
) { min_diff
= diff
; pixel
= llp
; }
729 if (min_diff
== 0) break;
732 xc
-> red
= color_defs
[pixel
].red
;
733 xc
-> green
= color_defs
[pixel
].green
;
734 xc
-> blue
= color_defs
[pixel
].blue
;
735 xc
-> flags
= DoRed
| DoGreen
| DoBlue
;
738 if (!XAllocColor(d,cmp,xc))
739 cout << "wxAllocNearestColor : Warning : Cannot find nearest color !\n";
746 void wxAllocColor(Display
*d
,Colormap cmp
,XColor
*xc
)
748 if (!XAllocColor(d
,cmp
,xc
))
750 // cout << "wxAllocColor : Warning : Can not allocate color, attempt find nearest !\n";
751 wxAllocNearestColor(d
,cmp
,xc
);
756 wxString
wxGetXEventName(XEvent
& event
)
759 wxString
str(wxT("(some event)"));
762 int type
= event
.xany
.type
;
763 static char* event_name
[] = {
764 "", "unknown(-)", // 0-1
765 "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", // 2-5
766 "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", // 6-9
767 "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose", // 10-13
768 "NoExpose", "VisibilityNotify", "CreateNotify", // 14-16
769 "DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest",// 17-20
770 "ReparentNotify", "ConfigureNotify", "ConfigureRequest", // 21-23
771 "GravityNotify", "ResizeRequest", "CirculateNotify", // 24-26
772 "CirculateRequest", "PropertyNotify", "SelectionClear", // 27-29
773 "SelectionRequest", "SelectionNotify", "ColormapNotify", // 30-32
774 "ClientMessage", "MappingNotify", // 33-34
776 type
= wxMin(35, type
); type
= wxMax(1, type
);
777 wxString
str(event_name
[type
]);
783 // ----------------------------------------------------------------------------
785 // ----------------------------------------------------------------------------
787 // Find the letter corresponding to the mnemonic, for Motif
788 char wxFindMnemonic (const char *s
)
791 int len
= strlen (s
);
794 for (i
= 0; i
< len
; i
++)
798 // Carefully handle &&
799 if ((i
+ 1) <= len
&& s
[i
+ 1] == '&')
811 char* wxFindAccelerator( const char *s
)
814 // VZ: this function returns incorrect keysym which completely breaks kbd
818 // The accelerator text is after the \t char.
819 s
= strchr( s
, '\t' );
821 if( !s
) return NULL
;
824 Now we need to format it as X standard:
829 Ctrl+N --> Ctrl<Key>N
831 Ctrl+Shift+A --> Ctrl Shift<Key>A
833 and handle Ctrl-N & similia
836 static char buf
[256];
839 wxString tmp
= s
+ 1; // skip TAB
842 while( index
< tmp
.length() )
844 size_t plus
= tmp
.find( '+', index
);
845 size_t minus
= tmp
.find( '-', index
);
847 // neither '+' nor '-', add <Key>
848 if( plus
== wxString::npos
&& minus
== wxString::npos
)
850 strcat( buf
, "<Key>" );
851 strcat( buf
, tmp
.c_str() + index
);
856 // OK: npos is big and positive
857 size_t sep
= wxMin( plus
, minus
);
858 wxString mod
= tmp
.substr( index
, sep
- index
);
869 strcat( buf
, mod
.c_str() );
878 XmString
wxFindAcceleratorText (const char *s
)
881 // VZ: this function returns incorrect keysym which completely breaks kbd
885 // The accelerator text is after the \t char.
886 s
= strchr( s
, '\t' );
888 if( !s
) return NULL
;
890 return wxStringToXmString( s
+ 1 ); // skip TAB!
894 // Change a widget's foreground and background colours.
895 void wxDoChangeForegroundColour(WXWidget widget
, wxColour
& foregroundColour
)
897 // When should we specify the foreground, if it's calculated
898 // by wxComputeColours?
899 // Solution: say we start with the default (computed) foreground colour.
900 // If we call SetForegroundColour explicitly for a control or window,
901 // then the foreground is changed.
902 // Therefore SetBackgroundColour computes the foreground colour, and
903 // SetForegroundColour changes the foreground colour. The ordering is
906 XtVaSetValues ((Widget
) widget
,
907 XmNforeground
, foregroundColour
.AllocColour(XtDisplay((Widget
) widget
)),
911 void wxDoChangeBackgroundColour(WXWidget widget
, wxColour
& backgroundColour
, bool changeArmColour
)
913 wxComputeColours (XtDisplay((Widget
) widget
), & backgroundColour
,
916 XtVaSetValues ((Widget
) widget
,
917 XmNbackground
, g_itemColors
[wxBACK_INDEX
].pixel
,
918 XmNtopShadowColor
, g_itemColors
[wxTOPS_INDEX
].pixel
,
919 XmNbottomShadowColor
, g_itemColors
[wxBOTS_INDEX
].pixel
,
920 XmNforeground
, g_itemColors
[wxFORE_INDEX
].pixel
,
924 XtVaSetValues ((Widget
) widget
,
925 XmNarmColor
, g_itemColors
[wxSELE_INDEX
].pixel
,
929 extern void wxDoChangeFont(WXWidget widget
, wxFont
& font
)
931 // Lesstif 0.87 hangs here, but 0.93 does not
932 #if !wxCHECK_LESSTIF() || wxCHECK_LESSTIF_VERSION( 0, 93 )
933 Widget w
= (Widget
)widget
;
935 wxFont::GetFontTag(), font
.GetFontTypeC( XtDisplay(w
) ),
941 wxString
wxXmStringToString( const XmString
& xmString
)
944 if( XmStringGetLtoR( xmString
, XmSTRING_DEFAULT_CHARSET
, &txt
) )
951 return wxEmptyString
;
954 XmString
wxStringToXmString( const wxString
& str
)
956 return XmStringCreateLtoR((char *)str
.c_str(), XmSTRING_DEFAULT_CHARSET
);
959 XmString
wxStringToXmString( const char* str
)
961 return XmStringCreateLtoR((char *)str
, XmSTRING_DEFAULT_CHARSET
);
964 // ----------------------------------------------------------------------------
965 // wxBitmap utility functions
966 // ----------------------------------------------------------------------------
968 // Creates a bitmap with transparent areas drawn in
970 wxBitmap
wxCreateMaskedBitmap(const wxBitmap
& bitmap
, wxColour
& colour
)
972 wxBitmap
newBitmap(bitmap
.GetWidth(),
978 srcDC
.SelectObject(bitmap
);
979 destDC
.SelectObject(newBitmap
);
981 wxBrush
brush(colour
, wxSOLID
);
982 destDC
.SetBackground(brush
);
984 destDC
.Blit(0, 0, bitmap
.GetWidth(), bitmap
.GetHeight(),
985 &srcDC
, 0, 0, wxCOPY
, true);
990 // ----------------------------------------------------------------------------
991 // Miscellaneous functions
992 // ----------------------------------------------------------------------------
994 WXWidget
wxCreateBorderWidget( WXWidget parent
, long style
)
996 Widget borderWidget
= (Widget
)NULL
, parentWidget
= (Widget
)parent
;
998 if (style
& wxSIMPLE_BORDER
)
1000 borderWidget
= XtVaCreateManagedWidget
1003 xmFrameWidgetClass
, parentWidget
,
1004 XmNshadowType
, XmSHADOW_ETCHED_IN
,
1005 XmNshadowThickness
, 1,
1009 else if (style
& wxSUNKEN_BORDER
)
1011 borderWidget
= XtVaCreateManagedWidget
1014 xmFrameWidgetClass
, parentWidget
,
1015 XmNshadowType
, XmSHADOW_IN
,
1019 else if (style
& wxRAISED_BORDER
)
1021 borderWidget
= XtVaCreateManagedWidget
1024 xmFrameWidgetClass
, parentWidget
,
1025 XmNshadowType
, XmSHADOW_OUT
,
1030 return borderWidget
;