1. fixed default dialog style to make them non resizeable again
2. fixed wxFrame::IsShown() which always returned TRUE before 3. wxWizard now calls TransferDataFromWindow() before calling wxWizardPage::GetNext() fixing an obvious bug 4. half-fixed fatal bug in wxDialog::ShowModal() which would crash if the top level app window was deleted while the modal dialog was shown git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7538 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -926,14 +926,16 @@ enum wxStretch
|
||||
#endif
|
||||
|
||||
#define wxDEFAULT_FRAME_STYLE \
|
||||
(wxSYSTEM_MENU | wxRESIZE_BORDER | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN)
|
||||
(wxSYSTEM_MENU | wxRESIZE_BORDER | \
|
||||
wxMINIMIZE_BOX | wxMAXIMIZE_BOX | \
|
||||
wxCAPTION | wxCLIP_CHILDREN)
|
||||
|
||||
#ifdef __WXMSW__
|
||||
# define wxDEFAULT_DIALOG_STYLE (wxSYSTEM_MENU|wxCAPTION|wxTHICK_FRAME)
|
||||
# define wxDEFAULT_DIALOG_STYLE (wxSYSTEM_MENU | wxCAPTION)
|
||||
#else
|
||||
// Under Unix, the dialogs don't have a system menu. Specifying
|
||||
// wxSYSTEM_MENU here, will make a close button appear.
|
||||
# define wxDEFAULT_DIALOG_STYLE (wxCAPTION|wxTHICK_FRAME)
|
||||
// Under Unix, the dialogs don't have a system menu. Specifying wxSYSTEM_MENU
|
||||
// here will make a close button appear.
|
||||
# define wxDEFAULT_DIALOG_STYLE wxCAPTION
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@@ -204,7 +204,7 @@ void wxListBase::DoCopy(const wxListBase& list)
|
||||
}
|
||||
}
|
||||
|
||||
wxASSERT_MSG( m_count = list.m_count, _T("logic error in wxList::DoCopy") );
|
||||
wxASSERT_MSG( m_count == list.m_count, _T("logic error in wxList::DoCopy") );
|
||||
}
|
||||
|
||||
wxListBase::~wxListBase()
|
||||
|
@@ -100,10 +100,6 @@ private:
|
||||
wxArrayInt m_severity;
|
||||
wxArrayLong m_times;
|
||||
|
||||
// the sizer containing the buttons to which we dynamically add (and
|
||||
// remove) the "Save" button
|
||||
wxBoxSizer *m_sizerButtons;
|
||||
|
||||
// the "toggle" button and its state
|
||||
wxButton *m_btnDetails;
|
||||
bool m_showingDetails;
|
||||
@@ -715,9 +711,11 @@ wxLogDialog::wxLogDialog(wxWindow *parent,
|
||||
|
||||
m_showingDetails = FALSE; // not initially
|
||||
m_listctrl = (wxListCtrl *)NULL;
|
||||
|
||||
#if wxUSE_STATLINE
|
||||
m_statline = (wxStaticLine *)NULL;
|
||||
#endif // wxUSE_STATLINE
|
||||
|
||||
#if wxUSE_FILE
|
||||
m_btnSave = (wxButton *)NULL;
|
||||
#endif // wxUSE_FILE
|
||||
@@ -726,13 +724,13 @@ wxLogDialog::wxLogDialog(wxWindow *parent,
|
||||
// sizers even though our window is not resizeable to calculate the size of
|
||||
// the dialog properly
|
||||
wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
|
||||
m_sizerButtons = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer *sizerButtons = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer *sizerAll = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
wxButton *btnOk = new wxButton(this, wxID_OK, _("OK"));
|
||||
m_sizerButtons->Add(btnOk, 0, wxCENTRE|wxBOTTOM, MARGIN/2);
|
||||
sizerButtons->Add(btnOk, 0, wxCENTRE|wxBOTTOM, MARGIN/2);
|
||||
m_btnDetails = new wxButton(this, wxID_MORE, ms_details + _T(" >>"));
|
||||
m_sizerButtons->Add(m_btnDetails, 0, wxCENTRE|wxTOP, MARGIN/2 - 1);
|
||||
sizerButtons->Add(m_btnDetails, 0, wxCENTRE|wxTOP, MARGIN/2 - 1);
|
||||
|
||||
#ifndef __WIN16__
|
||||
wxIcon icon = wxTheApp->GetStdIcon((int)(style & wxICON_MASK));
|
||||
@@ -741,7 +739,7 @@ wxLogDialog::wxLogDialog(wxWindow *parent,
|
||||
|
||||
const wxString& message = messages.Last();
|
||||
sizerAll->Add(CreateTextSizer(message), 0, wxCENTRE|wxLEFT|wxRIGHT, MARGIN);
|
||||
sizerAll->Add(m_sizerButtons, 0, wxALIGN_RIGHT|wxLEFT, MARGIN);
|
||||
sizerAll->Add(sizerButtons, 0, wxALIGN_RIGHT|wxLEFT, MARGIN);
|
||||
|
||||
sizerTop->Add(sizerAll, 0, wxCENTRE|wxALL, MARGIN);
|
||||
|
||||
@@ -874,7 +872,7 @@ void wxLogDialog::CreateDetailsControls()
|
||||
|
||||
int y;
|
||||
GetTextExtent(_T("H"), (int*)NULL, &y, (int*)NULL, (int*)NULL, &font);
|
||||
int height = wxMin(y*(count + 3), 100);
|
||||
int height = wxMax(y*(count + 3), 100);
|
||||
m_listctrl->SetSize(-1, height);
|
||||
}
|
||||
|
||||
@@ -948,7 +946,7 @@ void wxLogDialog::OnDetails(wxCommandEvent& WXUNUSED(event))
|
||||
#endif // wxUSE_STATLINE
|
||||
|
||||
#if wxUSE_FILE
|
||||
m_sizerButtons->Remove(m_btnSave);
|
||||
sizer->Remove(m_btnSave);
|
||||
#endif // wxUSE_FILE
|
||||
}
|
||||
else // show details now
|
||||
@@ -960,24 +958,20 @@ void wxLogDialog::OnDetails(wxCommandEvent& WXUNUSED(event))
|
||||
CreateDetailsControls();
|
||||
}
|
||||
|
||||
#if wxUSE_FILE
|
||||
m_sizerButtons->Add(m_btnSave, 0, wxCENTRE|wxTOP, MARGIN);
|
||||
#endif // wxUSE_FILE
|
||||
|
||||
#if wxUSE_STATLINE
|
||||
sizer->Add(m_statline, 0, wxEXPAND | (wxALL & ~wxTOP), MARGIN);
|
||||
#endif // wxUSE_STATLINE
|
||||
|
||||
sizer->Add(m_listctrl, 1, wxEXPAND | (wxALL & ~wxTOP), MARGIN);
|
||||
|
||||
#if wxUSE_FILE
|
||||
sizer->Add(m_btnSave, 0, wxALIGN_RIGHT | (wxALL & ~wxTOP), MARGIN);
|
||||
#endif // wxUSE_FILE
|
||||
}
|
||||
|
||||
m_showingDetails = !m_showingDetails;
|
||||
|
||||
// in any case, our size changed - update
|
||||
#if wxUSE_FILE
|
||||
m_sizerButtons->RecalcSizes();
|
||||
#endif // wxUSE_FILE
|
||||
|
||||
sizer->SetSizeHints(this);
|
||||
sizer->Fit(this);
|
||||
|
||||
|
@@ -224,13 +224,6 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward)
|
||||
|
||||
if ( m_page )
|
||||
{
|
||||
// ask the current page first
|
||||
if ( !m_page->TransferDataFromWindow() )
|
||||
{
|
||||
// the page data is incorrect
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// send the event to the old page
|
||||
wxWizardEvent event(wxEVT_WIZARD_PAGE_CHANGING, GetId(), goingForward);
|
||||
if ( m_page->GetEventHandler()->ProcessEvent(event) &&
|
||||
@@ -343,6 +336,15 @@ void wxWizard::OnBackOrNext(wxCommandEvent& event)
|
||||
(event.GetEventObject() == m_btnPrev),
|
||||
wxT("unknown button") );
|
||||
|
||||
// ask the current page first: notice that we do it before calling
|
||||
// GetNext/Prev() because the data transfered from the controls of the page
|
||||
// may change the value returned by these methods
|
||||
if ( m_page && !m_page->TransferDataFromWindow() )
|
||||
{
|
||||
// the page data is incorrect, don't do anything
|
||||
return;
|
||||
}
|
||||
|
||||
bool forward = event.GetEventObject() == m_btnNext;
|
||||
|
||||
wxWizardPage *page;
|
||||
|
@@ -338,10 +338,6 @@ void wxDialog::DoShowModal()
|
||||
{
|
||||
m_oldFocus = parent;
|
||||
}
|
||||
if ( !m_oldFocus )
|
||||
{
|
||||
m_oldFocus = wxTheApp->GetTopWindow();
|
||||
}
|
||||
|
||||
// enter the modal loop
|
||||
while ( IsModalShowing() )
|
||||
@@ -406,7 +402,7 @@ bool wxDialog::Show(bool show)
|
||||
if ( !GetParent() )
|
||||
{
|
||||
wxWindow *parent = wxTheApp->GetTopWindow();
|
||||
if ( parent && parent != this )
|
||||
if ( parent && parent != this && parent->IsShown() )
|
||||
{
|
||||
// use it
|
||||
m_parent = parent;
|
||||
|
@@ -154,6 +154,10 @@ bool wxFrame::Create(wxWindow *parent,
|
||||
x, y, width, height, style);
|
||||
|
||||
wxModelessWindows.Append(this);
|
||||
|
||||
// unlike (almost?) all other windows, frames are created hidden
|
||||
m_isShown = FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -289,6 +293,10 @@ void wxFrame::DoShowWindow(int nShowCmd)
|
||||
|
||||
bool wxFrame::Show(bool show)
|
||||
{
|
||||
// don't use wxWindow version as we want to call DoShowWindow()
|
||||
if ( !wxWindowBase::Show(show) )
|
||||
return FALSE;
|
||||
|
||||
DoShowWindow(show ? SW_SHOW : SW_HIDE);
|
||||
|
||||
if ( show )
|
||||
|
Reference in New Issue
Block a user