]> git.saurik.com Git - wxWidgets.git/blame_incremental - samples/notebook/notebook.h
Fixed problems caused by duplicated names across different style types.
[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/toolbook.h"
17
18#if wxUSE_LOG && !defined( __SMARTPHONE__ )
19 #define USE_LOG 1
20#else
21 #define USE_LOG 0
22#endif
23
24// Define a new application
25class MyApp : public wxApp
26{
27public:
28 bool OnInit();
29};
30
31DECLARE_APP(MyApp)
32
33
34class MyFrame : public wxFrame
35{
36public:
37 MyFrame();
38 virtual ~MyFrame();
39
40 void OnType(wxCommandEvent& event);
41 void OnOrient(wxCommandEvent& event);
42 void OnShowImages(wxCommandEvent& event);
43 void OnStyle(wxCommandEvent& event);
44 void OnExit(wxCommandEvent& event);
45
46 void OnAddPage(wxCommandEvent& event);
47 void OnAddPageNoSelect(wxCommandEvent& event);
48 void OnInsertPage(wxCommandEvent& event);
49 void OnDeleteCurPage(wxCommandEvent& event);
50 void OnDeleteLastPage(wxCommandEvent& event);
51 void OnNextPage(wxCommandEvent& event);
52 void OnChangeSelection(wxCommandEvent &event);
53 void OnSetSelection(wxCommandEvent &event);
54
55 void OnAddSubPage(wxCommandEvent& event);
56 void OnAddPageBefore(wxCommandEvent& event);
57
58#if wxUSE_HELP
59 void OnContextHelp(wxCommandEvent& event);
60#endif // wxUSE_HELP
61
62 void OnHitTest(wxCommandEvent& event);
63
64 void OnBookCtrl(wxBookCtrlBaseEvent& event);
65#if wxUSE_NOTEBOOK
66 void OnNotebook(wxNotebookEvent& event) { OnBookCtrl(event); }
67#endif
68#if wxUSE_CHOICEBOOK
69 void OnChoicebook(wxChoicebookEvent& event) { OnBookCtrl(event); }
70#endif
71#if wxUSE_LISTBOOK
72 void OnListbook(wxListbookEvent& event) { OnBookCtrl(event); }
73#endif
74#if wxUSE_TREEBOOK
75 void OnTreebook(wxTreebookEvent& event) { OnBookCtrl(event); }
76#endif
77#if wxUSE_TOOLBOOK
78 void OnToolbook(wxToolbookEvent& event) { OnBookCtrl(event); }
79#endif
80
81 void OnIdle(wxIdleEvent& event);
82
83#if wxUSE_TREEBOOK
84 void OnUpdateTreeMenu(wxUpdateUIEvent& event);
85#endif // wxUSE_TREEBOOK
86
87 wxBookCtrlBase *GetCurrentBook() const { return m_bookCtrl; }
88
89private:
90 wxLog *m_logTargetOld;
91
92 void RecreateBook();
93 wxPanel *CreateNewPage() const;
94 int TranslateBookFlag(int nb, int lb, int chb, int tbk, int toolbk) const;
95 void AddFlagStrIfFlagPresent(wxString & flagStr, long flags, long flag, const wxChar * flagName) const;
96
97 // Sample setup
98 enum BookType
99 {
100 Type_Notebook,
101 Type_Listbook,
102 Type_Choicebook,
103 Type_Treebook,
104 Type_Toolbook,
105 Type_Max
106 } m_type;
107 int m_orient;
108 bool m_chkShowImages;
109 bool m_fixedWidth;
110 bool m_multi;
111 bool m_noPageTheme;
112 bool m_buttonBar;
113 bool m_horzLayout;
114
115 // Controls
116
117 wxPanel *m_panel; // Panel containing notebook and other controls
118 wxBookCtrlBase *m_bookCtrl;
119
120#if USE_LOG
121 // Log window
122 wxTextCtrl *m_text;
123#endif // USE_LOG
124
125 wxBoxSizer *m_sizerFrame;
126
127 wxImageList *m_imageList;
128
129 DECLARE_EVENT_TABLE()
130};
131
132enum ID_COMMANDS
133{
134 // these should be in the same order as Type_XXX elements above
135 ID_BOOK_NOTEBOOK = wxID_HIGHEST,
136 ID_BOOK_LISTBOOK,
137 ID_BOOK_CHOICEBOOK,
138 ID_BOOK_TREEBOOK,
139 ID_BOOK_TOOLBOOK,
140 ID_BOOK_MAX,
141
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,
149 ID_FIXEDWIDTH,
150 ID_MULTI,
151 ID_NOPAGETHEME,
152 ID_BUTTONBAR,
153 ID_HORZ_LAYOUT,
154 ID_ADD_PAGE,
155 ID_ADD_PAGE_NO_SELECT,
156 ID_INSERT_PAGE,
157 ID_DELETE_CUR_PAGE,
158 ID_DELETE_LAST_PAGE,
159 ID_NEXT_PAGE,
160 ID_ADD_PAGE_BEFORE,
161 ID_ADD_SUB_PAGE,
162 ID_CHANGE_SELECTION,
163 ID_SET_SELECTION,
164
165#if wxUSE_HELP
166 ID_CONTEXT_HELP,
167#endif // wxUSE_HELP
168 ID_HITTEST
169};
170
171
172/*
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.
176*/
177
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")
182
183// Pages that can be added by the user
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 ")
188
189