diff --git a/include/wx/pickerbase.h b/include/wx/pickerbase.h index f4ec165784..963132bcb7 100644 --- a/include/wx/pickerbase.h +++ b/include/wx/pickerbase.h @@ -76,27 +76,29 @@ public: // public API { return (GetTextCtrlItem()->GetFlag() & wxGROW) != 0; } void SetTextCtrlGrowable(bool grow = true) { - int f = GetDefaultTextCtrlFlag(); + wxSizerItem* const item = GetTextCtrlItem(); + int f = item->GetFlag(); if ( grow ) f |= wxGROW; else f &= ~wxGROW; - GetTextCtrlItem()->SetFlag(f); + item->SetFlag(f); } bool IsPickerCtrlGrowable() const { return (GetPickerCtrlItem()->GetFlag() & wxGROW) != 0; } void SetPickerCtrlGrowable(bool grow = true) { - int f = GetDefaultPickerCtrlFlag(); + wxSizerItem* const item = GetPickerCtrlItem(); + int f = item->GetFlag(); if ( grow ) { f &= ~wxALIGN_MASK; f |= wxGROW; } - GetPickerCtrlItem()->SetFlag(f); + item->SetFlag(f); } bool HasTextCtrl() const @@ -150,15 +152,19 @@ protected: return m_sizer->GetItem((size_t)0); } +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("useless and will be removed in the future") int GetDefaultPickerCtrlFlag() const { return wxALIGN_CENTER_VERTICAL; } + wxDEPRECATED_MSG("useless and will be removed in the future") int GetDefaultTextCtrlFlag() const { return wxALIGN_CENTER_VERTICAL | wxRIGHT; } +#endif // WXWIN_COMPATIBILITY_3_0 void PostCreation(); diff --git a/src/common/pickerbase.cpp b/src/common/pickerbase.cpp index ffe484e9e4..faf2b991fa 100644 --- a/src/common/pickerbase.cpp +++ b/src/common/pickerbase.cpp @@ -102,8 +102,8 @@ bool wxPickerBase::CreateBase(wxWindow *parent, wxWindowDestroyEventHandler(wxPickerBase::OnTextCtrlDelete), NULL, this); - // the text control's proportion values defaults to 2 - m_sizer->Add(m_text, 2, GetDefaultTextCtrlFlag(), 5); + m_sizer->Add(m_text, + wxSizerFlags(1).CentreVertical().Border(wxRIGHT)); } return true; @@ -111,9 +111,9 @@ bool wxPickerBase::CreateBase(wxWindow *parent, void wxPickerBase::PostCreation() { - // the picker's proportion value defaults to 1 when there's no text control - // associated with it - in that case it defaults to 0 - m_sizer->Add(m_picker, HasTextCtrl() ? 0 : 1, GetDefaultPickerCtrlFlag(), 5); + // the picker grows in the major direction only if there is no text control + m_sizer->Add(m_picker, + wxSizerFlags(HasTextCtrl() ? 0 : 1).CentreVertical()); // For aesthetic reasons, make sure the picker is at least as high as the // associated text control and is always at least square, unless we are