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
|
- Added access to the border size between pages and controller in book
|
||||||
based controls (wxBookCtrlBase::Get/SetInternalBorder).
|
based controls (wxBookCtrlBase::Get/SetInternalBorder).
|
||||||
- Added initial wxRichTextCtrl implementation.
|
- 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:
|
||||||
|
|
||||||
|
@@ -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
|
// true if we must delete m_imageList
|
||||||
bool m_ownsImageList;
|
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:
|
private:
|
||||||
|
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
@@ -221,7 +234,9 @@ private:
|
|||||||
// internal border
|
// internal border
|
||||||
unsigned int m_internalBorder;
|
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 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_CHANGED(id, fn) EVT_NOTEBOOK_PAGE_CHANGED(id, fn)
|
||||||
#define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_NOTEBOOK_PAGE_CHANGING(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
|
#else
|
||||||
// dedicated to Smartphones
|
// dedicated to Smartphones
|
||||||
#include "wx/choicebk.h"
|
#include "wx/choicebk.h"
|
||||||
@@ -276,11 +286,14 @@ private:
|
|||||||
#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING
|
#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_CHANGED(id, fn) EVT_CHOICEBOOK_PAGE_CHANGED(id, fn)
|
||||||
#define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_CHOICEBOOK_PAGE_CHANGING(id, fn)
|
#define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_CHOICEBOOK_PAGE_CHANGING(id, fn)
|
||||||
#define wxBC_TOP wxCHB_TOP
|
#endif
|
||||||
#define wxBC_BOTTOM wxCHB_BOTTOM
|
|
||||||
#define wxBC_LEFT wxCHB_LEFT
|
#if WXWIN_COMPATIBILITY_2_6
|
||||||
#define wxBC_RIGHT wxCHB_RIGHT
|
#define wxBC_TOP wxBK_TOP
|
||||||
#define wxBC_DEFAULT wxCHB_DEFAULT
|
#define wxBC_BOTTOM wxBK_BOTTOM
|
||||||
|
#define wxBC_LEFT wxBK_LEFT
|
||||||
|
#define wxBC_RIGHT wxBK_RIGHT
|
||||||
|
#define wxBC_DEFAULT wxBK_DEFAULT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // wxUSE_BOOKCTRL
|
#endif // wxUSE_BOOKCTRL
|
||||||
|
@@ -67,30 +67,20 @@ public:
|
|||||||
virtual int SetSelection(size_t n);
|
virtual int SetSelection(size_t n);
|
||||||
virtual void SetImageList(wxImageList *imageList);
|
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();
|
virtual bool DeleteAllPages();
|
||||||
|
|
||||||
// returns the choice control
|
// returns the choice control
|
||||||
wxChoice* GetChoiceCtrl() const { return m_choice; }
|
wxChoice* GetChoiceCtrl() const { return (wxChoice*)m_bookctrl; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxWindow *DoRemovePage(size_t page);
|
virtual wxWindow *DoRemovePage(size_t page);
|
||||||
|
|
||||||
// get the size which the choice control should have
|
// get the size which the choice control should have
|
||||||
wxSize GetChoiceSize() const;
|
virtual wxSize GetControllerSize() const;
|
||||||
|
|
||||||
// get the page area
|
|
||||||
wxRect GetPageRect() 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
|
// the currently selected page or wxNOT_FOUND if none
|
||||||
int m_selection;
|
int m_selection;
|
||||||
|
|
||||||
|
@@ -1530,38 +1530,59 @@ enum wxBorder
|
|||||||
#define wxSP_ARROW_KEYS 0x1000
|
#define wxSP_ARROW_KEYS 0x1000
|
||||||
#define wxSP_WRAP 0x2000
|
#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
|
#if WXWIN_COMPATIBILITY_2_6
|
||||||
#define wxNB_TOP 0x0000 /* default */
|
/* Use common book wxBK_* flags for describing alignment */
|
||||||
#define wxNB_LEFT 0x0020
|
#define wxNB_DEFAULT wxBK_DEFAULT
|
||||||
#define wxNB_RIGHT 0x0040
|
#define wxNB_TOP wxBK_TOP
|
||||||
#define wxNB_BOTTOM 0x0080
|
#define wxNB_BOTTOM wxBK_BOTTOM
|
||||||
#define wxNB_MULTILINE 0x0100
|
#define wxNB_LEFT wxBK_LEFT
|
||||||
#define wxNB_NOPAGETHEME 0x0200
|
#define wxNB_RIGHT wxBK_RIGHT
|
||||||
#define wxNB_FLAT 0x0400
|
#endif
|
||||||
#define wxNB_DEFAULT wxNB_TOP
|
|
||||||
|
#define wxNB_FIXEDWIDTH 0x0100
|
||||||
|
#define wxNB_MULTILINE 0x0200
|
||||||
|
#define wxNB_NOPAGETHEME 0x0400
|
||||||
|
#define wxNB_FLAT 0x0800
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* wxListbook flags
|
* wxListbook flags
|
||||||
*/
|
*/
|
||||||
#define wxLB_DEFAULT 0x0
|
#if WXWIN_COMPATIBILITY_2_6
|
||||||
#define wxLB_TOP 0x1
|
/* Use common book wxBK_* flags for describing alignment */
|
||||||
#define wxLB_BOTTOM 0x2
|
#define wxLB_DEFAULT wxBK_DEFAULT
|
||||||
#define wxLB_LEFT 0x4
|
#define wxLB_TOP wxBK_TOP
|
||||||
#define wxLB_RIGHT 0x8
|
#define wxLB_BOTTOM wxBK_BOTTOM
|
||||||
#define wxLB_ALIGN_MASK 0xf
|
#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
|
#if WXWIN_COMPATIBILITY_2_6
|
||||||
#define wxCHB_TOP 0x1
|
/* Use common book wxBK_* flags for describing alignment */
|
||||||
#define wxCHB_BOTTOM 0x2
|
#define wxCHB_DEFAULT wxBK_DEFAULT
|
||||||
#define wxCHB_LEFT 0x4
|
#define wxCHB_TOP wxBK_TOP
|
||||||
#define wxCHB_RIGHT 0x8
|
#define wxCHB_BOTTOM wxBK_BOTTOM
|
||||||
#define wxCHB_ALIGN_MASK 0xf
|
#define wxCHB_LEFT wxBK_LEFT
|
||||||
|
#define wxCHB_RIGHT wxBK_RIGHT
|
||||||
|
#define wxCHB_ALIGN_MASK wxBK_ALIGN_MASK
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* wxTabCtrl flags
|
* wxTabCtrl flags
|
||||||
|
@@ -16,25 +16,11 @@
|
|||||||
|
|
||||||
#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"
|
#include "wx/bookctrl.h"
|
||||||
|
|
||||||
class WXDLLEXPORT wxListView;
|
class WXDLLEXPORT wxListView;
|
||||||
class WXDLLEXPORT wxListEvent;
|
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 int SetSelection(size_t n);
|
||||||
virtual void SetImageList(wxImageList *imageList);
|
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:
|
protected:
|
||||||
virtual wxWindow *DoRemovePage(size_t page);
|
virtual wxWindow *DoRemovePage(size_t page);
|
||||||
|
|
||||||
// get the size which the list control should have
|
// get the size which the list control should have
|
||||||
wxSize GetListSize() const;
|
virtual wxSize GetControllerSize() const;
|
||||||
|
|
||||||
// get the page area
|
|
||||||
wxRect GetPageRect() const;
|
|
||||||
|
|
||||||
// event handlers
|
// event handlers
|
||||||
void OnSize(wxSizeEvent& event);
|
|
||||||
void OnListSelected(wxListEvent& event);
|
void OnListSelected(wxListEvent& event);
|
||||||
|
void OnSize(wxSizeEvent& 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
|
|
||||||
|
|
||||||
// the currently selected page or wxNOT_FOUND if none
|
// the currently selected page or wxNOT_FOUND if none
|
||||||
int m_selection;
|
int m_selection;
|
||||||
|
@@ -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,
|
wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxTBK_DEFAULT,
|
long style = wxBK_DEFAULT,
|
||||||
const wxString& name = wxEmptyString)
|
const wxString& name = wxEmptyString)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
@@ -75,7 +57,7 @@ public:
|
|||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
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
|
// get the parent page or wxNOT_FOUND if this is a top level page
|
||||||
int GetPageParent(size_t pos) const;
|
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)
|
// This subclass of wxBookCtrlBase accepts NULL page pointers (empty pages)
|
||||||
virtual bool AllowNullPage() const { return true; }
|
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 OnTreeSelectionChange(wxTreeEvent& event);
|
||||||
void OnTreeNodeExpandedCollapsed(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
|
// array of page ids and page windows
|
||||||
wxArrayTreeItemIds m_treeIds;
|
wxArrayTreeItemIds m_treeIds;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user