]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/utils.cpp
applied patch #928786: "Fix memory leak produced by ConvertArgsToUnicode()"
[wxWidgets.git] / src / motif / utils.cpp
index c43fe3189b5573b097002ad572f2f80ed9259287..77bdbe3d6bb5a82358cd46a7fe74aec3dd81091b 100644 (file)
@@ -22,6 +22,7 @@
 #endif
 #include "wx/setup.h"
 #include "wx/utils.h"
+#include "wx/apptrait.h"
 #include "wx/app.h"
 #include "wx/dcmemory.h"
 #include "wx/bitmap.h"
@@ -40,6 +41,8 @@
 #include "wx/unix/execute.h"
 
 #include <Xm/Xm.h>
+#include <Xm/Frame.h>
+
 #include "wx/motif/private.h"
 
 #if wxUSE_RESOURCES
@@ -124,25 +127,34 @@ int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
 // ----------------------------------------------------------------------------
 
 // Emit a beeeeeep
+#ifndef __EMX__
+// on OS/2, we use the wxBell from wxBase library (src/os2/utils.cpp)
 void wxBell()
 {
     // Use current setting for the bell
     XBell (wxGlobalDisplay(), 0);
 }
+#endif
 
-int wxGetOsVersion(int *majorVsn, int *minorVsn)
+wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
 {
+    static wxToolkitInfo info;
+
+    info.shortName = _T("motif");
+    info.name = _T("wxMotif");
+#ifdef __WXUNIVERSAL__
+    info.shortName << _T("univ");
+    info.name << _T("/wxUniversal");
+#endif
     // FIXME TODO
     // This code is WRONG!! Does NOT return the
     // Motif version of the libs but the X protocol
     // version!
     Display *display = wxGlobalDisplay();
-    if (majorVsn)
-        *majorVsn = ProtocolVersion (display);
-    if (minorVsn)
-        *minorVsn = ProtocolRevision (display);
-
-    return wxMOTIF_X;
+    info.versionMajor = ProtocolVersion (display);
+    info.versionMinor = ProtocolRevision (display);
+    info.os = wxMOTIF_X;
+    return info;
 }
 
 // ----------------------------------------------------------------------------
@@ -1211,3 +1223,46 @@ wxBitmap wxCreateMaskedBitmap(const wxBitmap& bitmap, wxColour& colour)
 
     return newBitmap;
 }
+
+// ----------------------------------------------------------------------------
+// Miscellaneous functions
+// ----------------------------------------------------------------------------
+
+WXWidget wxCreateBorderWidget( WXWidget parent, long style )
+{
+    Widget borderWidget = (Widget)NULL, parentWidget = (Widget)parent;
+
+    if (style & wxSIMPLE_BORDER)
+    {
+        borderWidget = XtVaCreateManagedWidget
+                                   (
+                                    "simpleBorder",
+                                    xmFrameWidgetClass, parentWidget,
+                                    XmNshadowType, XmSHADOW_ETCHED_IN,
+                                    XmNshadowThickness, 1,
+                                    NULL
+                                   );
+    }
+    else if (style & wxSUNKEN_BORDER)
+    {
+        borderWidget = XtVaCreateManagedWidget
+                                   (
+                                    "sunkenBorder",
+                                    xmFrameWidgetClass, parentWidget,
+                                    XmNshadowType, XmSHADOW_IN,
+                                    NULL
+                                   );
+    }
+    else if (style & wxRAISED_BORDER)
+    {
+        borderWidget = XtVaCreateManagedWidget
+                                   (
+                                    "raisedBorder",
+                                    xmFrameWidgetClass, parentWidget,
+                                    XmNshadowType, XmSHADOW_OUT,
+                                    NULL
+                                   );
+    }
+
+    return borderWidget;
+}