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