]> git.saurik.com Git - wxWidgets.git/blame - samples/notebook/notebook.h
Virtualize showing/hiding the pages in wxBookCtrlBase.
[wxWidgets.git] / samples / notebook / notebook.h
CommitLineData
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"
873ff54b 17#include "wx/aui/auibook.h"
9133965e
WS
18
19#if wxUSE_LOG && !defined( __SMARTPHONE__ )
20 #define USE_LOG 1
4e62c3fd 21#else
9133965e 22 #define USE_LOG 0
4e62c3fd 23#endif
0b4d4194
JS
24
25// Define a new application
c1dfe277 26class MyApp : public wxApp
0b4d4194
JS
27{
28public:
477350ce 29 bool OnInit();
0b4d4194
JS
30};
31
32DECLARE_APP(MyApp)
33
eca15c0d 34
c1dfe277 35class MyFrame : public wxFrame
0b4d4194
JS
36{
37public:
eca15c0d 38 MyFrame();
c1dfe277
JS
39 virtual ~MyFrame();
40
9133965e
WS
41 void OnType(wxCommandEvent& event);
42 void OnOrient(wxCommandEvent& event);
43 void OnShowImages(wxCommandEvent& event);
8864388c 44 void OnStyle(wxCommandEvent& event);
9133965e 45 void OnExit(wxCommandEvent& event);
c1dfe277 46
9133965e 47 void OnAddPage(wxCommandEvent& event);
a85dda4a 48 void OnAddPageNoSelect(wxCommandEvent& event);
9133965e
WS
49 void OnInsertPage(wxCommandEvent& event);
50 void OnDeleteCurPage(wxCommandEvent& event);
51 void OnDeleteLastPage(wxCommandEvent& event);
52 void OnNextPage(wxCommandEvent& event);
f7aaef4d
VZ
53 void OnChangeSelection(wxCommandEvent &event);
54 void OnSetSelection(wxCommandEvent &event);
864181f4
VZ
55 void OnGetPageSize(wxCommandEvent &event);
56 void OnSetPageSize(wxCommandEvent &event);
c1dfe277 57
eca15c0d
VZ
58 void OnAddSubPage(wxCommandEvent& event);
59 void OnAddPageBefore(wxCommandEvent& event);
60
df1496e3
VZ
61#if wxUSE_HELP
62 void OnContextHelp(wxCommandEvent& event);
63#endif // wxUSE_HELP
64
d0a84b63
VZ
65 void OnHitTest(wxCommandEvent& event);
66
eca15c0d 67 void OnBookCtrl(wxBookCtrlBaseEvent& event);
02161c7c 68#if wxUSE_NOTEBOOK
eca15c0d 69 void OnNotebook(wxNotebookEvent& event) { OnBookCtrl(event); }
02161c7c
WS
70#endif
71#if wxUSE_CHOICEBOOK
eca15c0d 72 void OnChoicebook(wxChoicebookEvent& event) { OnBookCtrl(event); }
02161c7c
WS
73#endif
74#if wxUSE_LISTBOOK
eca15c0d
VZ
75 void OnListbook(wxListbookEvent& event) { OnBookCtrl(event); }
76#endif
77#if wxUSE_TREEBOOK
78 void OnTreebook(wxTreebookEvent& event) { OnBookCtrl(event); }
02161c7c 79#endif
d709457c
JS
80#if wxUSE_TOOLBOOK
81 void OnToolbook(wxToolbookEvent& event) { OnBookCtrl(event); }
82#endif
873ff54b
SL
83#if wxUSE_AUI
84 void OnAuiNotebook(wxAuiNotebookEvent& event) { OnBookCtrl(event); }
85#endif
96d37807 86
3957448a 87 void OnIdle(wxIdleEvent& event);
96d37807 88
eca15c0d
VZ
89#if wxUSE_TREEBOOK
90 void OnUpdateTreeMenu(wxUpdateUIEvent& event);
91#endif // wxUSE_TREEBOOK
92
93 wxBookCtrlBase *GetCurrentBook() const { return m_bookCtrl; }
9133965e 94
c1dfe277
JS
95private:
96 wxLog *m_logTargetOld;
97
eca15c0d
VZ
98 void RecreateBook();
99 wxPanel *CreateNewPage() const;
d0a84b63 100 void AddFlagStrIfFlagPresent(wxString & flagStr, long flags, long flag, const wxChar * flagName) const;
9133965e
WS
101
102 // Sample setup
eca15c0d
VZ
103 enum BookType
104 {
105 Type_Notebook,
eca15c0d 106 Type_Listbook,
136bafcd 107 Type_Choicebook,
eca15c0d 108 Type_Treebook,
d709457c 109 Type_Toolbook,
873ff54b 110 Type_AuiNotebook,
eca15c0d
VZ
111 Type_Max
112 } m_type;
9133965e
WS
113 int m_orient;
114 bool m_chkShowImages;
8864388c 115 bool m_fixedWidth;
9133965e 116 bool m_multi;
8864388c
VZ
117 bool m_noPageTheme;
118 bool m_buttonBar;
119 bool m_horzLayout;
c1dfe277
JS
120
121 // Controls
122
123 wxPanel *m_panel; // Panel containing notebook and other controls
eca15c0d 124 wxBookCtrlBase *m_bookCtrl;
c1dfe277 125
9133965e 126#if USE_LOG
c1dfe277
JS
127 // Log window
128 wxTextCtrl *m_text;
9133965e 129#endif // USE_LOG
c1dfe277 130
c1dfe277
JS
131 wxBoxSizer *m_sizerFrame;
132
c1dfe277 133 wxImageList *m_imageList;
0b4d4194 134
d22699b5 135 DECLARE_EVENT_TABLE()
0b4d4194
JS
136};
137
9133965e 138enum ID_COMMANDS
c1dfe277 139{
eca15c0d 140 // these should be in the same order as Type_XXX elements above
9133965e
WS
141 ID_BOOK_NOTEBOOK = wxID_HIGHEST,
142 ID_BOOK_LISTBOOK,
143 ID_BOOK_CHOICEBOOK,
eca15c0d 144 ID_BOOK_TREEBOOK,
d709457c 145 ID_BOOK_TOOLBOOK,
873ff54b 146 ID_BOOK_AUINOTEBOOK,
9133965e 147 ID_BOOK_MAX,
eca15c0d 148
9133965e
WS
149 ID_ORIENT_DEFAULT,
150 ID_ORIENT_TOP,
151 ID_ORIENT_BOTTOM,
152 ID_ORIENT_LEFT,
153 ID_ORIENT_RIGHT,
154 ID_ORIENT_MAX,
155 ID_SHOW_IMAGES,
8864388c 156 ID_FIXEDWIDTH,
9133965e 157 ID_MULTI,
8864388c
VZ
158 ID_NOPAGETHEME,
159 ID_BUTTONBAR,
160 ID_HORZ_LAYOUT,
9133965e 161 ID_ADD_PAGE,
a85dda4a 162 ID_ADD_PAGE_NO_SELECT,
9133965e
WS
163 ID_INSERT_PAGE,
164 ID_DELETE_CUR_PAGE,
165 ID_DELETE_LAST_PAGE,
166 ID_NEXT_PAGE,
eca15c0d 167 ID_ADD_PAGE_BEFORE,
d0a84b63 168 ID_ADD_SUB_PAGE,
f7aaef4d
VZ
169 ID_CHANGE_SELECTION,
170 ID_SET_SELECTION,
864181f4
VZ
171 ID_GET_PAGE_SIZE,
172 ID_SET_PAGE_SIZE,
d0a84b63 173
df1496e3
VZ
174#if wxUSE_HELP
175 ID_CONTEXT_HELP,
176#endif // wxUSE_HELP
d0a84b63 177 ID_HITTEST
c1dfe277 178};
76645ab3 179
425ec0a5 180
76645ab3 181/*
425ec0a5
FM
182 Name of each notebook page.
183 Used as a label for a page, and used when cloning the notebook
184 to decide what type of page it is.
76645ab3
VZ
185*/
186
425ec0a5
FM
187#define I_WAS_INSERTED_PAGE_NAME wxT("Inserted")
188#define RADIOBUTTONS_PAGE_NAME wxT("Radiobuttons")
189#define VETO_PAGE_NAME wxT("Veto")
190#define MAXIMIZED_BUTTON_PAGE_NAME wxT("Maximized button")
76645ab3
VZ
191
192// Pages that can be added by the user
425ec0a5
FM
193#define INSERTED_PAGE_NAME wxT("Inserted ")
194#define ADDED_PAGE_NAME wxT("Added ")
195#define ADDED_PAGE_NAME_BEFORE wxT(" Inserted before ")
196#define ADDED_SUB_PAGE_NAME wxT(" Inserted sub-page ")
eca15c0d
VZ
197
198