compilation fixes for wxUSE_TREEBOOK=0
[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
17 #if wxUSE_LOG && !defined( __SMARTPHONE__ )
18 #define USE_LOG 1
19 #else
20 #define USE_LOG 0
21 #endif
22
23 // Define a new application
24 class MyApp : public wxApp
25 {
26 public:
27 bool OnInit();
28 };
29
30 DECLARE_APP(MyApp)
31
32
33 class MyFrame : public wxFrame
34 {
35 public:
36 MyFrame();
37 virtual ~MyFrame();
38
39 void OnType(wxCommandEvent& event);
40 void OnOrient(wxCommandEvent& event);
41 void OnShowImages(wxCommandEvent& event);
42 void OnMulti(wxCommandEvent& event);
43 void OnExit(wxCommandEvent& event);
44
45 void OnAddPage(wxCommandEvent& event);
46 void OnInsertPage(wxCommandEvent& event);
47 void OnDeleteCurPage(wxCommandEvent& event);
48 void OnDeleteLastPage(wxCommandEvent& event);
49 void OnNextPage(wxCommandEvent& event);
50
51 void OnAddSubPage(wxCommandEvent& event);
52 void OnAddPageBefore(wxCommandEvent& event);
53
54 void OnBookCtrl(wxBookCtrlBaseEvent& event);
55 #if wxUSE_NOTEBOOK
56 void OnNotebook(wxNotebookEvent& event) { OnBookCtrl(event); }
57 #endif
58 #if wxUSE_CHOICEBOOK
59 void OnChoicebook(wxChoicebookEvent& event) { OnBookCtrl(event); }
60 #endif
61 #if wxUSE_LISTBOOK
62 void OnListbook(wxListbookEvent& event) { OnBookCtrl(event); }
63 #endif
64 #if wxUSE_TREEBOOK
65 void OnTreebook(wxTreebookEvent& event) { OnBookCtrl(event); }
66 #endif
67
68 void OnIdle(wxIdleEvent& event);
69
70 #if wxUSE_TREEBOOK
71 void OnUpdateTreeMenu(wxUpdateUIEvent& event);
72 #endif // wxUSE_TREEBOOK
73
74 wxBookCtrlBase *GetCurrentBook() const { return m_bookCtrl; }
75
76 private:
77 wxLog *m_logTargetOld;
78
79 void RecreateBook();
80 wxPanel *CreateNewPage() const;
81 int TranslateBookFlag(int nb, int lb, int chb, int tbk) const;
82
83 // Sample setup
84 enum BookType
85 {
86 Type_Notebook,
87 Type_Listbook,
88 Type_Choicebook,
89 Type_Treebook,
90 Type_Max
91 } m_type;
92 int m_orient;
93 bool m_chkShowImages;
94 bool m_multi;
95
96 // Controls
97
98 wxPanel *m_panel; // Panel containing notebook and other controls
99 wxBookCtrlBase *m_bookCtrl;
100
101 #if USE_LOG
102 // Log window
103 wxTextCtrl *m_text;
104 #endif // USE_LOG
105
106 wxBoxSizer *m_sizerFrame;
107
108 wxImageList *m_imageList;
109
110 DECLARE_EVENT_TABLE()
111 };
112
113 enum ID_COMMANDS
114 {
115 // these should be in the same order as Type_XXX elements above
116 ID_BOOK_NOTEBOOK = wxID_HIGHEST,
117 ID_BOOK_LISTBOOK,
118 ID_BOOK_CHOICEBOOK,
119 ID_BOOK_TREEBOOK,
120 ID_BOOK_MAX,
121
122 ID_ORIENT_DEFAULT,
123 ID_ORIENT_TOP,
124 ID_ORIENT_BOTTOM,
125 ID_ORIENT_LEFT,
126 ID_ORIENT_RIGHT,
127 ID_ORIENT_MAX,
128 ID_SHOW_IMAGES,
129 ID_MULTI,
130 ID_ADD_PAGE,
131 ID_INSERT_PAGE,
132 ID_DELETE_CUR_PAGE,
133 ID_DELETE_LAST_PAGE,
134 ID_NEXT_PAGE,
135 ID_ADD_PAGE_BEFORE,
136 ID_ADD_SUB_PAGE
137 };
138
139 /*
140 Name of each notebook page.
141 Used as a label for a page, and used when cloning the notebook
142 to decide what type of page it is.
143 */
144
145 #define I_WAS_INSERTED_PAGE_NAME wxT("Inserted")
146 #define RADIOBUTTONS_PAGE_NAME wxT("Radiobuttons")
147 #define VETO_PAGE_NAME wxT("Veto")
148 #define MAXIMIZED_BUTTON_PAGE_NAME wxT("Maximized button")
149
150 // Pages that can be added by the user
151 #define INSERTED_PAGE_NAME wxT("Inserted ")
152 #define ADDED_PAGE_NAME wxT("Added ")
153 #define ADDED_PAGE_NAME_BEFORE wxT(" Inserted before ")
154 #define ADDED_SUB_PAGE_NAME wxT(" Inserted sub-page ")
155
156