Factored out some common code.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20616 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon
2003-05-12 20:04:08 +00:00
parent 11eadd92f3
commit 6769d0cbf3
3 changed files with 52 additions and 43 deletions

View File

@@ -38,6 +38,12 @@ class WXDLLEXPORT wxColour;
#define wxCHECK_LESSTIF() ( defined(LesstifVersion) && LesstifVersion > 0 ) #define wxCHECK_LESSTIF() ( defined(LesstifVersion) && LesstifVersion > 0 )
// ----------------------------------------------------------------------------
// Miscellaneous functions
// ----------------------------------------------------------------------------
WXWidget wxCreateBorderWidget( WXWidget parent, long style );
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// common callbacks // common callbacks
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -40,6 +40,8 @@
#include "wx/unix/execute.h" #include "wx/unix/execute.h"
#include <Xm/Xm.h> #include <Xm/Xm.h>
#include <Xm/Frame.h>
#include "wx/motif/private.h" #include "wx/motif/private.h"
#if wxUSE_RESOURCES #if wxUSE_RESOURCES
@@ -1211,3 +1213,46 @@ wxBitmap wxCreateMaskedBitmap(const wxBitmap& bitmap, wxColour& colour)
return newBitmap; 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;
}

View File

@@ -277,36 +277,7 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
XtAppAddActions ((XtAppContext) wxTheApp->GetAppContext(), actions, 1); XtAppAddActions ((XtAppContext) wxTheApp->GetAppContext(), actions, 1);
Widget parentWidget = (Widget) parent->GetClientWidget(); Widget parentWidget = (Widget) parent->GetClientWidget();
m_borderWidget = wxCreateBorderWidget( (WXWidget)parentWidget, style );
if (style & wxSIMPLE_BORDER)
{
m_borderWidget = (WXWidget)XtVaCreateManagedWidget
(
"canvasBorder",
xmFrameWidgetClass, parentWidget,
XmNshadowType, XmSHADOW_IN,
XmNshadowThickness, 1,
NULL
);
} else if (style & wxSUNKEN_BORDER)
{
m_borderWidget = (WXWidget)XtVaCreateManagedWidget
(
"canvasBorder",
xmFrameWidgetClass, parentWidget,
XmNshadowType, XmSHADOW_IN,
NULL
);
} else if (style & wxRAISED_BORDER)
{
m_borderWidget = (WXWidget)XtVaCreateManagedWidget
(
"canvasBorder",
xmFrameWidgetClass, parentWidget,
XmNshadowType, XmSHADOW_OUT,
NULL
);
}
m_scrolledWindow = (WXWidget)XtVaCreateManagedWidget m_scrolledWindow = (WXWidget)XtVaCreateManagedWidget
( (
@@ -360,12 +331,6 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
XtAddCallback ((Widget) m_drawingArea, XmNexposeCallback, (XtCallbackProc) wxCanvasRepaintProc, (XtPointer) this); XtAddCallback ((Widget) m_drawingArea, XmNexposeCallback, (XtCallbackProc) wxCanvasRepaintProc, (XtPointer) this);
XtAddCallback ((Widget) m_drawingArea, XmNinputCallback, (XtCallbackProc) wxCanvasInputEvent, (XtPointer) this); XtAddCallback ((Widget) m_drawingArea, XmNinputCallback, (XtCallbackProc) wxCanvasInputEvent, (XtPointer) this);
// TODO?
#if 0
display = XtDisplay (scrolledWindow);
xwindow = XtWindow (drawingArea);
#endif // 0
XtAddEventHandler( XtAddEventHandler(
(Widget)m_drawingArea, (Widget)m_drawingArea,
PointerMotionHintMask | EnterWindowMask | PointerMotionHintMask | EnterWindowMask |
@@ -386,13 +351,6 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
(Widget) 0, (Widget) 0, (Widget) 0, (Widget) 0,
(Widget) m_drawingArea); (Widget) m_drawingArea);
#if 0
if (m_hScrollBar)
XtRealizeWidget ((Widget) m_hScrollBar);
if (m_vScrollBar)
XtRealizeWidget ((Widget) m_vScrollBar);
#endif // 0
// Without this, the cursor may not be restored properly (e.g. in splitter // Without this, the cursor may not be restored properly (e.g. in splitter
// sample). // sample).
SetCursor(*wxSTANDARD_CURSOR); SetCursor(*wxSTANDARD_CURSOR);