]> git.saurik.com Git - wxWidgets.git/blob - samples/notebook/notebook.h
made wxConvXXX objects usable at static initialization time
[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 // License: wxWindows license
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
25 class MyApp : public wxApp
26 {
27 public:
28 bool OnInit();
29 };
30
31 DECLARE_APP(MyApp)
32
33
34 class MyFrame : public wxFrame
35 {
36 public:
37 MyFrame();
38 virtual ~MyFrame();
39
40 void OnType(wxCommandEvent& event);
41 void OnOrient(wxCommandEvent& event);
42 void OnShowImages(wxCommandEvent& event);
43 void OnMulti(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 OnGoHome(wxCommandEvent &event);
53
54 void OnAddSubPage(wxCommandEvent& event);
55 void OnAddPageBefore(wxCommandEvent& event);
56
57 #if wxUSE_HELP
58 void OnContextHelp(wxCommandEvent& event);
59 #endif // wxUSE_HELP
60
61 void OnHitTest(wxCommandEvent& event);
62
63 void OnBookCtrl(wxBookCtrlBaseEvent& event);
64 #if wxUSE_NOTEBOOK
65 void OnNotebook(wxNotebookEvent& event) { OnBookCtrl(event); }
66 #endif
67 #if wxUSE_CHOICEBOOK
68 void OnChoicebook(wxChoicebookEvent& event) { OnBookCtrl(event); }
69 #endif
70 #if wxUSE_LISTBOOK
71 void OnListbook(wxListbookEvent& event) { OnBookCtrl(event); }
72 #endif
73 #if wxUSE_TREEBOOK
74 void OnTreebook(wxTreebookEvent& event) { OnBookCtrl(event); }
75 #endif
76 #if wxUSE_TOOLBOOK
77 void OnToolbook(wxToolbookEvent& event) { OnBookCtrl(event); }
78 #endif
79
80 void OnIdle(wxIdleEvent& event);
81
82 #if wxUSE_TREEBOOK
83 void OnUpdateTreeMenu(wxUpdateUIEvent& event);
84 #endif // wxUSE_TREEBOOK
85
86 wxBookCtrlBase *GetCurrentBook() const { return m_bookCtrl; }
87
88 private:
89 wxLog *m_logTargetOld;
90
91 void RecreateBook();
92 wxPanel *CreateNewPage() const;
93 int TranslateBookFlag(int nb, int lb, int chb, int tbk, int toolbk) const;
94 void AddFlagStrIfFlagPresent(wxString & flagStr, long flags, long flag, const wxChar * flagName) const;
95
96 // Sample setup
97 enum BookType
98 {
99 Type_Notebook,
100 Type_Listbook,
101 Type_Choicebook,
102 Type_Treebook,
103 Type_Toolbook,
104 Type_Max
105 } m_type;
106 int m_orient;
107 bool m_chkShowImages;
108 bool m_multi;
109
110 // Controls
111
112 wxPanel *m_panel; // Panel containing notebook and other controls
113 wxBookCtrlBase *m_bookCtrl;
114
115 #if USE_LOG
116 // Log window
117 wxTextCtrl *m_text;
118 #endif // USE_LOG
119
120 wxBoxSizer *m_sizerFrame;
121
122 wxImageList *m_imageList;
123
124 DECLARE_EVENT_TABLE()
125 };
126
127 enum ID_COMMANDS
128 {
129 // these should be in the same order as Type_XXX elements above
130 ID_BOOK_NOTEBOOK = wxID_HIGHEST,
131 ID_BOOK_LISTBOOK,
132 ID_BOOK_CHOICEBOOK,
133 ID_BOOK_TREEBOOK,
134 ID_BOOK_TOOLBOOK,
135 ID_BOOK_MAX,
136
137 ID_ORIENT_DEFAULT,
138 ID_ORIENT_TOP,
139 ID_ORIENT_BOTTOM,
140 ID_ORIENT_LEFT,
141 ID_ORIENT_RIGHT,
142 ID_ORIENT_MAX,
143 ID_SHOW_IMAGES,
144 ID_MULTI,
145 ID_ADD_PAGE,
146 ID_ADD_PAGE_NO_SELECT,
147 ID_INSERT_PAGE,
148 ID_DELETE_CUR_PAGE,
149 ID_DELETE_LAST_PAGE,
150 ID_NEXT_PAGE,
151 ID_ADD_PAGE_BEFORE,
152 ID_ADD_SUB_PAGE,
153 ID_GO_HOME,
154
155 #if wxUSE_HELP
156 ID_CONTEXT_HELP,
157 #endif // wxUSE_HELP
158 ID_HITTEST
159 };
160
161 /*
162 Name of each notebook page.
163 Used as a label for a page, and used when cloning the notebook
164 to decide what type of page it is.
165 */
166
167 #define I_WAS_INSERTED_PAGE_NAME wxT("Inserted")
168 #define RADIOBUTTONS_PAGE_NAME wxT("Radiobuttons")
169 #define VETO_PAGE_NAME wxT("Veto")
170 #define MAXIMIZED_BUTTON_PAGE_NAME wxT("Maximized button")
171
172 // Pages that can be added by the user
173 #define INSERTED_PAGE_NAME wxT("Inserted ")
174 #define ADDED_PAGE_NAME wxT("Added ")
175 #define ADDED_PAGE_NAME_BEFORE wxT(" Inserted before ")
176 #define ADDED_SUB_PAGE_NAME wxT(" Inserted sub-page ")
177
178