Make the code more clear in aui sample and avoid g++ 4 warning.

The code used bitwise XOR which was rather difficult to read and also resulted
in g++ 4 warnings about suggested parentheses.

Fix both issues by using bitwise AND and OR in two separate statements instead.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63633 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-03-05 23:55:23 +00:00
parent 175363f6b8
commit f9199323a4

View File

@@ -1451,7 +1451,7 @@ void MyFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& evt)
void MyFrame::OnTabAlignment(wxCommandEvent &evt) void MyFrame::OnTabAlignment(wxCommandEvent &evt)
{ {
size_t i, count; size_t i, count;
wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes(); wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
for (i = 0, count = all_panes.GetCount(); i < count; ++i) for (i = 0, count = all_panes.GetCount(); i < count; ++i)
{ {
@@ -1460,10 +1460,14 @@ void MyFrame::OnTabAlignment(wxCommandEvent &evt)
{ {
wxAuiNotebook* nb = (wxAuiNotebook*)pane.window; wxAuiNotebook* nb = (wxAuiNotebook*)pane.window;
long style = nb->GetWindowStyleFlag();
style &= ~(wxAUI_NB_TOP | wxAUI_NB_BOTTOM);
if (evt.GetId() == ID_NotebookAlignTop) if (evt.GetId() == ID_NotebookAlignTop)
nb->SetWindowStyleFlag(nb->GetWindowStyleFlag()^wxAUI_NB_BOTTOM|wxAUI_NB_TOP); style |= wxAUI_NB_TOP;
else if (evt.GetId() == ID_NotebookAlignBottom) else if (evt.GetId() == ID_NotebookAlignBottom)
nb->SetWindowStyleFlag(nb->GetWindowStyleFlag()^wxAUI_NB_TOP|wxAUI_NB_BOTTOM); style |= wxAUI_NB_BOTTOM;
nb->SetWindowStyleFlag(style);
nb->Refresh(); nb->Refresh();
} }
} }