Notebook sample redesign. Now it is 'wxNotebook & friends' and presents wxChoicebook...
[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/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 void OnNotebook(wxNotebookEvent& event);
52 void OnChoicebook(wxChoicebookEvent& event);
53 void OnListbook(wxListbookEvent& event);
54
55 void OnIdle(wxIdleEvent& event);
56
57 wxBookCtrl *GetCurrentBook();
58
59 private:
60 wxLog *m_logTargetOld;
61
62 int SelectFlag(int id, int nb, int lb, int chb);
63 void ShowCurrentBook();
64 void RecreateBooks();
65
66 // Sample setup
67 int m_type;
68 int m_orient;
69 bool m_chkShowImages;
70 bool m_multi;
71
72 // Controls
73
74 wxPanel *m_panel; // Panel containing notebook and other controls
75
76 wxNotebook *m_notebook;
77 wxChoicebook *m_choicebook;
78 wxListbook *m_listbook;
79
80 #if USE_LOG
81 // Log window
82 wxTextCtrl *m_text;
83 #endif // USE_LOG
84
85 wxBoxSizer *m_sizerFrame;
86
87 wxImageList *m_imageList;
88
89 DECLARE_EVENT_TABLE()
90 };
91
92 enum ID_COMMANDS
93 {
94 ID_BOOK_NOTEBOOK = wxID_HIGHEST,
95 ID_BOOK_LISTBOOK,
96 ID_BOOK_CHOICEBOOK,
97 ID_BOOK_MAX,
98 ID_ORIENT_DEFAULT,
99 ID_ORIENT_TOP,
100 ID_ORIENT_BOTTOM,
101 ID_ORIENT_LEFT,
102 ID_ORIENT_RIGHT,
103 ID_ORIENT_MAX,
104 ID_SHOW_IMAGES,
105 ID_MULTI,
106 ID_ADD_PAGE,
107 ID_INSERT_PAGE,
108 ID_DELETE_CUR_PAGE,
109 ID_DELETE_LAST_PAGE,
110 ID_NEXT_PAGE,
111 ID_NOTEBOOK,
112 ID_LISTBOOK,
113 ID_CHOICEBOOK
114 };
115
116 /*
117 Name of each notebook page.
118 Used as a label for a page, and used when cloning the notebook
119 to decide what type of page it is.
120 */
121
122 #define I_WAS_INSERTED_PAGE_NAME wxT("Inserted")
123 #define RADIOBUTTONS_PAGE_NAME wxT("Radiobuttons")
124 #define VETO_PAGE_NAME wxT("Veto")
125 #define MAXIMIZED_BUTTON_PAGE_NAME wxT("Maximized button")
126
127 // Pages that can be added by the user
128 #define INSERTED_PAGE_NAME wxT("Inserted ")
129 #define ADDED_PAGE_NAME wxT("Added ")