Quick hack to rid the code of wxDIALOG_MODAL

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26773 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott
2004-04-14 16:03:53 +00:00
parent 6919b35eb4
commit 2c326adae6
2 changed files with 12 additions and 8 deletions

View File

@@ -30,7 +30,7 @@ class WXDLLEXPORT wxDialog : public wxDialogBase
DECLARE_DYNAMIC_CLASS(wxDialog) DECLARE_DYNAMIC_CLASS(wxDialog)
public: public:
wxDialog(); wxDialog() { Init(); }
// Constructor with a modal flag, but no window id - the old convention // Constructor with a modal flag, but no window id - the old convention
wxDialog(wxWindow *parent, wxDialog(wxWindow *parent,
@@ -39,9 +39,10 @@ public:
long style = wxDEFAULT_DIALOG_STYLE, long style = wxDEFAULT_DIALOG_STYLE,
const wxString& name = wxDialogNameStr) const wxString& name = wxDialogNameStr)
{ {
long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ; Init();
m_isModalStyle = modal;
Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), Create(parent, -1, title, wxPoint(x, y), wxSize(width, height),
style | modalStyle, name); style, name);
} }
// Constructor with no modal flag - the new convention. // Constructor with no modal flag - the new convention.
@@ -52,6 +53,7 @@ public:
long style = wxDEFAULT_DIALOG_STYLE, long style = wxDEFAULT_DIALOG_STYLE,
const wxString& name = wxDialogNameStr) const wxString& name = wxDialogNameStr)
{ {
Init();
Create(parent, id, title, pos, size, style, name); Create(parent, id, title, pos, size, style, name);
} }
@@ -98,6 +100,8 @@ public:
void DoShowModal(); void DoShowModal();
private: private:
void Init();
bool m_isModalStyle;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -44,9 +44,9 @@ END_EVENT_TABLE()
#endif #endif
wxDialog::wxDialog() void wxDialog::Init()
{ {
m_isShown = FALSE; m_isModalStyle = false;
} }
bool wxDialog::Create(wxWindow *parent, wxWindowID id, bool wxDialog::Create(wxWindow *parent, wxWindowID id,
@@ -71,7 +71,7 @@ void wxDialog::SetModal(bool flag)
{ {
if ( flag ) if ( flag )
{ {
m_windowStyle |= wxDIALOG_MODAL; m_isModalStyle = true;
wxModelessWindows.DeleteObject(this); wxModelessWindows.DeleteObject(this);
#if TARGET_CARBON #if TARGET_CARBON
@@ -80,7 +80,7 @@ void wxDialog::SetModal(bool flag)
} }
else else
{ {
m_windowStyle &= ~wxDIALOG_MODAL; m_isModalStyle = false;
wxModelessWindows.Append(this); wxModelessWindows.Append(this);
} }
@@ -113,7 +113,7 @@ void wxDialog::OnCharHook(wxKeyEvent& event)
bool wxDialog::IsModal() const bool wxDialog::IsModal() const
{ {
return (GetWindowStyleFlag() & wxDIALOG_MODAL) != 0; return m_isModalStyle;
} }