From: Vadim Zeitlin Date: Fri, 5 Mar 2010 23:55:23 +0000 (+0000) Subject: Make the code more clear in aui sample and avoid g++ 4 warning. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f9199323a48ba6ce49bb67101943f4acf60289f7 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 --- diff --git a/samples/aui/auidemo.cpp b/samples/aui/auidemo.cpp index b6a1f6cae5..519a3fb714 100644 --- a/samples/aui/auidemo.cpp +++ b/samples/aui/auidemo.cpp @@ -1451,7 +1451,7 @@ void MyFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& evt) void MyFrame::OnTabAlignment(wxCommandEvent &evt) { - size_t i, count; + size_t i, count; wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes(); for (i = 0, count = all_panes.GetCount(); i < count; ++i) { @@ -1460,10 +1460,14 @@ void MyFrame::OnTabAlignment(wxCommandEvent &evt) { wxAuiNotebook* nb = (wxAuiNotebook*)pane.window; + long style = nb->GetWindowStyleFlag(); + style &= ~(wxAUI_NB_TOP | wxAUI_NB_BOTTOM); if (evt.GetId() == ID_NotebookAlignTop) - nb->SetWindowStyleFlag(nb->GetWindowStyleFlag()^wxAUI_NB_BOTTOM|wxAUI_NB_TOP); - else if (evt.GetId() == ID_NotebookAlignBottom) - nb->SetWindowStyleFlag(nb->GetWindowStyleFlag()^wxAUI_NB_TOP|wxAUI_NB_BOTTOM); + style |= wxAUI_NB_TOP; + else if (evt.GetId() == ID_NotebookAlignBottom) + style |= wxAUI_NB_BOTTOM; + nb->SetWindowStyleFlag(style); + nb->Refresh(); } }