]>
Commit | Line | Data |
---|---|---|
0b4d4194 | 1 | ///////////////////////////////////////////////////////////////////////////// |
c1dfe277 JS |
2 | // Name: samples/notebook/notebook.h |
3 | // Purpose: a sample demonstrating notebook usage | |
0b4d4194 | 4 | // Author: Julian Smart |
c1dfe277 | 5 | // Modified by: Dimitri Schoolwerth |
0b4d4194 JS |
6 | // Created: 25/10/98 |
7 | // RCS-ID: $Id$ | |
be5a51fb | 8 | // Copyright: (c) 1998-2002 wxWidgets team |
c1dfe277 | 9 | // License: wxWindows license |
0b4d4194 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
9133965e WS |
12 | #include "wx/choicebk.h" |
13 | #include "wx/listbook.h" | |
eca15c0d | 14 | #include "wx/treebook.h" |
9133965e WS |
15 | #include "wx/notebook.h" |
16 | ||
17 | #if wxUSE_LOG && !defined( __SMARTPHONE__ ) | |
18 | #define USE_LOG 1 | |
4e62c3fd | 19 | #else |
9133965e | 20 | #define USE_LOG 0 |
4e62c3fd | 21 | #endif |
0b4d4194 JS |
22 | |
23 | // Define a new application | |
c1dfe277 | 24 | class MyApp : public wxApp |
0b4d4194 JS |
25 | { |
26 | public: | |
477350ce | 27 | bool OnInit(); |
0b4d4194 JS |
28 | }; |
29 | ||
30 | DECLARE_APP(MyApp) | |
31 | ||
eca15c0d | 32 | |
c1dfe277 | 33 | class MyFrame : public wxFrame |
0b4d4194 JS |
34 | { |
35 | public: | |
eca15c0d | 36 | MyFrame(); |
c1dfe277 JS |
37 | virtual ~MyFrame(); |
38 | ||
9133965e WS |
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); | |
c1dfe277 | 44 | |
9133965e WS |
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); | |
c1dfe277 | 50 | |
eca15c0d VZ |
51 | void OnAddSubPage(wxCommandEvent& event); |
52 | void OnAddPageBefore(wxCommandEvent& event); | |
53 | ||
54 | void OnBookCtrl(wxBookCtrlBaseEvent& event); | |
02161c7c | 55 | #if wxUSE_NOTEBOOK |
eca15c0d | 56 | void OnNotebook(wxNotebookEvent& event) { OnBookCtrl(event); } |
02161c7c WS |
57 | #endif |
58 | #if wxUSE_CHOICEBOOK | |
eca15c0d | 59 | void OnChoicebook(wxChoicebookEvent& event) { OnBookCtrl(event); } |
02161c7c WS |
60 | #endif |
61 | #if wxUSE_LISTBOOK | |
eca15c0d VZ |
62 | void OnListbook(wxListbookEvent& event) { OnBookCtrl(event); } |
63 | #endif | |
64 | #if wxUSE_TREEBOOK | |
65 | void OnTreebook(wxTreebookEvent& event) { OnBookCtrl(event); } | |
02161c7c | 66 | #endif |
96d37807 | 67 | |
3957448a | 68 | void OnIdle(wxIdleEvent& event); |
96d37807 | 69 | |
eca15c0d VZ |
70 | #if wxUSE_TREEBOOK |
71 | void OnUpdateTreeMenu(wxUpdateUIEvent& event); | |
72 | #endif // wxUSE_TREEBOOK | |
73 | ||
74 | wxBookCtrlBase *GetCurrentBook() const { return m_bookCtrl; } | |
9133965e | 75 | |
c1dfe277 JS |
76 | private: |
77 | wxLog *m_logTargetOld; | |
78 | ||
eca15c0d VZ |
79 | void RecreateBook(); |
80 | wxPanel *CreateNewPage() const; | |
81 | int TranslateBookFlag(int nb, int lb, int chb, int tbk) const; | |
9133965e WS |
82 | |
83 | // Sample setup | |
eca15c0d VZ |
84 | enum BookType |
85 | { | |
86 | Type_Notebook, | |
eca15c0d | 87 | Type_Listbook, |
136bafcd | 88 | Type_Choicebook, |
eca15c0d VZ |
89 | Type_Treebook, |
90 | Type_Max | |
91 | } m_type; | |
9133965e WS |
92 | int m_orient; |
93 | bool m_chkShowImages; | |
94 | bool m_multi; | |
c1dfe277 JS |
95 | |
96 | // Controls | |
97 | ||
98 | wxPanel *m_panel; // Panel containing notebook and other controls | |
eca15c0d | 99 | wxBookCtrlBase *m_bookCtrl; |
c1dfe277 | 100 | |
9133965e | 101 | #if USE_LOG |
c1dfe277 JS |
102 | // Log window |
103 | wxTextCtrl *m_text; | |
9133965e | 104 | #endif // USE_LOG |
c1dfe277 | 105 | |
c1dfe277 JS |
106 | wxBoxSizer *m_sizerFrame; |
107 | ||
c1dfe277 | 108 | wxImageList *m_imageList; |
0b4d4194 | 109 | |
d22699b5 | 110 | DECLARE_EVENT_TABLE() |
0b4d4194 JS |
111 | }; |
112 | ||
9133965e | 113 | enum ID_COMMANDS |
c1dfe277 | 114 | { |
eca15c0d | 115 | // these should be in the same order as Type_XXX elements above |
9133965e WS |
116 | ID_BOOK_NOTEBOOK = wxID_HIGHEST, |
117 | ID_BOOK_LISTBOOK, | |
118 | ID_BOOK_CHOICEBOOK, | |
eca15c0d | 119 | ID_BOOK_TREEBOOK, |
9133965e | 120 | ID_BOOK_MAX, |
eca15c0d | 121 | |
9133965e WS |
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, | |
eca15c0d VZ |
135 | ID_ADD_PAGE_BEFORE, |
136 | ID_ADD_SUB_PAGE | |
c1dfe277 | 137 | }; |
76645ab3 VZ |
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 ") | |
eca15c0d VZ |
153 | #define ADDED_PAGE_NAME_BEFORE wxT(" Inserted before ") |
154 | #define ADDED_SUB_PAGE_NAME wxT(" Inserted sub-page ") | |
155 | ||
156 |