+ /*
+static void _doNothingCallback (Widget, XtPointer, XtPointer)
+{
+}
+*/
+
+// wxXsMDIWindow represents the MDI child frame, as far as the MDI
+// package is concerned.
+// TODO: override raise, so we can tell which is the 'active'
+// (raised) window. We can also use it to send wxActivateEvents,
+// and switching menubars when we make the child frame menubar
+// appear on the parent frame.
+
+// Note: see XsMotifWindow.C, _XsMotifMenu::_processItem for
+// where user menu selections are processed.
+// When Close is selected, _win->close() is called.
+
+class wxXsMDIWindow: public XsMotifWindow
+{
+public:
+ wxMDIChildFrame* m_childFrame;
+
+ wxXsMDIWindow(const char* name, wxMDIChildFrame* frame): XsMotifWindow(name)
+ {
+ m_childFrame = frame;
+ }
+ virtual void setSize(Dimension w, Dimension h)
+ {
+ XsMotifWindow::setSize(w, h);
+
+ // Generate wxSizeEvent here, I think. Maybe also restore, maximize
+ // Probably don't need to generate size event here since work area
+ // is used (???)
+ wxSizeEvent event(wxSize(w, h), m_childFrame->GetId());
+ event.SetEventObject(m_childFrame);
+ m_childFrame->ProcessEvent(event);
+ }
+ virtual void close()
+ {
+ XsMotifWindow::close();
+ m_childFrame->Close();
+ }
+ virtual void raise()
+ {
+ XsMotifWindow::raise();
+ m_childFrame->OnRaise();
+ }
+ virtual void lower()
+ {
+ XsMotifWindow::lower();
+ m_childFrame->OnLower();
+ }
+ virtual void _buildClientArea(Widget parent)
+ {
+ m_childFrame->BuildClientArea((WXWidget) parent);
+
+ // Code from MDI sample
+#if 0
+ assert (parent != 0);
+
+ Widget pulldown;
+ Widget cascade;
+ Widget button;
+
+// Create a main window with some dummy menus
+
+ Widget mainW = XtVaCreateWidget ("mainWin", xmMainWindowWidgetClass, parent,
+ XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM,
+ XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM,
+ NULL);
+
+// Create a menubar
+
+ Widget menuBar = XmCreateMenuBar (mainW, "menuBar", NULL, 0);
+
+// Create the "file" menu
+
+ pulldown = XmCreatePulldownMenu (menuBar, "pulldown", NULL, 0);
+ cascade = XtVaCreateManagedWidget ("fileMenu", xmCascadeButtonGadgetClass,
+ menuBar, XmNsubMenuId, pulldown, NULL);
+
+ button = XtVaCreateManagedWidget ("openMenuItem", xmPushButtonGadgetClass,
+ pulldown, NULL);
+ XtAddCallback (button, XmNactivateCallback, _doNothingCallback, (XtPointer)this);
+
+ button = XtVaCreateManagedWidget ("newMenuItem", xmPushButtonGadgetClass,
+ pulldown, NULL);
+ // XtAddCallback (button, XmNactivateCallback, _newWindowCallback, (XtPointer)this);
+
+// Create the "edit" menu
+
+ pulldown = XmCreatePulldownMenu (menuBar, "pulldown", NULL, 0);
+ cascade = XtVaCreateManagedWidget ("editMenu", xmCascadeButtonGadgetClass,
+ menuBar, XmNsubMenuId, pulldown, NULL);
+
+ button = XtVaCreateManagedWidget ("cutMenuItem", xmPushButtonGadgetClass,
+ pulldown, NULL);
+ XtAddCallback (button, XmNactivateCallback, _doNothingCallback, (XtPointer)this);
+
+ button = XtVaCreateManagedWidget ("copyMenuItem", xmPushButtonGadgetClass,
+ pulldown, NULL);
+ XtAddCallback (button, XmNactivateCallback, _doNothingCallback, (XtPointer)this);
+
+ button = XtVaCreateManagedWidget ("pasteMenuItem", xmPushButtonGadgetClass,
+ pulldown, NULL);
+ XtAddCallback (button, XmNactivateCallback, _doNothingCallback, (XtPointer)this);
+
+// Create the help menu
+
+ pulldown = XmCreatePulldownMenu (menuBar, "pulldown", NULL, 0);
+ cascade = XtVaCreateManagedWidget ("helpMenu", xmCascadeButtonGadgetClass,
+ menuBar, XmNsubMenuId, pulldown, NULL);
+
+ button = XtVaCreateManagedWidget ("aboutMenuItem", xmPushButtonGadgetClass,
+ pulldown, NULL);
+ XtAddCallback (button, XmNactivateCallback, _doNothingCallback, (XtPointer)this);
+
+ XtVaSetValues (menuBar, XmNmenuHelpWidget, cascade, NULL);
+
+// Manage the menubar
+
+ XtManageChild (menuBar);
+
+// Create the work area
+
+ const int nargs = 8;
+ Arg args[nargs];
+ int n;
+
+ n = 0;
+ XtSetArg (args[n], XmNscrollingPolicy, XmAUTOMATIC); n++;
+ XtSetArg (args[n], XmNhighlightThickness, (Dimension)0); n++;
+ XtSetArg (args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
+ XtSetArg (args[n], XmNeditable, True); n++;
+ XtSetArg (args[n], XmNwordWrap, False); n++;
+ XtSetArg (args[n], XmNcursorPositionVisible, True); n++;
+ XtSetArg (args[n], XmNverifyBell, True); n++;
+
+ assert (n <= nargs);
+
+ Widget scrolledText = XmCreateScrolledText (mainW, "scrolledText", args, n);
+ XtManageChild (scrolledText);
+
+// Set the main window area
+
+ XtVaSetValues (mainW, XmNmenuBar, menuBar, XmNworkWindow,
+ XtParent (scrolledText), NULL);
+
+ XtManageChild (mainW);
+#endif
+ }
+ void Show() { show(); }
+};
+