#include "wx/motif/private.h"
-extern wxHashTable *wxWidgetHashTable;
-
void wxCloseFrameCallback(Widget, XtPointer, XmAnyCallbackStruct *cbs);
void wxFrameFocusProc(Widget workArea, XtPointer clientData,
XmAnyCallbackStruct *cbs);
#if !USE_SHARED_LIBRARY
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
-EVT_SIZE(wxFrame::OnSize)
-EVT_ACTIVATE(wxFrame::OnActivate)
-EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
-EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
-EVT_IDLE(wxFrame::OnIdle)
-EVT_CLOSE(wxFrame::OnCloseWindow)
+ EVT_SIZE(wxFrame::OnSize)
+ EVT_ACTIVATE(wxFrame::OnActivate)
+ EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
+ EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
+ EVT_IDLE(wxFrame::OnIdle)
+ EVT_CLOSE(wxFrame::OnCloseWindow)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
wxModelessWindows.Append(this);
- int x = pos.x; int y = pos.y;
- int width = size.x; int height = size.y;
+ int x = pos.x, y = pos.y;
+ int width = size.x, height = size.y;
+
+ // Set reasonable values for position and size if defaults have been
+ // requested
+ //
+ // MB TODO: something better than these arbitrary values ?
+ // VZ should use X resources for this...
+ if ( width == -1 )
+ width = 400;
+ if ( height == -1 )
+ height = 400;
+
+ int displayW, displayH;
+ wxDisplaySize( &displayW, &displayH );
+
+ if ( x == -1 )
+ {
+ x = (displayW - width) / 2;
+ if (x < 10) x = 10;
+ }
+ if ( y == -1 )
+ {
+ y = (displayH - height) / 2;
+ if (y < 10) y = 10;
+ }
if (wxTopLevelUsed)
+ {
// Change suggested by Matthew Flatt
- m_frameShell = (WXWidget) XtAppCreateShell(name, wxTheApp->GetClassName(), topLevelShellWidgetClass, (Display*) wxGetDisplay(), NULL, 0);
+ m_frameShell = (WXWidget)XtAppCreateShell
+ (
+ name,
+ wxTheApp->GetClassName(),
+ topLevelShellWidgetClass,
+ (Display*) wxGetDisplay(),
+ NULL,
+ 0
+ );
+ }
else
{
m_frameShell = wxTheApp->GetTopLevelWidget();
// XmNresizePolicy, XmRESIZE_ANY,
NULL);
+ wxLogDebug("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);
XtManageChild((Widget) m_clientArea);
XtManageChild((Widget) m_workArea);
- wxASSERT_MSG( !wxGetWindowFromTable((Widget)m_workArea),
- "Widget table clash in frame.cpp") ;
-
wxAddWindowToTable((Widget) m_workArea, this);
XtTranslations ptr ;
wxFrame::~wxFrame()
{
+ m_isBeingDeleted = TRUE;
+
if (m_clientArea)
XtRemoveEventHandler((Widget) m_clientArea, ExposureMask, FALSE,
wxUniversalRepaintProc, (XtPointer) this);