Unified flags for orienting wxBookCtrls (with backward compatibility). Centralised code for sizing internals.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35971 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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.
|
||||
- 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:
|
||||
|
||||
|
@@ -128,6 +128,9 @@ public:
|
||||
m_internalBorder = internalBorder;
|
||||
}
|
||||
|
||||
// returns true if we have wxCHB_TOP or wxCHB_BOTTOM style
|
||||
bool IsVertical() const { return HasFlag(wxBK_BOTTOM | wxBK_TOP); }
|
||||
|
||||
// operations
|
||||
// ----------
|
||||
|
||||
@@ -213,6 +216,16 @@ protected:
|
||||
// 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
|
||||
@@ -221,7 +234,9 @@ private:
|
||||
// internal border
|
||||
unsigned int m_internalBorder;
|
||||
|
||||
DECLARE_ABSTRACT_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 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"
|
||||
@@ -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 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
|
||||
|
@@ -67,30 +67,20 @@ public:
|
||||
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
|
||||
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
|
||||
wxSize GetChoiceSize() const;
|
||||
|
||||
// get the page area
|
||||
wxRect GetPageRect() const;
|
||||
virtual wxSize GetControllerSize() const;
|
||||
|
||||
// event handlers
|
||||
void OnSize(wxSizeEvent& 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;
|
||||
|
||||
|
@@ -1530,38 +1530,59 @@ enum wxBorder
|
||||
#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
|
||||
*/
|
||||
#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
|
||||
*/
|
||||
#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
|
||||
*/
|
||||
#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
|
||||
|
@@ -16,25 +16,11 @@
|
||||
|
||||
#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;
|
||||
|
||||
#if wxUSE_LINE_IN_LISTBOOK
|
||||
class WXDLLEXPORT wxStaticLine;
|
||||
#endif // wxUSE_LINE_IN_LISTBOOK
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxListbook
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -82,33 +68,19 @@ public:
|
||||
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();
|
||||
|
||||
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
|
||||
wxSize GetListSize() const;
|
||||
|
||||
// get the page area
|
||||
wxRect GetPageRect() const;
|
||||
virtual wxSize GetControllerSize() const;
|
||||
|
||||
// event handlers
|
||||
void OnSize(wxSizeEvent& 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;
|
||||
|
@@ -23,24 +23,6 @@ typedef wxWindow wxTreebookPage;
|
||||
|
||||
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
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -62,7 +44,7 @@ public:
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTBK_DEFAULT,
|
||||
long style = wxBK_DEFAULT,
|
||||
const wxString& name = wxEmptyString)
|
||||
{
|
||||
Init();
|
||||
@@ -75,7 +57,7 @@ public:
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTBK_DEFAULT,
|
||||
long style = wxBK_DEFAULT,
|
||||
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;
|
||||
|
||||
// the tree control we use for showing the pages index tree
|
||||
wxTreeCtrl* GetTreeCtrl() const { return (wxTreeCtrl*)m_bookctrl; }
|
||||
|
||||
|
||||
// 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; }
|
||||
|
||||
// get the size which the tree control should have
|
||||
wxSize GetTreeSize() const;
|
||||
|
||||
// get the page area
|
||||
wxRect GetPageRect() const;
|
||||
|
||||
// event handlers
|
||||
void OnSize(wxSizeEvent& 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;
|
||||
|
||||
|
Reference in New Issue
Block a user