]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/notebook/notebook.cpp
refresh the MDI frame window menu whenever a child frame is shown/hidden (and not...
[wxWidgets.git] / samples / notebook / notebook.cpp
index 319c60e0553dec1acaf3f45bf6d317a95f5bc8ea..0931f0a56d15fa7ab35ded22d76c3e23459a3033 100644 (file)
@@ -307,34 +307,26 @@ MyFrame::~MyFrame()
 // part is control class-specific
 #if wxUSE_NOTEBOOK
     #define CASE_NOTEBOOK(x) case Type_Notebook: x; break;
-    #define FLAG_NOTEBOOK(x) wxNB_##x
 #else
     #define CASE_NOTEBOOK(x)
-    #define FLAG_NOTEBOOK(x) 0
 #endif
 
 #if wxUSE_LISTBOOK
     #define CASE_LISTBOOK(x) case Type_Listbook: x; break;
-    #define FLAG_LISTBOOK(x) wxLB_##x
 #else
     #define CASE_LISTBOOK(x)
-    #define FLAG_LISTBOOK(x) 0
 #endif
 
 #if wxUSE_CHOICEBOOK
     #define CASE_CHOICEBOOK(x) case Type_Choicebook: x; break;
-    #define FLAG_CHOICEBOOK(x) wxCHB_##x
 #else
     #define CASE_CHOICEBOOK(x)
-    #define FLAG_CHOICEBOOK(x) 0
 #endif
 
 #if wxUSE_TREEBOOK
     #define CASE_TREEBOOK(x) case Type_Treebook: x; break;
-    #define FLAG_TREEBOOK(x) wxTBK_##x
 #else
     #define CASE_TREEBOOK(x)
-    #define FLAG_TREEBOOK(x) 0
 #endif
 
 #define DISPATCH_ON_TYPE(before, nb, lb, cb, tb, after)                       \
@@ -360,34 +352,29 @@ int MyFrame::TranslateBookFlag(int nb, int lb, int chb, int tbk) const
 
 void MyFrame::RecreateBook()
 {
-#define SELECT_FLAG(f) \
-    TranslateBookFlag(FLAG_NOTEBOOK(f), FLAG_LISTBOOK(f), FLAG_CHOICEBOOK(f), FLAG_TREEBOOK(f))
-
     int flags;
     switch ( m_orient )
     {
         case ID_ORIENT_TOP:
-            flags = SELECT_FLAG(TOP);
+            flags = wxBK_TOP;
             break;
 
         case ID_ORIENT_BOTTOM:
-            flags = SELECT_FLAG(BOTTOM);
+            flags = wxBK_BOTTOM;
             break;
 
         case ID_ORIENT_LEFT:
-            flags = SELECT_FLAG(LEFT);
+            flags = wxBK_LEFT;
             break;
 
         case ID_ORIENT_RIGHT:
-            flags = SELECT_FLAG(RIGHT);
+            flags = wxBK_RIGHT;
             break;
 
         default:
-            flags = SELECT_FLAG(DEFAULT);
+            flags = wxBK_DEFAULT;
     }
 
-#undef SELECT_FLAG
-
     if ( m_multi && m_type == Type_Notebook )
         flags |= wxNB_MULTILINE;
     flags |= wxDOUBLE_BORDER;
@@ -778,8 +765,11 @@ void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event)
         else if ( eventType == ei.typeChanging )
         {
             const int idx = event.GetOldSelection();
+
+            // NB: can't use wxStaticCast here as wxBookCtrlBase is not in
+            //     wxRTTI
             const wxBookCtrlBase * const
-                book = wxStaticCast(event.GetEventObject(), wxBookCtrlBase);
+                book = wx_static_cast(wxBookCtrlBase *, event.GetEventObject());
             if ( idx != wxNOT_FOUND &&
                     book && book->GetPageText(idx) == VETO_PAGE_NAME )
             {
@@ -823,4 +813,3 @@ void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event)
     m_text->SetInsertionPointEnd();
 #endif
 }
-