]> git.saurik.com Git - wxWidgets.git/commitdiff
Make the code more clear in aui sample and avoid g++ 4 warning.
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 5 Mar 2010 23:55:23 +0000 (23:55 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 5 Mar 2010 23:55:23 +0000 (23:55 +0000)
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

samples/aui/auidemo.cpp

index b6a1f6cae50af24103ae26cbc48c1f1e9bed6c7b..519a3fb7148693d580ea9f787e3dc94b9d7a1bac 100644 (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();
     for (i = 0, count = all_panes.GetCount(); i < count; ++i)
     {
     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;
 
         {
             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);
-           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();
         }
     }
             nb->Refresh();
         }
     }