#pragma implementation "dialog.h"
#endif
+#ifdef __VMS
+#define XtDisplay XTDISPLAY
+#define XtWindow XTWINDOW
+#define XtParent XTPARENT
+#define XtScreen XTSCREEN
+#endif
+
#include "wx/dialog.h"
#include "wx/utils.h"
#include "wx/frame.h"
#include "wx/app.h"
#include "wx/settings.h"
+#ifdef __VMS__
+#pragma message disable nosimpint
+#endif
#include <Xm/Xm.h>
#include <X11/Shell.h>
#if XmVersion > 1000
#include <Xm/Protocols.h>
#endif
+#ifdef __VMS__
+#pragma message enable nosimpint
+#endif
#include "wx/motif/private.h"
wxList wxModelessWindows; // Frames and modeless dialogs
extern wxList wxPendingDelete;
-extern wxHashTable *wxWidgetHashTable;
-
#define wxUSE_INVISIBLE_RESIZE 1
-#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxPanel)
BEGIN_EVENT_TABLE(wxDialog, wxPanel)
-EVT_BUTTON(wxID_OK, wxDialog::OnOK)
-EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
-EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
-EVT_CHAR_HOOK(wxDialog::OnCharHook)
-EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged)
-EVT_CLOSE(wxDialog::OnCloseWindow)
+ EVT_SIZE(wxDialog::OnSize)
+ EVT_BUTTON(wxID_OK, wxDialog::OnOK)
+ EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
+ EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
+ EVT_CHAR_HOOK(wxDialog::OnCharHook)
+ EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged)
+ EVT_CLOSE(wxDialog::OnCloseWindow)
END_EVENT_TABLE()
-#endif
wxDialog::wxDialog()
{
m_modalShowing = FALSE;
- m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
+ m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
}
bool wxDialog::Create(wxWindow *parent, wxWindowID id,
m_modalShowing = FALSE;
m_dialogTitle = title;
- m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
+ m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
m_foregroundColour = *wxBLACK;
SetName(name);
XmStringFree(str);
}
- m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
+ m_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
ChangeFont(FALSE);
wxAddWindowToTable(dialogShell, this);
wxDialog::~wxDialog()
{
+ m_isBeingDeleted = TRUE;
+
if (m_mainWidget)
XtRemoveEventHandler((Widget) m_mainWidget, ExposureMask, FALSE,
wxUniversalRepaintProc, (XtPointer) this);
// XtVaSetValues((Widget) m_mainWidget, XmNiconic, iconize, NULL);
}
+// Default resizing behaviour - if only ONE subwindow,
+// resize to client rectangle size
+void wxDialog::OnSize(wxSizeEvent& WXUNUSED(event))
+{
+ // if we're using constraints - do use them
+#if wxUSE_CONSTRAINTS
+ if ( GetAutoLayout() ) {
+ Layout();
+ return;
+ }
+#endif
+
+ // do we have _exactly_ one child?
+ wxWindow *child = NULL;
+ for ( wxNode *node = GetChildren().First(); node; node = node->Next() )
+ {
+ wxWindow *win = (wxWindow *)node->Data();
+ if ( !win->IsKindOf(CLASSINFO(wxFrame)) &&
+ !win->IsKindOf(CLASSINFO(wxDialog)) )
+ {
+ if ( child )
+ return; // it's our second subwindow - nothing to do
+ child = win;
+ }
+ }
+
+ if ( child ) {
+ // we have exactly one child - set it's size to fill the whole frame
+ int clientW, clientH;
+ GetClientSize(&clientW, &clientH);
+
+ int x = 0;
+ int y = 0;
+
+ child->SetSize(x, y, clientW, clientH);
+ }
+}
+
+
bool wxDialog::IsIconized() const
{
/*
XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
wxTheApp->ProcessXEvent((WXEvent*) &event);
+
+ if (XtAppPending( (XtAppContext) wxTheApp->GetAppContext() ) == 0)
+ {
+ if (!wxTheApp->ProcessIdle())
+ {
+#if wxUSE_THREADS
+ // leave the main loop to give other threads a chance to
+ // perform their GUI work
+ wxMutexGuiLeave();
+ wxUsleep(20);
+ wxMutexGuiEnter();
+#endif
+ }
+ }
}
// Remove modal dialog flag from stack
}
}
-void wxDialog::OnCloseWindow(wxCloseEvent& event)
+void wxDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
{
// We'll send a Cancel message by default,
// which may close the dialog.
void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event))
{
- SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
+ SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
Refresh();
}