]>
Commit | Line | Data |
---|---|---|
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/notebook.h" | |
15 | ||
16 | #if wxUSE_LOG && !defined( __SMARTPHONE__ ) | |
17 | #define USE_LOG 1 | |
18 | #else | |
19 | #define USE_LOG 0 | |
20 | #endif | |
21 | ||
22 | // Define a new application | |
23 | class MyApp : public wxApp | |
24 | { | |
25 | public: | |
26 | bool OnInit(); | |
27 | }; | |
28 | ||
29 | DECLARE_APP(MyApp) | |
30 | ||
31 | class MyFrame : public wxFrame | |
32 | { | |
33 | public: | |
34 | MyFrame(const wxString& title, const wxPoint& pos = wxDefaultPosition, | |
35 | const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE); | |
36 | ||
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 | #if wxUSE_NOTEBOOK | |
52 | void OnNotebook(wxNotebookEvent& event); | |
53 | #endif | |
54 | #if wxUSE_CHOICEBOOK | |
55 | void OnChoicebook(wxChoicebookEvent& event); | |
56 | #endif | |
57 | #if wxUSE_LISTBOOK | |
58 | void OnListbook(wxListbookEvent& event); | |
59 | #endif | |
60 | ||
61 | void OnIdle(wxIdleEvent& event); | |
62 | ||
63 | wxBookCtrlBase *GetCurrentBook(); | |
64 | ||
65 | private: | |
66 | wxLog *m_logTargetOld; | |
67 | ||
68 | int SelectFlag(int id, int nb, int lb, int chb); | |
69 | void ShowCurrentBook(); | |
70 | void RecreateBooks(); | |
71 | ||
72 | // Sample setup | |
73 | int m_type; | |
74 | int m_orient; | |
75 | bool m_chkShowImages; | |
76 | bool m_multi; | |
77 | ||
78 | // Controls | |
79 | ||
80 | wxPanel *m_panel; // Panel containing notebook and other controls | |
81 | ||
82 | #if wxUSE_NOTEBOOK | |
83 | wxNotebook *m_notebook; | |
84 | #endif | |
85 | #if wxUSE_CHOICEBOOK | |
86 | wxChoicebook *m_choicebook; | |
87 | #endif | |
88 | #if wxUSE_LISTBOOK | |
89 | wxListbook *m_listbook; | |
90 | #endif | |
91 | ||
92 | #if USE_LOG | |
93 | // Log window | |
94 | wxTextCtrl *m_text; | |
95 | #endif // USE_LOG | |
96 | ||
97 | wxBoxSizer *m_sizerFrame; | |
98 | ||
99 | wxImageList *m_imageList; | |
100 | ||
101 | DECLARE_EVENT_TABLE() | |
102 | }; | |
103 | ||
104 | enum ID_COMMANDS | |
105 | { | |
106 | ID_BOOK_NOTEBOOK = wxID_HIGHEST, | |
107 | ID_BOOK_LISTBOOK, | |
108 | ID_BOOK_CHOICEBOOK, | |
109 | ID_BOOK_MAX, | |
110 | ID_ORIENT_DEFAULT, | |
111 | ID_ORIENT_TOP, | |
112 | ID_ORIENT_BOTTOM, | |
113 | ID_ORIENT_LEFT, | |
114 | ID_ORIENT_RIGHT, | |
115 | ID_ORIENT_MAX, | |
116 | ID_SHOW_IMAGES, | |
117 | ID_MULTI, | |
118 | ID_ADD_PAGE, | |
119 | ID_INSERT_PAGE, | |
120 | ID_DELETE_CUR_PAGE, | |
121 | ID_DELETE_LAST_PAGE, | |
122 | ID_NEXT_PAGE, | |
123 | ID_NOTEBOOK, | |
124 | ID_LISTBOOK, | |
125 | ID_CHOICEBOOK | |
126 | }; | |
127 | ||
128 | /* | |
129 | Name of each notebook page. | |
130 | Used as a label for a page, and used when cloning the notebook | |
131 | to decide what type of page it is. | |
132 | */ | |
133 | ||
134 | #define I_WAS_INSERTED_PAGE_NAME wxT("Inserted") | |
135 | #define RADIOBUTTONS_PAGE_NAME wxT("Radiobuttons") | |
136 | #define VETO_PAGE_NAME wxT("Veto") | |
137 | #define MAXIMIZED_BUTTON_PAGE_NAME wxT("Maximized button") | |
138 | ||
139 | // Pages that can be added by the user | |
140 | #define INSERTED_PAGE_NAME wxT("Inserted ") | |
141 | #define ADDED_PAGE_NAME wxT("Added ") |