return parent;
}
-wxWindow *wxDialogBase::GetParentForModalDialog(wxWindow *parent) const
+wxWindow *
+wxDialogBase::GetParentForModalDialog(wxWindow *parent, long style) const
{
// creating a parent-less modal dialog will result (under e.g. wxGTK2)
// in an unfocused dialog, so try to find a valid parent for it unless we
// were explicitly asked not to
- if ( HasFlag(wxDIALOG_NO_PARENT) )
+ if ( style & wxDIALOG_NO_PARENT )
return NULL;
// first try the given parent
#if wxUSE_STATTEXT
-class wxTextSizerWrapper : public wxTextWrapper
+wxSizer *wxDialogBase::CreateTextSizer(const wxString& message)
{
-public:
- wxTextSizerWrapper(wxWindow *win)
- {
- m_win = win;
- m_hLine = 0;
- }
-
- wxSizer *CreateSizer(const wxString& text, int widthMax)
- {
- m_sizer = new wxBoxSizer(wxVERTICAL);
- Wrap(m_win, text, widthMax);
- return m_sizer;
- }
-
-protected:
- virtual void OnOutputLine(const wxString& line)
- {
- if ( !line.empty() )
- {
- m_sizer->Add(new wxStaticText(m_win, wxID_ANY, line));
- }
- else // empty line, no need to create a control for it
- {
- if ( !m_hLine )
- m_hLine = m_win->GetCharHeight();
-
- m_sizer->Add(5, m_hLine);
- }
- }
+ wxTextSizerWrapper wrapper(this);
-private:
- wxWindow *m_win;
- wxSizer *m_sizer;
- int m_hLine;
-};
+ return CreateTextSizer(message, wrapper);
+}
-wxSizer *wxDialogBase::CreateTextSizer(const wxString& message)
+wxSizer *wxDialogBase::CreateTextSizer(const wxString& message,
+ wxTextSizerWrapper& wrapper)
{
// I admit that this is complete bogus, but it makes
// message boxes work for pda screens temporarily..
wxString text(message);
text.Replace(wxT("&"), wxT("&&"));
- wxTextSizerWrapper wrapper(this);
-
return wrapper.CreateSizer(text, widthMax);
}
void wxDialogBase::SendWindowModalDialogEvent ( wxEventType type )
{
- wxCommandEvent event ( type, GetId());
+ wxWindowModalDialogEvent event ( type, GetId());
event.SetEventObject(this);
if ( !GetEventHandler()->ProcessEvent(event) )
stdButtonSizer->Realize();
else
{
- delete buttonSizer;
- buttonSizer = NULL;
+ wxDELETE(buttonSizer);
}
}