Applied patch [ 581280 ] Revamped notebook sample
[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 wxWindows team
9 // License: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/notebook.h"
13
14 // Define a new application
15 class MyApp : public wxApp
16 {
17 public:
18 bool OnInit();
19 };
20
21 DECLARE_APP(MyApp)
22
23 //
24 class MyNotebook : public wxNotebook
25 {
26 public:
27 MyNotebook(wxWindow *parent, wxWindowID id = -1,
28 const wxPoint& pos = wxDefaultPosition,
29 const wxSize& size = wxDefaultSize, long style = 0);
30
31 void CreateInitialPages();
32
33 int GetIconIndex() const;
34 };
35
36 //
37 class MyFrame : public wxFrame
38 {
39 public:
40 MyFrame(const wxString& title, const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE);
42
43 virtual ~MyFrame();
44
45 // Recreates the notebook with the same pages, but with possibly
46 // a different orientation and optionally with images.
47 void ReInitNotebook();
48
49 void CreateImageList();
50
51 void OnCheckOrRadioBox(wxCommandEvent& event);
52
53 void OnButtonAddPage(wxCommandEvent& event);
54 void OnButtonInsertPage(wxCommandEvent& event);
55 void OnButtonDeletePage(wxCommandEvent& event);
56 void OnButtonNextPage(wxCommandEvent& event);
57
58 void OnButtonExit(wxCommandEvent& event);
59
60 void OnNotebook(wxNotebookEvent& event);
61
62 void OnIdle(wxIdleEvent& event);
63
64
65 private:
66 wxLog *m_logTargetOld;
67
68
69 // Controls
70
71 wxPanel *m_panel; // Panel containing notebook and other controls
72
73 wxRadioBox *m_radioOrient;
74 wxCheckBox *m_chkShowImages;
75
76 wxButton *m_btnAddPage;
77 wxButton *m_btnInsertPage;
78 wxButton *m_btnDeletePage;
79 wxButton *m_btnNextPage;
80 wxButton *m_btnExit;
81
82 MyNotebook *m_notebook;
83
84 // Log window
85 wxTextCtrl *m_text;
86
87
88 // Sizers
89
90 // The frame's sizer. Consists of m_sizerTop and the log window
91 // at the bottom.
92 wxBoxSizer *m_sizerFrame;
93
94 // Sizer that contains the notebook and controls on the left
95 wxBoxSizer *m_sizerTop;
96
97 // Sizer for m_notebook
98 wxNotebookSizer *m_sizerNotebook;
99
100 wxImageList *m_imageList;
101
102 DECLARE_EVENT_TABLE()
103 };
104
105 enum ID_CONTROLS
106 {
107 ID_RADIO_ORIENT = wxID_HIGHEST,
108 ID_CHK_SHOWIMAGES,
109 ID_BTN_ADD_PAGE,
110 ID_BTN_INSERT_PAGE,
111 ID_BTN_DELETE_PAGE,
112 ID_BTN_NEXT_PAGE,
113 ID_NOTEBOOK
114 };
115
116 // notebook orientations
117 enum ORIENT
118 {
119 ORIENT_TOP,
120 ORIENT_BOTTOM,
121 ORIENT_LEFT,
122 ORIENT_RIGHT,
123 ORIENT_MAX
124 };