]>
Commit | Line | Data |
---|---|---|
f5e0b4bc WS |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/choicebk.h | |
3 | // Purpose: wxChoicebook: wxChoice and wxNotebook combination | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: Wlodzimierz ABX Skiba from wx/listbook.h | |
6 | // Created: 15.09.04 | |
f5e0b4bc WS |
7 | // Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba |
8 | // Licence: wxWindows licence | |
9 | /////////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_CHOICEBOOK_H_ | |
12 | #define _WX_CHOICEBOOK_H_ | |
13 | ||
f5e0b4bc WS |
14 | #include "wx/defs.h" |
15 | ||
16 | #if wxUSE_CHOICEBOOK | |
17 | ||
18 | #include "wx/bookctrl.h" | |
cc66bf5a | 19 | #include "wx/choice.h" |
28e42e02 | 20 | #include "wx/containr.h" |
f5e0b4bc | 21 | |
b5dbe15d | 22 | class WXDLLIMPEXP_FWD_CORE wxChoice; |
f5e0b4bc | 23 | |
ce7fe42e VZ |
24 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CHOICEBOOK_PAGE_CHANGED, wxBookCtrlEvent ); |
25 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CHOICEBOOK_PAGE_CHANGING, wxBookCtrlEvent ); | |
1d6fcbcc | 26 | |
90c0f63a VZ |
27 | // wxChoicebook flags |
28 | #define wxCHB_DEFAULT wxBK_DEFAULT | |
29 | #define wxCHB_TOP wxBK_TOP | |
30 | #define wxCHB_BOTTOM wxBK_BOTTOM | |
31 | #define wxCHB_LEFT wxBK_LEFT | |
32 | #define wxCHB_RIGHT wxBK_RIGHT | |
33 | #define wxCHB_ALIGN_MASK wxBK_ALIGN_MASK | |
1d6fcbcc | 34 | |
f5e0b4bc WS |
35 | // ---------------------------------------------------------------------------- |
36 | // wxChoicebook | |
37 | // ---------------------------------------------------------------------------- | |
38 | ||
28e42e02 | 39 | class WXDLLIMPEXP_CORE wxChoicebook : public wxNavigationEnabled<wxBookCtrlBase> |
f5e0b4bc WS |
40 | { |
41 | public: | |
681be2ef | 42 | wxChoicebook() { } |
f5e0b4bc WS |
43 | |
44 | wxChoicebook(wxWindow *parent, | |
45 | wxWindowID id, | |
46 | const wxPoint& pos = wxDefaultPosition, | |
47 | const wxSize& size = wxDefaultSize, | |
48 | long style = 0, | |
49 | const wxString& name = wxEmptyString) | |
50 | { | |
f5e0b4bc WS |
51 | (void)Create(parent, id, pos, size, style, name); |
52 | } | |
53 | ||
54 | // quasi ctor | |
55 | bool Create(wxWindow *parent, | |
56 | wxWindowID id, | |
57 | const wxPoint& pos = wxDefaultPosition, | |
58 | const wxSize& size = wxDefaultSize, | |
59 | long style = 0, | |
60 | const wxString& name = wxEmptyString); | |
61 | ||
62 | ||
f5e0b4bc WS |
63 | virtual bool SetPageText(size_t n, const wxString& strText); |
64 | virtual wxString GetPageText(size_t n) const; | |
65 | virtual int GetPageImage(size_t n) const; | |
66 | virtual bool SetPageImage(size_t n, int imageId); | |
f5e0b4bc WS |
67 | virtual bool InsertPage(size_t n, |
68 | wxWindow *page, | |
69 | const wxString& text, | |
70 | bool bSelect = false, | |
1871b9fa | 71 | int imageId = NO_IMAGE); |
64c38b4b VZ |
72 | virtual int SetSelection(size_t n) |
73 | { return DoSetSelection(n, SetSelection_SendEvent); } | |
1d6fcbcc | 74 | virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } |
f5e0b4bc WS |
75 | virtual void SetImageList(wxImageList *imageList); |
76 | ||
f5e0b4bc WS |
77 | virtual bool DeleteAllPages(); |
78 | ||
c9ab63f4 | 79 | // returns the choice control |
d8fd7acb | 80 | wxChoice* GetChoiceCtrl() const { return (wxChoice*)m_bookctrl; } |
c9ab63f4 | 81 | |
6cab632f VZ |
82 | // Override this to return true because the part of parent window |
83 | // background between our controlling wxChoice and the page area should | |
84 | // show through. | |
85 | virtual bool HasTransparentBackground() { return true; } | |
86 | ||
f5e0b4bc | 87 | protected: |
64c38b4b VZ |
88 | virtual void DoSetWindowVariant(wxWindowVariant variant); |
89 | ||
f5e0b4bc WS |
90 | virtual wxWindow *DoRemovePage(size_t page); |
91 | ||
1d6fcbcc VZ |
92 | void UpdateSelectedPage(size_t newsel) |
93 | { | |
e79d4945 | 94 | m_selection = static_cast<int>(newsel); |
c2566575 | 95 | GetChoiceCtrl()->Select(m_selection); |
1d6fcbcc VZ |
96 | } |
97 | ||
3e97a905 VZ |
98 | wxBookCtrlEvent* CreatePageChangingEvent() const; |
99 | void MakeChangedEvent(wxBookCtrlEvent &event); | |
1d6fcbcc | 100 | |
f5e0b4bc | 101 | // event handlers |
f5e0b4bc WS |
102 | void OnChoiceSelected(wxCommandEvent& event); |
103 | ||
bb08a4a1 | 104 | private: |
f5e0b4bc WS |
105 | DECLARE_EVENT_TABLE() |
106 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook) | |
107 | }; | |
108 | ||
109 | // ---------------------------------------------------------------------------- | |
110 | // choicebook event class and related stuff | |
111 | // ---------------------------------------------------------------------------- | |
112 | ||
3e97a905 | 113 | // wxChoicebookEvent is obsolete and defined for compatibility only |
586bed94 | 114 | #define wxChoicebookEvent wxBookCtrlEvent |
3e97a905 VZ |
115 | typedef wxBookCtrlEventFunction wxChoicebookEventFunction; |
116 | #define wxChoicebookEventHandler(func) wxBookCtrlEventHandler(func) | |
7fa03f04 | 117 | |
d94c09cd | 118 | #define EVT_CHOICEBOOK_PAGE_CHANGED(winid, fn) \ |
ce7fe42e | 119 | wx__DECLARE_EVT1(wxEVT_CHOICEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) |
7fa03f04 | 120 | |
d94c09cd | 121 | #define EVT_CHOICEBOOK_PAGE_CHANGING(winid, fn) \ |
ce7fe42e VZ |
122 | wx__DECLARE_EVT1(wxEVT_CHOICEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn)) |
123 | ||
124 | // old wxEVT_COMMAND_* constants | |
125 | #define wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED wxEVT_CHOICEBOOK_PAGE_CHANGED | |
126 | #define wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING wxEVT_CHOICEBOOK_PAGE_CHANGING | |
f5e0b4bc WS |
127 | |
128 | #endif // wxUSE_CHOICEBOOK | |
129 | ||
130 | #endif // _WX_CHOICEBOOK_H_ |