+extern void wxDoChangeFont(WXWidget widget, wxFont& font)
+{
+ // Lesstif 0.87 hangs here, but 0.93 does not
+#if !wxCHECK_LESSTIF() || wxCHECK_LESSTIF_VERSION( 0, 93 )
+ Widget w = (Widget)widget;
+ XtVaSetValues( w,
+ wxFont::GetFontTag(), font.GetFontType( XtDisplay(w) ),
+ NULL );
+#endif
+
+}
+
+wxString wxXmStringToString( const XmString& xmString )
+{
+ char *txt;
+ if( XmStringGetLtoR( xmString, XmSTRING_DEFAULT_CHARSET, &txt ) )
+ {
+ wxString str(txt);
+ XtFree (txt);
+ return str;
+ }
+
+ return wxEmptyString;
+}
+
+XmString wxStringToXmString( const wxString& str )
+{
+ return XmStringCreateLtoR((char *)str.c_str(), XmSTRING_DEFAULT_CHARSET);
+}
+
+XmString wxStringToXmString( const char* str )
+{
+ return XmStringCreateLtoR((char *)str, XmSTRING_DEFAULT_CHARSET);
+}
+
+// ----------------------------------------------------------------------------
+// wxBitmap utility functions
+// ----------------------------------------------------------------------------
+
+// Creates a bitmap with transparent areas drawn in
+// the given colour.
+wxBitmap wxCreateMaskedBitmap(const wxBitmap& bitmap, wxColour& colour)
+{
+ wxBitmap newBitmap(bitmap.GetWidth(),
+ bitmap.GetHeight(),
+ bitmap.GetDepth());
+ wxMemoryDC destDC;
+ wxMemoryDC srcDC;
+
+ srcDC.SelectObject(bitmap);
+ destDC.SelectObject(newBitmap);
+
+ wxBrush brush(colour, wxSOLID);
+ // destDC.SetOptimization(FALSE);
+ destDC.SetBackground(brush);
+ destDC.Clear();
+ destDC.Blit(0, 0, bitmap.GetWidth(), bitmap.GetHeight(),
+ &srcDC, 0, 0, wxCOPY, TRUE);
+
+ 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;
+}