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