]>
Commit | Line | Data |
---|---|---|
0b4d4194 | 1 | ///////////////////////////////////////////////////////////////////////////// |
c1dfe277 JS |
2 | // Name: samples/notebook/notebook.h |
3 | // Purpose: a sample demonstrating notebook usage | |
0b4d4194 | 4 | // Author: Julian Smart |
c1dfe277 | 5 | // Modified by: Dimitri Schoolwerth |
0b4d4194 JS |
6 | // Created: 25/10/98 |
7 | // RCS-ID: $Id$ | |
be5a51fb | 8 | // Copyright: (c) 1998-2002 wxWidgets team |
526954c5 | 9 | // Licence: wxWindows licence |
0b4d4194 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
9133965e WS |
12 | #include "wx/choicebk.h" |
13 | #include "wx/listbook.h" | |
eca15c0d | 14 | #include "wx/treebook.h" |
9133965e | 15 | #include "wx/notebook.h" |
d709457c | 16 | #include "wx/toolbook.h" |
9133965e WS |
17 | |
18 | #if wxUSE_LOG && !defined( __SMARTPHONE__ ) | |
19 | #define USE_LOG 1 | |
4e62c3fd | 20 | #else |
9133965e | 21 | #define USE_LOG 0 |
4e62c3fd | 22 | #endif |
0b4d4194 JS |
23 | |
24 | // Define a new application | |
c1dfe277 | 25 | class MyApp : public wxApp |
0b4d4194 JS |
26 | { |
27 | public: | |
477350ce | 28 | bool OnInit(); |
0b4d4194 JS |
29 | }; |
30 | ||
31 | DECLARE_APP(MyApp) | |
32 | ||
eca15c0d | 33 | |
c1dfe277 | 34 | class MyFrame : public wxFrame |
0b4d4194 JS |
35 | { |
36 | public: | |
eca15c0d | 37 | MyFrame(); |
c1dfe277 JS |
38 | virtual ~MyFrame(); |
39 | ||
9133965e WS |
40 | void OnType(wxCommandEvent& event); |
41 | void OnOrient(wxCommandEvent& event); | |
42 | void OnShowImages(wxCommandEvent& event); | |
43 | void OnMulti(wxCommandEvent& event); | |
44 | void OnExit(wxCommandEvent& event); | |
c1dfe277 | 45 | |
9133965e | 46 | void OnAddPage(wxCommandEvent& event); |
a85dda4a | 47 | void OnAddPageNoSelect(wxCommandEvent& event); |
9133965e WS |
48 | void OnInsertPage(wxCommandEvent& event); |
49 | void OnDeleteCurPage(wxCommandEvent& event); | |
50 | void OnDeleteLastPage(wxCommandEvent& event); | |
51 | void OnNextPage(wxCommandEvent& event); | |
1d6fcbcc | 52 | void OnGoHome(wxCommandEvent &event); |
c1dfe277 | 53 | |
eca15c0d VZ |
54 | void OnAddSubPage(wxCommandEvent& event); |
55 | void OnAddPageBefore(wxCommandEvent& event); | |
56 | ||
df1496e3 VZ |
57 | #if wxUSE_HELP |
58 | void OnContextHelp(wxCommandEvent& event); | |
59 | #endif // wxUSE_HELP | |
60 | ||
d0a84b63 VZ |
61 | void OnHitTest(wxCommandEvent& event); |
62 | ||
eca15c0d | 63 | void OnBookCtrl(wxBookCtrlBaseEvent& event); |
02161c7c | 64 | #if wxUSE_NOTEBOOK |
eca15c0d | 65 | void OnNotebook(wxNotebookEvent& event) { OnBookCtrl(event); } |
02161c7c WS |
66 | #endif |
67 | #if wxUSE_CHOICEBOOK | |
eca15c0d | 68 | void OnChoicebook(wxChoicebookEvent& event) { OnBookCtrl(event); } |
02161c7c WS |
69 | #endif |
70 | #if wxUSE_LISTBOOK | |
eca15c0d VZ |
71 | void OnListbook(wxListbookEvent& event) { OnBookCtrl(event); } |
72 | #endif | |
73 | #if wxUSE_TREEBOOK | |
74 | void OnTreebook(wxTreebookEvent& event) { OnBookCtrl(event); } | |
02161c7c | 75 | #endif |
d709457c JS |
76 | #if wxUSE_TOOLBOOK |
77 | void OnToolbook(wxToolbookEvent& event) { OnBookCtrl(event); } | |
78 | #endif | |
96d37807 | 79 | |
3957448a | 80 | void OnIdle(wxIdleEvent& event); |
96d37807 | 81 | |
eca15c0d VZ |
82 | #if wxUSE_TREEBOOK |
83 | void OnUpdateTreeMenu(wxUpdateUIEvent& event); | |
84 | #endif // wxUSE_TREEBOOK | |
85 | ||
86 | wxBookCtrlBase *GetCurrentBook() const { return m_bookCtrl; } | |
9133965e | 87 | |
c1dfe277 JS |
88 | private: |
89 | wxLog *m_logTargetOld; | |
90 | ||
eca15c0d VZ |
91 | void RecreateBook(); |
92 | wxPanel *CreateNewPage() const; | |
d709457c | 93 | int TranslateBookFlag(int nb, int lb, int chb, int tbk, int toolbk) const; |
d0a84b63 | 94 | void AddFlagStrIfFlagPresent(wxString & flagStr, long flags, long flag, const wxChar * flagName) const; |
9133965e WS |
95 | |
96 | // Sample setup | |
eca15c0d VZ |
97 | enum BookType |
98 | { | |
99 | Type_Notebook, | |
eca15c0d | 100 | Type_Listbook, |
136bafcd | 101 | Type_Choicebook, |
eca15c0d | 102 | Type_Treebook, |
d709457c | 103 | Type_Toolbook, |
eca15c0d VZ |
104 | Type_Max |
105 | } m_type; | |
9133965e WS |
106 | int m_orient; |
107 | bool m_chkShowImages; | |
108 | bool m_multi; | |
c1dfe277 JS |
109 | |
110 | // Controls | |
111 | ||
112 | wxPanel *m_panel; // Panel containing notebook and other controls | |
eca15c0d | 113 | wxBookCtrlBase *m_bookCtrl; |
c1dfe277 | 114 | |
9133965e | 115 | #if USE_LOG |
c1dfe277 JS |
116 | // Log window |
117 | wxTextCtrl *m_text; | |
9133965e | 118 | #endif // USE_LOG |
c1dfe277 | 119 | |
c1dfe277 JS |
120 | wxBoxSizer *m_sizerFrame; |
121 | ||
c1dfe277 | 122 | wxImageList *m_imageList; |
0b4d4194 | 123 | |
d22699b5 | 124 | DECLARE_EVENT_TABLE() |
0b4d4194 JS |
125 | }; |
126 | ||
9133965e | 127 | enum ID_COMMANDS |
c1dfe277 | 128 | { |
eca15c0d | 129 | // these should be in the same order as Type_XXX elements above |
9133965e WS |
130 | ID_BOOK_NOTEBOOK = wxID_HIGHEST, |
131 | ID_BOOK_LISTBOOK, | |
132 | ID_BOOK_CHOICEBOOK, | |
eca15c0d | 133 | ID_BOOK_TREEBOOK, |
d709457c | 134 | ID_BOOK_TOOLBOOK, |
9133965e | 135 | ID_BOOK_MAX, |
eca15c0d | 136 | |
9133965e WS |
137 | ID_ORIENT_DEFAULT, |
138 | ID_ORIENT_TOP, | |
139 | ID_ORIENT_BOTTOM, | |
140 | ID_ORIENT_LEFT, | |
141 | ID_ORIENT_RIGHT, | |
142 | ID_ORIENT_MAX, | |
143 | ID_SHOW_IMAGES, | |
144 | ID_MULTI, | |
145 | ID_ADD_PAGE, | |
a85dda4a | 146 | ID_ADD_PAGE_NO_SELECT, |
9133965e WS |
147 | ID_INSERT_PAGE, |
148 | ID_DELETE_CUR_PAGE, | |
149 | ID_DELETE_LAST_PAGE, | |
150 | ID_NEXT_PAGE, | |
eca15c0d | 151 | ID_ADD_PAGE_BEFORE, |
d0a84b63 | 152 | ID_ADD_SUB_PAGE, |
1d6fcbcc | 153 | ID_GO_HOME, |
d0a84b63 | 154 | |
df1496e3 VZ |
155 | #if wxUSE_HELP |
156 | ID_CONTEXT_HELP, | |
157 | #endif // wxUSE_HELP | |
d0a84b63 | 158 | ID_HITTEST |
c1dfe277 | 159 | }; |
76645ab3 | 160 | |
425ec0a5 | 161 | |
76645ab3 | 162 | /* |
425ec0a5 FM |
163 | Name of each notebook page. |
164 | Used as a label for a page, and used when cloning the notebook | |
165 | to decide what type of page it is. | |
76645ab3 VZ |
166 | */ |
167 | ||
425ec0a5 FM |
168 | #define I_WAS_INSERTED_PAGE_NAME wxT("Inserted") |
169 | #define RADIOBUTTONS_PAGE_NAME wxT("Radiobuttons") | |
170 | #define VETO_PAGE_NAME wxT("Veto") | |
171 | #define MAXIMIZED_BUTTON_PAGE_NAME wxT("Maximized button") | |
76645ab3 VZ |
172 | |
173 | // Pages that can be added by the user | |
425ec0a5 FM |
174 | #define INSERTED_PAGE_NAME wxT("Inserted ") |
175 | #define ADDED_PAGE_NAME wxT("Added ") | |
176 | #define ADDED_PAGE_NAME_BEFORE wxT(" Inserted before ") | |
177 | #define ADDED_SUB_PAGE_NAME wxT(" Inserted sub-page ") | |
eca15c0d VZ |
178 | |
179 |