]> git.saurik.com Git - wxWidgets.git/blame_incremental - samples/notebook/notebook.h
Extract compiler-specific macro definitions in a new wx/compiler.h.
[wxWidgets.git] / samples / notebook / notebook.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: samples/notebook/notebook.h
3// Purpose: a sample demonstrating notebook usage
4// Author: Julian Smart
5// Modified by: Dimitri Schoolwerth
6// Created: 25/10/98
7// RCS-ID: $Id$
8// Copyright: (c) 1998-2002 wxWidgets team
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#include "wx/choicebk.h"
13#include "wx/listbook.h"
14#include "wx/treebook.h"
15#include "wx/notebook.h"
16#include "wx/simplebook.h"
17#include "wx/toolbook.h"
18#include "wx/aui/auibook.h"
19
20#if wxUSE_LOG && !defined( __SMARTPHONE__ )
21 #define USE_LOG 1
22#else
23 #define USE_LOG 0
24#endif
25
26// Define a new application
27class MyApp : public wxApp
28{
29public:
30 bool OnInit();
31};
32
33DECLARE_APP(MyApp)
34
35
36class MyFrame : public wxFrame
37{
38public:
39 MyFrame();
40 virtual ~MyFrame();
41
42 void OnType(wxCommandEvent& event);
43 void OnOrient(wxCommandEvent& event);
44 void OnShowImages(wxCommandEvent& event);
45 void OnStyle(wxCommandEvent& event);
46 void OnExit(wxCommandEvent& event);
47
48 void OnAddPage(wxCommandEvent& event);
49 void OnAddPageNoSelect(wxCommandEvent& event);
50 void OnInsertPage(wxCommandEvent& event);
51 void OnDeleteCurPage(wxCommandEvent& event);
52 void OnDeleteLastPage(wxCommandEvent& event);
53 void OnNextPage(wxCommandEvent& event);
54 void OnChangeSelection(wxCommandEvent &event);
55 void OnSetSelection(wxCommandEvent &event);
56 void OnGetPageSize(wxCommandEvent &event);
57 void OnSetPageSize(wxCommandEvent &event);
58
59 void OnAddSubPage(wxCommandEvent& event);
60 void OnAddPageBefore(wxCommandEvent& event);
61
62#if wxUSE_HELP
63 void OnContextHelp(wxCommandEvent& event);
64#endif // wxUSE_HELP
65
66 void OnHitTest(wxCommandEvent& event);
67
68 void OnBookCtrl(wxBookCtrlBaseEvent& event);
69#if wxUSE_NOTEBOOK
70 void OnNotebook(wxNotebookEvent& event) { OnBookCtrl(event); }
71#endif
72#if wxUSE_CHOICEBOOK
73 void OnChoicebook(wxChoicebookEvent& event) { OnBookCtrl(event); }
74#endif
75#if wxUSE_LISTBOOK
76 void OnListbook(wxListbookEvent& event) { OnBookCtrl(event); }
77#endif
78#if wxUSE_TREEBOOK
79 void OnTreebook(wxTreebookEvent& event) { OnBookCtrl(event); }
80#endif
81#if wxUSE_TOOLBOOK
82 void OnToolbook(wxToolbookEvent& event) { OnBookCtrl(event); }
83#endif
84#if wxUSE_AUI
85 void OnAuiNotebook(wxAuiNotebookEvent& event) { OnBookCtrl(event); }
86#endif
87
88 void OnIdle(wxIdleEvent& event);
89
90#if wxUSE_TREEBOOK
91 void OnUpdateTreeMenu(wxUpdateUIEvent& event);
92#endif // wxUSE_TREEBOOK
93
94 wxBookCtrlBase *GetCurrentBook() const { return m_bookCtrl; }
95
96private:
97 wxLog *m_logTargetOld;
98
99 void RecreateBook();
100 wxPanel *CreateNewPage() const;
101 void AddFlagStrIfFlagPresent(wxString & flagStr, long flags, long flag, const wxChar * flagName) const;
102
103 // Sample setup
104 enum BookType
105 {
106 Type_Notebook,
107 Type_Listbook,
108 Type_Choicebook,
109 Type_Treebook,
110 Type_Toolbook,
111 Type_AuiNotebook,
112 Type_Simplebook,
113 Type_Max
114 } m_type;
115 int m_orient;
116 bool m_chkShowImages;
117 bool m_fixedWidth;
118 bool m_multi;
119 bool m_noPageTheme;
120 bool m_buttonBar;
121 bool m_horzLayout;
122
123 // Controls
124
125 wxPanel *m_panel; // Panel containing notebook and other controls
126 wxBookCtrlBase *m_bookCtrl;
127
128#if USE_LOG
129 // Log window
130 wxTextCtrl *m_text;
131#endif // USE_LOG
132
133 wxBoxSizer *m_sizerFrame;
134
135 wxImageList *m_imageList;
136
137 DECLARE_EVENT_TABLE()
138};
139
140enum ID_COMMANDS
141{
142 // these should be in the same order as Type_XXX elements above
143 ID_BOOK_NOTEBOOK = wxID_HIGHEST,
144 ID_BOOK_LISTBOOK,
145 ID_BOOK_CHOICEBOOK,
146 ID_BOOK_TREEBOOK,
147 ID_BOOK_TOOLBOOK,
148 ID_BOOK_AUINOTEBOOK,
149 ID_BOOK_SIMPLEBOOK,
150 ID_BOOK_MAX,
151
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,
159 ID_FIXEDWIDTH,
160 ID_MULTI,
161 ID_NOPAGETHEME,
162 ID_BUTTONBAR,
163 ID_HORZ_LAYOUT,
164 ID_ADD_PAGE,
165 ID_ADD_PAGE_NO_SELECT,
166 ID_INSERT_PAGE,
167 ID_DELETE_CUR_PAGE,
168 ID_DELETE_LAST_PAGE,
169 ID_NEXT_PAGE,
170 ID_ADD_PAGE_BEFORE,
171 ID_ADD_SUB_PAGE,
172 ID_CHANGE_SELECTION,
173 ID_SET_SELECTION,
174 ID_GET_PAGE_SIZE,
175 ID_SET_PAGE_SIZE,
176
177#if wxUSE_HELP
178 ID_CONTEXT_HELP,
179#endif // wxUSE_HELP
180 ID_HITTEST
181};
182
183
184/*
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.
188*/
189
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")
194
195// Pages that can be added by the user
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 ")
200
201