+}
+
+// real construction (Init() must have been called before!)
+bool wxWindow::Create(wxWindow *parent, wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name)
+{
+ // Get default border
+ wxBorder border = GetBorder(style);
+ style &= ~wxBORDER_MASK;
+ style |= border;
+
+ wxCHECK_MSG( parent, false, "can't create wxWindow without parent" );
+
+ CreateBase(parent, id, pos, size, style, wxDefaultValidator, name);
+
+ parent->AddChild(this);
+ PreCreation();
+
+ //// TODO: we should probably optimize by only creating a
+ //// a drawing area if we have one or more scrollbars (wxVSCROLL/wxHSCROLL).
+ //// But for now, let's simplify things by always creating the
+ //// drawing area, since otherwise the translations are different.
+
+ // New translations for getting mouse motion feedback
+ static const String translations = wxMOTIF_STR(
+"<Btn1Motion>: wxCanvasMotionEvent() DrawingAreaInput() ManagerGadgetButtonMotion()\n\
+<Btn2Motion>: wxCanvasMotionEvent() DrawingAreaInput() ManagerGadgetButtonMotion()\n\
+<Btn3Motion>: wxCanvasMotionEvent() DrawingAreaInput() ManagerGadgetButtonMotion()\n\
+<BtnMotion>: wxCanvasMotionEvent() DrawingAreaInput() ManagerGadgetButtonMotion()\n\
+<Btn1Down>: DrawingAreaInput() ManagerGadgetArm()\n\
+<Btn2Down>: DrawingAreaInput() ManagerGadgetArm()\n\
+<Btn3Down>: DrawingAreaInput() ManagerGadgetArm()\n\
+<Btn1Up>: DrawingAreaInput() ManagerGadgetActivate()\n\
+<Btn2Up>: DrawingAreaInput() ManagerGadgetActivate()\n\
+<Btn3Up>: DrawingAreaInput() ManagerGadgetActivate()\n\
+<Motion>: wxCanvasMotionEvent() DrawingAreaInput()\n\
+<EnterWindow>: wxCanvasMotionEvent() DrawingAreaInput()\n\
+<LeaveWindow>: wxCanvasMotionEvent() DrawingAreaInput()\n\
+<Key>: DrawingAreaInput()");
+
+ XtActionsRec actions[1];
+ actions[0].string = wxMOTIF_STR("wxCanvasMotionEvent");
+ actions[0].proc = (XtActionProc) wxCanvasMotionEvent;
+ XtAppAddActions ((XtAppContext) wxTheApp->GetAppContext(), actions, 1);
+
+ Widget parentWidget = (Widget) parent->GetClientWidget();
+ m_borderWidget = wxCreateBorderWidget( (WXWidget)parentWidget, style );
+
+ m_scrolledWindow = (WXWidget)XtVaCreateManagedWidget
+ (
+ "scrolledWindow",
+ xmScrolledWindowWidgetClass,
+ m_borderWidget ? (Widget) m_borderWidget
+ : parentWidget,
+ XmNresizePolicy, XmRESIZE_NONE,
+ XmNspacing, 0,
+ XmNscrollingPolicy, XmAPPLICATION_DEFINED,
+ //XmNscrollBarDisplayPolicy, XmAS_NEEDED,
+ NULL
+ );
+
+ XtTranslations ptr = XtParseTranslationTable(translations);
+ m_drawingArea = (WXWidget)XtVaCreateWidget
+ (
+ name,
+ xmDrawingAreaWidgetClass, (Widget) m_scrolledWindow,
+ XmNunitType, XmPIXELS,
+ // XmNresizePolicy, XmRESIZE_ANY,
+ XmNresizePolicy, XmRESIZE_NONE,
+ XmNmarginHeight, 0,
+ XmNmarginWidth, 0,
+ XmNtranslations, ptr,
+ NULL
+ );
+ XtFree((char *) ptr);
+
+#if 0
+ if (GetWindowStyleFlag() & wxOVERRIDE_KEY_TRANSLATIONS)
+ {
+ ptr = XtParseTranslationTable ("<Key>: DrawingAreaInput()");
+ XtOverrideTranslations ((Widget) m_drawingArea, ptr);
+ XtFree ((char *) ptr);
+ }
+#endif // 0
+
+ wxAddWindowToTable((Widget) m_drawingArea, this);
+ wxAddWindowToTable((Widget) m_scrolledWindow, this);
+
+ // This order is very important in Motif 1.2.1
+ XtRealizeWidget ((Widget) m_scrolledWindow);
+ XtRealizeWidget ((Widget) m_drawingArea);
+ XtManageChild ((Widget) m_drawingArea);
+
+ ptr = XtParseTranslationTable("<Configure>: resize()");
+ XtOverrideTranslations((Widget) m_drawingArea, ptr);
+ XtFree ((char *) ptr);
+
+ XtAddCallback ((Widget) m_drawingArea, XmNexposeCallback, (XtCallbackProc) wxCanvasRepaintProc, (XtPointer) this);
+ XtAddCallback ((Widget) m_drawingArea, XmNinputCallback, (XtCallbackProc) wxCanvasInputEvent, (XtPointer) this);
+
+ XtAddEventHandler(
+ (Widget)m_drawingArea,
+ PointerMotionHintMask | EnterWindowMask |
+ LeaveWindowMask | FocusChangeMask,
+ False,
+ (XtEventHandler) wxCanvasEnterLeave,
+ (XtPointer) this
+ );
+
+ XmScrolledWindowSetAreas(
+ (Widget)m_scrolledWindow,
+ (Widget) 0, (Widget) 0,
+ (Widget) m_drawingArea);
+
+ PostCreation();
+
+ // Without this, the cursor may not be restored properly (e.g. in splitter
+ // sample).
+ SetCursor(*wxSTANDARD_CURSOR);
+ DoSetSizeIntr(pos.x, pos.y, size.x,size.y, wxSIZE_AUTO, true);
+ return true;