]> git.saurik.com Git - wxWidgets.git/commitdiff
Unified flags for orienting wxBookCtrls (with backward compatibility). Centralised...
authorWłodzimierz Skiba <abx@abx.art.pl>
Fri, 21 Oct 2005 18:53:51 +0000 (18:53 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Fri, 21 Oct 2005 18:53:51 +0000 (18:53 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35971 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/bookctrl.h
include/wx/choicebk.h
include/wx/defs.h
include/wx/listbook.h
include/wx/treebook.h

index f76e04a10f8cbf5e2b34f4df91c282d7c935d3a6..1145156eb971988fc9e6b3cd04e173d4c7e21ac7 100644 (file)
@@ -19,6 +19,9 @@ All (GUI):
 - Added access to the border size between pages and controller in book
   based controls (wxBookCtrlBase::Get/SetInternalBorder).
 - Added initial wxRichTextCtrl implementation.
 - Added access to the border size between pages and controller in book
   based controls (wxBookCtrlBase::Get/SetInternalBorder).
 - Added initial wxRichTextCtrl implementation.
+- All book based controls (notebook, treebook etc.) share now the same
+  options for orientation (wxBK_TOP, wxBK_DEFAULT, ...) instead of duplicated
+  wxLB_TOP, wxNB_TOP, wxCHB_TOP, wxTBK_TOP.
 
 wxMSW:
 
 
 wxMSW:
 
index dcfb8ae81be1de0a72cb4d374dc78f6e21061b20..9b4f51632bac9c801e49b0b1758c866a92897973 100644 (file)
@@ -128,6 +128,9 @@ public:
         m_internalBorder = internalBorder;
     }
 
         m_internalBorder = internalBorder;
     }
 
+    // returns true if we have wxCHB_TOP or wxCHB_BOTTOM style
+    bool IsVertical() const { return HasFlag(wxBK_BOTTOM | wxBK_TOP); }
+
     // operations
     // ----------
 
     // operations
     // ----------
 
@@ -213,6 +216,16 @@ protected:
     // true if we must delete m_imageList
     bool m_ownsImageList;
 
     // true if we must delete m_imageList
     bool m_ownsImageList;
 
+    // get the page area
+    wxRect GetPageRect() const;
+
+    // event handlers
+    virtual wxSize GetControllerSize() const;
+    void OnSize(wxSizeEvent& event);
+
+    // controller buddy if available, NULL otherwise (usually for native book controls like wxNotebook)
+    wxControl *m_bookctrl;
+
 private:
 
     // common part of all ctors
 private:
 
     // common part of all ctors
@@ -221,7 +234,9 @@ private:
     // internal border
     unsigned int m_internalBorder;
 
     // internal border
     unsigned int m_internalBorder;
 
+    DECLARE_ABSTRACT_CLASS(wxBookCtrlBase)
     DECLARE_NO_COPY_CLASS(wxBookCtrlBase)
     DECLARE_NO_COPY_CLASS(wxBookCtrlBase)
+    DECLARE_EVENT_TABLE()
 };
 
 // ----------------------------------------------------------------------------
 };
 
 // ----------------------------------------------------------------------------
@@ -262,11 +277,6 @@ private:
     #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING   wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
     #define EVT_BOOKCTRL_PAGE_CHANGED(id, fn)      EVT_NOTEBOOK_PAGE_CHANGED(id, fn)
     #define EVT_BOOKCTRL_PAGE_CHANGING(id, fn)     EVT_NOTEBOOK_PAGE_CHANGING(id, fn)
     #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING   wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
     #define EVT_BOOKCTRL_PAGE_CHANGED(id, fn)      EVT_NOTEBOOK_PAGE_CHANGED(id, fn)
     #define EVT_BOOKCTRL_PAGE_CHANGING(id, fn)     EVT_NOTEBOOK_PAGE_CHANGING(id, fn)
-    #define wxBC_TOP                               wxNB_TOP
-    #define wxBC_BOTTOM                            wxNB_BOTTOM
-    #define wxBC_LEFT                              wxNB_LEFT
-    #define wxBC_RIGHT                             wxNB_RIGHT
-    #define wxBC_DEFAULT                           wxNB_DEFAULT
 #else
     // dedicated to Smartphones
     #include "wx/choicebk.h"
 #else
     // dedicated to Smartphones
     #include "wx/choicebk.h"
@@ -276,11 +286,14 @@ private:
     #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING   wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING
     #define EVT_BOOKCTRL_PAGE_CHANGED(id, fn)      EVT_CHOICEBOOK_PAGE_CHANGED(id, fn)
     #define EVT_BOOKCTRL_PAGE_CHANGING(id, fn)     EVT_CHOICEBOOK_PAGE_CHANGING(id, fn)
     #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING   wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING
     #define EVT_BOOKCTRL_PAGE_CHANGED(id, fn)      EVT_CHOICEBOOK_PAGE_CHANGED(id, fn)
     #define EVT_BOOKCTRL_PAGE_CHANGING(id, fn)     EVT_CHOICEBOOK_PAGE_CHANGING(id, fn)
-    #define wxBC_TOP                               wxCHB_TOP
-    #define wxBC_BOTTOM                            wxCHB_BOTTOM
-    #define wxBC_LEFT                              wxCHB_LEFT
-    #define wxBC_RIGHT                             wxCHB_RIGHT
-    #define wxBC_DEFAULT                           wxCHB_DEFAULT
+#endif
+
+#if WXWIN_COMPATIBILITY_2_6
+    #define wxBC_TOP                               wxBK_TOP
+    #define wxBC_BOTTOM                            wxBK_BOTTOM
+    #define wxBC_LEFT                              wxBK_LEFT
+    #define wxBC_RIGHT                             wxBK_RIGHT
+    #define wxBC_DEFAULT                           wxBK_DEFAULT
 #endif
 
 #endif // wxUSE_BOOKCTRL
 #endif
 
 #endif // wxUSE_BOOKCTRL
index 2d86b96965693080d7b7df31aa6237210d9ad1df..4a5a684382178fc9af8a83e07bbd87f710e80364 100644 (file)
@@ -67,30 +67,20 @@ public:
     virtual int SetSelection(size_t n);
     virtual void SetImageList(wxImageList *imageList);
 
     virtual int SetSelection(size_t n);
     virtual void SetImageList(wxImageList *imageList);
 
-    // returns true if we have wxCHB_TOP or wxCHB_BOTTOM style
-    bool IsVertical() const { return HasFlag(wxCHB_BOTTOM | wxCHB_TOP); }
-
     virtual bool DeleteAllPages();
 
     // returns the choice control
     virtual bool DeleteAllPages();
 
     // returns the choice control
-    wxChoice* GetChoiceCtrl() const { return m_choice; }
+    wxChoice* GetChoiceCtrl() const { return (wxChoice*)m_bookctrl; }
 
 protected:
     virtual wxWindow *DoRemovePage(size_t page);
 
     // get the size which the choice control should have
 
 protected:
     virtual wxWindow *DoRemovePage(size_t page);
 
     // get the size which the choice control should have
-    wxSize GetChoiceSize() const;
-
-    // get the page area
-    wxRect GetPageRect() const;
+    virtual wxSize GetControllerSize() const;
 
     // event handlers
 
     // event handlers
-    void OnSize(wxSizeEvent& event);
     void OnChoiceSelected(wxCommandEvent& event);
 
     void OnChoiceSelected(wxCommandEvent& event);
 
-    // the choice control we use for showing the pages index
-    wxChoice *m_choice;
-
     // the currently selected page or wxNOT_FOUND if none
     int m_selection;
 
     // the currently selected page or wxNOT_FOUND if none
     int m_selection;
 
index 18a82b4c687975c07ad6348f513c087cac541cbb..98b08ffe3d40da2bd6809e79be2e9be4deeedcf9 100644 (file)
@@ -1530,38 +1530,59 @@ enum wxBorder
 #define wxSP_ARROW_KEYS       0x1000
 #define wxSP_WRAP             0x2000
 
 #define wxSP_ARROW_KEYS       0x1000
 #define wxSP_WRAP             0x2000
 
+/*
+ * wxBookCtrl flags (common for wxNotebook, wxListbook, wxChoicebook, wxTreebook)
+ */
+
+#define wxBK_DEFAULT          0x0000
+#define wxBK_TOP              0x0010
+#define wxBK_BOTTOM           0x0020
+#define wxBK_LEFT             0x0040
+#define wxBK_RIGHT            0x0080
+#define wxBK_ALIGN_MASK       ( wxBK_TOP | wxBK_BOTTOM | wxBK_LEFT | wxBK_RIGHT )
+
 /*
  * wxNotebook flags
  */
 /*
  * wxNotebook flags
  */
-#define wxNB_FIXEDWIDTH       0x0010
-#define wxNB_TOP              0x0000    /*  default */
-#define wxNB_LEFT             0x0020
-#define wxNB_RIGHT            0x0040
-#define wxNB_BOTTOM           0x0080
-#define wxNB_MULTILINE        0x0100
-#define wxNB_NOPAGETHEME      0x0200
-#define wxNB_FLAT             0x0400
-#define wxNB_DEFAULT          wxNB_TOP
+#if WXWIN_COMPATIBILITY_2_6
+/* Use common book wxBK_* flags for describing alignment */
+#define wxNB_DEFAULT          wxBK_DEFAULT
+#define wxNB_TOP              wxBK_TOP
+#define wxNB_BOTTOM           wxBK_BOTTOM
+#define wxNB_LEFT             wxBK_LEFT
+#define wxNB_RIGHT            wxBK_RIGHT
+#endif
+
+#define wxNB_FIXEDWIDTH       0x0100
+#define wxNB_MULTILINE        0x0200
+#define wxNB_NOPAGETHEME      0x0400
+#define wxNB_FLAT             0x0800
 
 /*
  * wxListbook flags
  */
 
 /*
  * wxListbook flags
  */
-#define wxLB_DEFAULT          0x0
-#define wxLB_TOP              0x1
-#define wxLB_BOTTOM           0x2
-#define wxLB_LEFT             0x4
-#define wxLB_RIGHT            0x8
-#define wxLB_ALIGN_MASK       0xf
+#if WXWIN_COMPATIBILITY_2_6
+/* Use common book wxBK_* flags for describing alignment */
+#define wxLB_DEFAULT          wxBK_DEFAULT
+#define wxLB_TOP              wxBK_TOP
+#define wxLB_BOTTOM           wxBK_BOTTOM
+#define wxLB_LEFT             wxBK_LEFT
+#define wxLB_RIGHT            wxBK_RIGHT
+#define wxLB_ALIGN_MASK       wxBK_ALIGN_MASK
+#endif
 
 /*
  * wxChoicebook flags
  */
 
 /*
  * wxChoicebook flags
  */
-#define wxCHB_DEFAULT         0x0
-#define wxCHB_TOP             0x1
-#define wxCHB_BOTTOM          0x2
-#define wxCHB_LEFT            0x4
-#define wxCHB_RIGHT           0x8
-#define wxCHB_ALIGN_MASK      0xf
+#if WXWIN_COMPATIBILITY_2_6
+/* Use common book wxBK_* flags for describing alignment */
+#define wxCHB_DEFAULT          wxBK_DEFAULT
+#define wxCHB_TOP              wxBK_TOP
+#define wxCHB_BOTTOM           wxBK_BOTTOM
+#define wxCHB_LEFT             wxBK_LEFT
+#define wxCHB_RIGHT            wxBK_RIGHT
+#define wxCHB_ALIGN_MASK       wxBK_ALIGN_MASK
+#endif
 
 /*
  * wxTabCtrl flags
 
 /*
  * wxTabCtrl flags
index 0c77ffc14d4a89eae8f4820c32154bda653bbbdb..6c30f80819ac2faee9a5ffe6bc30aa4620fb8531 100644 (file)
 
 #if wxUSE_LISTBOOK
 
 
 #if wxUSE_LISTBOOK
 
-// this can be defined to put a static line as separator between the list
-// control and the page area; but I think it finally looks better without it so
-// it is not enabled by default
-#define wxUSE_LINE_IN_LISTBOOK 0
-
-#if !wxUSE_STATLINE
-    #undef wxUSE_LINE_IN_LISTBOOK
-    #define wxUSE_LINE_IN_LISTBOOK 0
-#endif
-
 #include "wx/bookctrl.h"
 
 class WXDLLEXPORT wxListView;
 class WXDLLEXPORT wxListEvent;
 
 #include "wx/bookctrl.h"
 
 class WXDLLEXPORT wxListView;
 class WXDLLEXPORT wxListEvent;
 
-#if wxUSE_LINE_IN_LISTBOOK
-class WXDLLEXPORT wxStaticLine;
-#endif // wxUSE_LINE_IN_LISTBOOK
-
 // ----------------------------------------------------------------------------
 // wxListbook
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // wxListbook
 // ----------------------------------------------------------------------------
@@ -82,33 +68,19 @@ public:
     virtual int SetSelection(size_t n);
     virtual void SetImageList(wxImageList *imageList);
 
     virtual int SetSelection(size_t n);
     virtual void SetImageList(wxImageList *imageList);
 
-    // returns true if we have wxLB_TOP or wxLB_BOTTOM style
-    bool IsVertical() const { return HasFlag(wxLB_BOTTOM | wxLB_TOP); }
-
     virtual bool DeleteAllPages();
 
     virtual bool DeleteAllPages();
 
-    wxListView* GetListView() { return m_list; }
+    wxListView* GetListView() const { return (wxListView*)m_bookctrl; }
 
 protected:
     virtual wxWindow *DoRemovePage(size_t page);
 
     // get the size which the list control should have
 
 protected:
     virtual wxWindow *DoRemovePage(size_t page);
 
     // get the size which the list control should have
-    wxSize GetListSize() const;
-
-    // get the page area
-    wxRect GetPageRect() const;
+    virtual wxSize GetControllerSize() const;
 
     // event handlers
 
     // event handlers
-    void OnSize(wxSizeEvent& event);
     void OnListSelected(wxListEvent& event);
     void OnListSelected(wxListEvent& event);
-
-    // the list control we use for showing the pages index
-    wxListView *m_list;
-
-#if wxUSE_LINE_IN_LISTBOOK
-    // the line separating it from the page area
-    wxStaticLine *m_line;
-#endif // wxUSE_LINE_IN_LISTBOOK
+    void OnSize(wxSizeEvent& event);
 
     // the currently selected page or wxNOT_FOUND if none
     int m_selection;
 
     // the currently selected page or wxNOT_FOUND if none
     int m_selection;
index 34f0090f89981bb1dc96143569ff9f2b658330b7..0b414e2ba9b8c24ba3ee7619b3c7ecf2fbcb535d 100644 (file)
@@ -23,24 +23,6 @@ typedef wxWindow wxTreebookPage;
 
 class WXDLLEXPORT wxTreeEvent;
 
 
 class WXDLLEXPORT wxTreeEvent;
 
-// ----------------------------------------------------------------------------
-// style flags
-// ----------------------------------------------------------------------------
-
-// This is a set of synonyms of wxNB_XXX, which still could be used directly
-// for styling the control. Defined for consistency with wxListbook and
-// wxChoicebook only.
-#define wxTBK_LEFT      wxNB_LEFT
-#define wxTBK_RIGHT     wxNB_RIGHT
-
-// we don't support TOP/BOTTOM orientations but still define the flags (again,
-// for consistency with others)
-#define wxTBK_TOP       wxTBK_LEFT
-#define wxTBK_BOTTOM    wxTBK_RIGHT
-
-#define wxTBK_ALIGN_MASK (wxTBK_LEFT | wxTBK_RIGHT)
-#define wxTBK_DEFAULT   wxTBK_LEFT
-
 // ----------------------------------------------------------------------------
 // wxTreebook
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // wxTreebook
 // ----------------------------------------------------------------------------
@@ -62,7 +44,7 @@ public:
                wxWindowID id,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                wxWindowID id,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
-               long style = wxTBK_DEFAULT,
+               long style = wxBK_DEFAULT,
                const wxString& name = wxEmptyString)
     {
         Init();
                const wxString& name = wxEmptyString)
     {
         Init();
@@ -75,7 +57,7 @@ public:
                 wxWindowID id,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 wxWindowID id,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
-                long style = wxTBK_DEFAULT,
+                long style = wxBK_DEFAULT,
                 const wxString& name = wxEmptyString);
 
 
                 const wxString& name = wxEmptyString);
 
 
@@ -137,6 +119,9 @@ public:
     // get the parent page or wxNOT_FOUND if this is a top level page
     int GetPageParent(size_t pos) const;
 
     // get the parent page or wxNOT_FOUND if this is a top level page
     int GetPageParent(size_t pos) const;
 
+    // the tree control we use for showing the pages index tree
+    wxTreeCtrl* GetTreeCtrl() const { return (wxTreeCtrl*)m_bookctrl; }
+
 
     // Standard operations inherited from wxBookCtrlBase
     // -------------------------------------------------
 
     // Standard operations inherited from wxBookCtrlBase
     // -------------------------------------------------
@@ -156,21 +141,10 @@ protected:
     // This subclass of wxBookCtrlBase accepts NULL page pointers (empty pages)
     virtual bool AllowNullPage() const { return true; }
 
     // This subclass of wxBookCtrlBase accepts NULL page pointers (empty pages)
     virtual bool AllowNullPage() const { return true; }
 
-    // get the size which the tree control should have
-    wxSize GetTreeSize() const;
-
-    // get the page area
-    wxRect GetPageRect() const;
-
     // event handlers
     // event handlers
-    void OnSize(wxSizeEvent& event);
     void OnTreeSelectionChange(wxTreeEvent& event);
     void OnTreeNodeExpandedCollapsed(wxTreeEvent& event);
 
     void OnTreeSelectionChange(wxTreeEvent& event);
     void OnTreeNodeExpandedCollapsed(wxTreeEvent& event);
 
-
-    // the tree control we use for showing the pages index tree
-    wxTreeCtrl *m_tree;
-
     // array of page ids and page windows
     wxArrayTreeItemIds m_treeIds;
 
     // array of page ids and page windows
     wxArrayTreeItemIds m_treeIds;