Get rid of wxAuiToolBar::m_style and just use base class m_windowStyle.

This fixes an assert exposed by the addition of wxAuiToolBar::Create() in
r72785: as m_style was not initialized before, calling GetWindowStyle() from
wxControl::Create() returned wrong flags.

Fix this by just removing m_style completely, there doesn't seem to be any
need for it nor for overriding GetWindowStyleFlag().

See #13520.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72816 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-10-29 14:50:42 +00:00
parent b61c03cad3
commit a69b365fbb
2 changed files with 18 additions and 25 deletions

View File

@@ -459,8 +459,7 @@ public:
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = 0); long style = 0);
void SetWindowStyleFlag(long style); virtual void SetWindowStyleFlag(long style);
long GetWindowStyleFlag() const;
void SetArtProvider(wxAuiToolBarArt* art); void SetArtProvider(wxAuiToolBarArt* art);
wxAuiToolBarArt* GetArtProvider() const; wxAuiToolBarArt* GetArtProvider() const;
@@ -664,7 +663,6 @@ protected:
bool m_dragging; bool m_dragging;
bool m_gripperVisible; bool m_gripperVisible;
bool m_overflowVisible; bool m_overflowVisible;
long m_style;
bool RealizeHelper(wxClientDC& dc, bool horizontal); bool RealizeHelper(wxClientDC& dc, bool horizontal);
static bool IsPaneValid(long style, const wxAuiPaneInfo& pane); static bool IsPaneValid(long style, const wxAuiPaneInfo& pane);

View File

@@ -814,8 +814,8 @@ void wxAuiToolBar::Init()
m_gripperSizerItem = NULL; m_gripperSizerItem = NULL;
m_overflowSizerItem = NULL; m_overflowSizerItem = NULL;
m_dragging = false; m_dragging = false;
m_gripperVisible = (m_style & wxAUI_TB_GRIPPER) ? true : false; m_gripperVisible = (m_windowStyle & wxAUI_TB_GRIPPER) ? true : false;
m_overflowVisible = (m_style & wxAUI_TB_OVERFLOW) ? true : false; m_overflowVisible = (m_windowStyle & wxAUI_TB_OVERFLOW) ? true : false;
m_overflowState = 0; m_overflowState = 0;
} }
@@ -830,7 +830,7 @@ bool wxAuiToolBar::Create(wxWindow* parent,
if (!wxControl::Create(parent, id, pos, size, style)) if (!wxControl::Create(parent, id, pos, size, style))
return false; return false;
m_style = style; m_windowStyle = style;
m_orientation = GetOrientation(style); m_orientation = GetOrientation(style);
if (m_orientation == wxBOTH) if (m_orientation == wxBOTH)
{ {
@@ -862,20 +862,20 @@ void wxAuiToolBar::SetWindowStyleFlag(long style)
wxControl::SetWindowStyleFlag(style); wxControl::SetWindowStyleFlag(style);
m_style = style; m_windowStyle = style;
if (m_art) if (m_art)
{ {
SetArtFlags(); SetArtFlags();
} }
if (m_style & wxAUI_TB_GRIPPER) if (m_windowStyle & wxAUI_TB_GRIPPER)
m_gripperVisible = true; m_gripperVisible = true;
else else
m_gripperVisible = false; m_gripperVisible = false;
if (m_style & wxAUI_TB_OVERFLOW) if (m_windowStyle & wxAUI_TB_OVERFLOW)
m_overflowVisible = true; m_overflowVisible = true;
else else
m_overflowVisible = false; m_overflowVisible = false;
@@ -886,11 +886,6 @@ void wxAuiToolBar::SetWindowStyleFlag(long style)
SetToolTextOrientation(wxAUI_TBTOOL_TEXT_BOTTOM); SetToolTextOrientation(wxAUI_TBTOOL_TEXT_BOTTOM);
} }
long wxAuiToolBar::GetWindowStyleFlag() const
{
return m_style;
}
void wxAuiToolBar::SetArtProvider(wxAuiToolBarArt* art) void wxAuiToolBar::SetArtProvider(wxAuiToolBarArt* art)
{ {
delete m_art; delete m_art;
@@ -1373,9 +1368,9 @@ void wxAuiToolBar::SetGripperVisible(bool visible)
{ {
m_gripperVisible = visible; m_gripperVisible = visible;
if (visible) if (visible)
m_style |= wxAUI_TB_GRIPPER; m_windowStyle |= wxAUI_TB_GRIPPER;
else else
m_style &= ~wxAUI_TB_GRIPPER; m_windowStyle &= ~wxAUI_TB_GRIPPER;
Realize(); Realize();
Refresh(false); Refresh(false);
} }
@@ -1390,9 +1385,9 @@ void wxAuiToolBar::SetOverflowVisible(bool visible)
{ {
m_overflowVisible = visible; m_overflowVisible = visible;
if (visible) if (visible)
m_style |= wxAUI_TB_OVERFLOW; m_windowStyle |= wxAUI_TB_OVERFLOW;
else else
m_style &= ~wxAUI_TB_OVERFLOW; m_windowStyle &= ~wxAUI_TB_OVERFLOW;
Refresh(false); Refresh(false);
} }
@@ -1679,7 +1674,7 @@ wxSize wxAuiToolBar::GetHintSize(int dock_direction) const
bool wxAuiToolBar::IsPaneValid(const wxAuiPaneInfo& pane) const bool wxAuiToolBar::IsPaneValid(const wxAuiPaneInfo& pane) const
{ {
return IsPaneValid(m_style, pane); return IsPaneValid(m_windowStyle, pane);
} }
bool wxAuiToolBar::IsPaneValid(long style, const wxAuiPaneInfo& pane) bool wxAuiToolBar::IsPaneValid(long style, const wxAuiPaneInfo& pane)
@@ -1713,7 +1708,7 @@ bool wxAuiToolBar::IsPaneValid(long style) const
void wxAuiToolBar::SetArtFlags() const void wxAuiToolBar::SetArtFlags() const
{ {
unsigned int artflags = m_style & ~wxAUI_ORIENTATION_MASK; unsigned int artflags = m_windowStyle & ~wxAUI_ORIENTATION_MASK;
if (m_orientation == wxVERTICAL) if (m_orientation == wxVERTICAL)
{ {
artflags |= wxAUI_TB_VERTICAL; artflags |= wxAUI_TB_VERTICAL;
@@ -1948,7 +1943,7 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal)
vert_sizer->AddStretchSpacer(1); vert_sizer->AddStretchSpacer(1);
ctrl_m_sizerItem = vert_sizer->Add(item.m_window, 0, wxEXPAND); ctrl_m_sizerItem = vert_sizer->Add(item.m_window, 0, wxEXPAND);
vert_sizer->AddStretchSpacer(1); vert_sizer->AddStretchSpacer(1);
if ( (m_style & wxAUI_TB_TEXT) && if ( (m_windowStyle & wxAUI_TB_TEXT) &&
m_toolTextOrientation == wxAUI_TBTOOL_TEXT_BOTTOM && m_toolTextOrientation == wxAUI_TBTOOL_TEXT_BOTTOM &&
!item.GetLabel().empty() ) !item.GetLabel().empty() )
{ {
@@ -1998,7 +1993,7 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal)
// add drop down area // add drop down area
m_overflowSizerItem = NULL; m_overflowSizerItem = NULL;
if (m_style & wxAUI_TB_OVERFLOW) if (m_windowStyle & wxAUI_TB_OVERFLOW)
{ {
int overflow_size = m_art->GetElementSize(wxAUI_TBART_OVERFLOW_SIZE); int overflow_size = m_art->GetElementSize(wxAUI_TBART_OVERFLOW_SIZE);
if (overflow_size > 0 && m_overflowVisible) if (overflow_size > 0 && m_overflowVisible)
@@ -2065,7 +2060,7 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal)
m_minWidth = size.x; m_minWidth = size.x;
m_minHeight = size.y; m_minHeight = size.y;
if ((m_style & wxAUI_TB_NO_AUTORESIZE) == 0) if ((m_windowStyle & wxAUI_TB_NO_AUTORESIZE) == 0)
{ {
wxSize curSize = GetClientSize(); wxSize curSize = GetClientSize();
wxSize new_size = GetMinSize(); wxSize new_size = GetMinSize();
@@ -2285,7 +2280,7 @@ void wxAuiToolBar::OnIdle(wxIdleEvent& evt)
// pane state member is public, so it might have been changed // pane state member is public, so it might have been changed
// without going through wxPaneInfo::SetFlag() check // without going through wxPaneInfo::SetFlag() check
bool ok = pane.IsOk(); bool ok = pane.IsOk();
wxCHECK2_MSG(!ok || IsPaneValid(m_style, pane), ok = false, wxCHECK2_MSG(!ok || IsPaneValid(m_windowStyle, pane), ok = false,
"window settings and pane settings are incompatible"); "window settings and pane settings are incompatible");
if (ok) if (ok)
{ {
@@ -2307,7 +2302,7 @@ void wxAuiToolBar::OnIdle(wxIdleEvent& evt)
} }
} }
else if (pane.IsResizable() && else if (pane.IsResizable() &&
GetOrientation(m_style) == wxBOTH) GetOrientation(m_windowStyle) == wxBOTH)
{ {
// changing orientation in OnSize causes havoc // changing orientation in OnSize causes havoc
int x, y; int x, y;