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