Make wxWS_EX_VALIDATE_RECURSIVELY default (and only) behaviour

In practice, almost everybody using validators also seems to use this style,
so make it the default (this hadn't been done when it was originally
introduced because of compatibility concerns, but now, 15+ years later, it's
probably safe enough to change this).
This commit is contained in:
Vadim Zeitlin
2016-02-07 01:32:22 +01:00
parent 088d8cbed5
commit d50abc2d3e
16 changed files with 60 additions and 55 deletions

View File

@@ -78,7 +78,6 @@ wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
wxFLAGS_MEMBER(wxCLIP_CHILDREN)
// dialog styles
wxFLAGS_MEMBER(wxWS_EX_VALIDATE_RECURSIVELY)
wxFLAGS_MEMBER(wxSTAY_ON_TOP)
wxFLAGS_MEMBER(wxCAPTION)
wxFLAGS_MEMBER(wxSYSTEM_MENU)

View File

@@ -422,14 +422,6 @@ bool wxWindowBase::CreateBase(wxWindowBase *parent,
SetValidator(validator);
#endif // wxUSE_VALIDATORS
// if the parent window has wxWS_EX_VALIDATE_RECURSIVELY set, we want to
// have it too - like this it's possible to set it only in the top level
// dialog/frame and all children will inherit it by defult
if ( parent && (parent->GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) )
{
SetExtraStyle(GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY);
}
return true;
}
@@ -2036,12 +2028,9 @@ public:
}
// Traverse all the direct children calling OnDo() on them and also all
// grandchildren if wxWS_EX_VALIDATE_RECURSIVELY is used, calling
// OnRecurse() for them.
// grandchildren, calling OnRecurse() for them.
bool DoForAllChildren()
{
const bool recurse = m_win->HasExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
wxWindowList& children = m_win->GetChildren();
for ( wxWindowList::iterator i = children.begin();
i != children.end();
@@ -2057,7 +2046,7 @@ public:
// Notice that validation should never recurse into top level
// children, e.g. some other dialog which might happen to be
// currently shown.
if ( recurse && !child->IsTopLevel() && !OnRecurse(child) )
if ( !child->IsTopLevel() && !OnRecurse(child) )
{
return false;
}

View File

@@ -48,8 +48,6 @@ public:
wxDefaultPosition, wxDefaultSize,
wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxMAXIMIZE_BOX | wxMINIMIZE_BOX))
{
SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
m_notebook = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_MULTILINE);

View File

@@ -62,12 +62,6 @@ public:
m_toolbarRealized(false),
m_visiblePage(NULL)
{
// For consistency with the generic version, transfer data recursively:
// this ensures that all controls, even deep inside our pages, get
// correct values from their validators initially and transfer them
// back at the end.
SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
m_toolbar = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxTB_FLAT | wxTB_TEXT);
m_toolbar->SetToolBitmapSize(wxSize(32,32));

View File

@@ -74,7 +74,6 @@ wxRichTextBackgroundPage::wxRichTextBackgroundPage( wxWindow* parent, wxWindowID
bool wxRichTextBackgroundPage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
{
////@begin wxRichTextBackgroundPage creation
SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
wxRichTextDialogPage::Create( parent, id, pos, size, style );
CreateControls();

View File

@@ -122,7 +122,6 @@ wxRichTextBordersPage::wxRichTextBordersPage( wxWindow* parent, wxWindowID id, c
bool wxRichTextBordersPage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
{
////@begin wxRichTextBordersPage creation
SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
wxRichTextDialogPage::Create( parent, id, pos, size, style );
CreateControls();
@@ -221,7 +220,6 @@ void wxRichTextBordersPage::CreateControls()
wxNotebook* itemNotebook4 = new wxNotebook( itemRichTextDialogPage1, ID_RICHTEXTBORDERSPAGE_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxBK_DEFAULT );
wxPanel* itemPanel5 = new wxPanel( itemNotebook4, ID_RICHTEXTBORDERSPAGE_BORDERS, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
itemPanel5->SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxVERTICAL);
itemPanel5->SetSizer(itemBoxSizer6);
@@ -390,7 +388,6 @@ void wxRichTextBordersPage::CreateControls()
itemNotebook4->AddPage(itemPanel5, _("Border"));
wxPanel* itemPanel48 = new wxPanel( itemNotebook4, ID_RICHTEXTBORDERSPAGE_OUTLINE, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
itemPanel48->SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
wxBoxSizer* itemBoxSizer49 = new wxBoxSizer(wxVERTICAL);
itemPanel48->SetSizer(itemBoxSizer49);

View File

@@ -115,7 +115,7 @@ wxRichTextFormattingDialog::~wxRichTextFormattingDialog()
bool wxRichTextFormattingDialog::Create(long flags, wxWindow* parent, const wxString& title, wxWindowID id,
const wxPoint& pos, const wxSize& sz, long style)
{
SetExtraStyle(wxDIALOG_EX_CONTEXTHELP|wxWS_EX_VALIDATE_RECURSIVELY|wxWS_EX_BLOCK_EVENTS);
SetExtraStyle(wxDIALOG_EX_CONTEXTHELP|wxWS_EX_BLOCK_EVENTS);
#ifdef __WXMAC__
SetWindowVariant(wxWINDOW_VARIANT_SMALL);
#endif