- // VZ: what does this do??
- if (wxTopLevelUsed)
- {
- // Change suggested by Matthew Flatt
- m_frameShell = (WXWidget)XtAppCreateShell
- (
- name,
- wxTheApp->GetClassName(),
- topLevelShellWidgetClass,
- (Display*) wxGetDisplay(),
- NULL,
- 0
- );
- }
- else
- {
- m_frameShell = wxTheApp->GetTopLevelWidget();
- wxTopLevelUsed = TRUE;
- }
-
- XtVaSetValues((Widget) m_frameShell,
- // Allows menu to resize
- XmNallowShellResize, True,
- XmNdeleteResponse, XmDO_NOTHING,
- XmNmappedWhenManaged, False,
- XmNiconic, (style & wxICONIZE) ? TRUE : FALSE,
- NULL);
-
- if (!title.IsEmpty())
- XtVaSetValues((Widget) m_frameShell,
- XmNtitle, title.c_str(),
- NULL);
-
- m_frameWidget = (WXWidget) XtVaCreateManagedWidget("main_window",
- xmMainWindowWidgetClass, (Widget) m_frameShell,
- XmNresizePolicy, XmRESIZE_NONE,
- NULL);
-
- m_workArea = (WXWidget) XtVaCreateWidget("form",
- xmFormWidgetClass, (Widget) m_frameWidget,
- XmNresizePolicy, XmRESIZE_NONE,
- NULL);
-
- m_clientArea = (WXWidget) XtVaCreateWidget("client",
- xmBulletinBoardWidgetClass, (Widget) m_workArea,
- XmNmarginWidth, 0,
- XmNmarginHeight, 0,
- XmNrightAttachment, XmATTACH_FORM,
- XmNleftAttachment, XmATTACH_FORM,
- XmNtopAttachment, XmATTACH_FORM,
- XmNbottomAttachment, XmATTACH_FORM,
- // XmNresizePolicy, XmRESIZE_ANY,
- NULL);
-
- wxLogTrace(wxTRACE_Messages,
- "Created frame (0x%08x) with work area 0x%08x and client "
- "area 0x%08x", m_frameWidget, m_workArea, m_clientArea);
-
- XtAddEventHandler((Widget) m_clientArea, ExposureMask,FALSE,
- wxUniversalRepaintProc, (XtPointer) this);
-
- XtAddEventHandler((Widget) m_clientArea,
- ButtonPressMask | ButtonReleaseMask | PointerMotionMask | KeyPressMask,
- FALSE,
- wxFrameEventHandler,
- (XtPointer)this);
-
- XtVaSetValues((Widget) m_frameWidget,
- XmNworkWindow, (Widget) m_workArea,
- NULL);
-
- XtManageChild((Widget) m_clientArea);
- XtManageChild((Widget) m_workArea);
-
- wxAddWindowToTable((Widget) m_workArea, this);
- wxAddWindowToTable((Widget) m_clientArea, this);
-
- XtTranslations ptr;
-
- XtOverrideTranslations((Widget) m_workArea,
- ptr = XtParseTranslationTable("<Configure>: resize()"));
-
- XtFree((char *)ptr);
-
- XtAddCallback((Widget) m_workArea, XmNfocusCallback,
- (XtCallbackProc)wxFrameFocusProc, (XtPointer)this);
-
- /* Part of show-&-hide fix */
- XtAddEventHandler((Widget) m_frameShell, StructureNotifyMask,
- False, (XtEventHandler)wxFrameMapProc,
- (XtPointer)m_workArea);
-
- if (x > -1)
- XtVaSetValues((Widget) m_frameShell, XmNx, x, NULL);
- if (y > -1)
- XtVaSetValues((Widget) m_frameShell, XmNy, y, NULL);
- if (width > -1)
- XtVaSetValues((Widget) m_frameShell, XmNwidth, width, NULL);
- if (height > -1)
- XtVaSetValues((Widget) m_frameShell, XmNheight, height, NULL);
-
- m_mainWidget = m_frameWidget;
-
- ChangeFont(FALSE);
-
- // This patch comes from Torsten Liermann lier@lier1.muc.de
- if (XmIsMotifWMRunning( (Widget) m_frameShell ))
- {
- int decor = 0;
- if (style & wxRESIZE_BORDER)
- decor |= MWM_DECOR_RESIZEH;
- if (style & wxSYSTEM_MENU)
- decor |= MWM_DECOR_MENU;
- if ((style & wxCAPTION) ||
- (style & wxTINY_CAPTION_HORIZ) ||
- (style & wxTINY_CAPTION_VERT))
- decor |= MWM_DECOR_TITLE;
- if (style & wxTHICK_FRAME)
- decor |= MWM_DECOR_BORDER;
- if (style & wxTHICK_FRAME)
- decor |= MWM_DECOR_BORDER;
- if (style & wxMINIMIZE_BOX)
- decor |= MWM_DECOR_MINIMIZE;
- if (style & wxMAXIMIZE_BOX)
- decor |= MWM_DECOR_MAXIMIZE;
- XtVaSetValues((Widget) m_frameShell,XmNmwmDecorations,decor,NULL);
- }
- // This allows non-Motif window managers to support at least the
- // no-decorations case.
- else