]> git.saurik.com Git - wxWidgets.git/blame - samples/notebook/notebook.h
compiles under win64
[wxWidgets.git] / samples / notebook / notebook.h
CommitLineData
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$
c1dfe277
JS
8// Copyright: (c) 1998-2002 wxWindows team
9// License: wxWindows license
0b4d4194
JS
10/////////////////////////////////////////////////////////////////////////////
11
4e62c3fd
VZ
12// this sample can be used to test both wxNotebook and wxListbook
13//#define TEST_LISTBOOK
14
15#ifdef TEST_LISTBOOK
16 #include "wx/listbook.h"
17
18 #define wxNotebook wxListbook
19 #define wxNotebookEvent wxListbookEvent
20
21 #define wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED
22 #define wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING
23 #define EVT_NOTEBOOK_PAGE_CHANGED EVT_LISTBOOK_PAGE_CHANGED
24 #define EVT_NOTEBOOK_PAGE_CHANGING EVT_LISTBOOK_PAGE_CHANGING
25
26 #undef wxNB_TOP
27 #define wxNB_TOP wxLB_TOP
28 #undef wxNB_BOTTOM
29 #define wxNB_BOTTOM wxLB_BOTTOM
30 #undef wxNB_LEFT
31 #define wxNB_LEFT wxLB_LEFT
32 #undef wxNB_RIGHT
33 #define wxNB_RIGHT wxLB_RIGHT
34#else
35 #include "wx/notebook.h"
36#endif
0b4d4194
JS
37
38// Define a new application
c1dfe277 39class MyApp : public wxApp
0b4d4194
JS
40{
41public:
477350ce 42 bool OnInit();
0b4d4194
JS
43};
44
45DECLARE_APP(MyApp)
46
c1dfe277
JS
47//
48class MyNotebook : public wxNotebook
0b4d4194
JS
49{
50public:
c1dfe277
JS
51 MyNotebook(wxWindow *parent, wxWindowID id = -1,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize, long style = 0);
0b4d4194 54
c1dfe277 55 void CreateInitialPages();
0b4d4194 56
76645ab3
VZ
57 wxPanel *CreatePage(const wxString& pageName);
58
59 wxPanel *CreateUserCreatedPage();
60
c1dfe277 61 int GetIconIndex() const;
76645ab3
VZ
62
63private:
64 wxPanel *CreateInsertPage();
65 wxPanel *CreateRadioButtonsPage();
66 wxPanel *CreateVetoPage();
67 wxPanel *CreateBigButtonPage();
0b4d4194
JS
68};
69
c1dfe277
JS
70//
71class MyFrame : public wxFrame
0b4d4194
JS
72{
73public:
c1dfe277 74 MyFrame(const wxString& title, const wxPoint& pos = wxDefaultPosition,
c02e5a31 75 const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE);
c1dfe277
JS
76
77 virtual ~MyFrame();
78
79 // Recreates the notebook with the same pages, but with possibly
80 // a different orientation and optionally with images.
81 void ReInitNotebook();
82
c1dfe277
JS
83 void OnCheckOrRadioBox(wxCommandEvent& event);
84
85 void OnButtonAddPage(wxCommandEvent& event);
86 void OnButtonInsertPage(wxCommandEvent& event);
3957448a
VZ
87 void OnButtonDeleteCurPage(wxCommandEvent& event);
88 void OnButtonDeleteLastPage(wxCommandEvent& event);
c1dfe277 89 void OnButtonNextPage(wxCommandEvent& event);
c1dfe277
JS
90 void OnButtonExit(wxCommandEvent& event);
91
92 void OnNotebook(wxNotebookEvent& event);
93
3957448a
VZ
94 void OnUpdateUIBtnDeleteCurPage(wxUpdateUIEvent& event);
95 void OnUpdateUIBtnDeleteLastPage(wxUpdateUIEvent& event);
96d37807 96
3957448a 97 void OnIdle(wxIdleEvent& event);
96d37807 98
c1dfe277
JS
99private:
100 wxLog *m_logTargetOld;
101
102
103 // Controls
104
105 wxPanel *m_panel; // Panel containing notebook and other controls
106
107 wxRadioBox *m_radioOrient;
9a6c9e31
VZ
108 wxCheckBox *m_chkShowImages,
109 *m_chkMultiLine;
c1dfe277
JS
110
111 wxButton *m_btnAddPage;
112 wxButton *m_btnInsertPage;
3957448a
VZ
113 wxButton *m_btnDeleteCurPage;
114 wxButton *m_btnDeleteLastPage;
c1dfe277
JS
115 wxButton *m_btnNextPage;
116 wxButton *m_btnExit;
117
118 MyNotebook *m_notebook;
119
120 // Log window
121 wxTextCtrl *m_text;
122
123
124 // Sizers
125
126 // The frame's sizer. Consists of m_sizerTop and the log window
127 // at the bottom.
128 wxBoxSizer *m_sizerFrame;
129
130 // Sizer that contains the notebook and controls on the left
131 wxBoxSizer *m_sizerTop;
132
133 // Sizer for m_notebook
4e62c3fd 134 wxBookCtrlSizer *m_sizerNotebook;
c1dfe277
JS
135
136 wxImageList *m_imageList;
0b4d4194 137
d22699b5 138 DECLARE_EVENT_TABLE()
0b4d4194
JS
139};
140
c1dfe277
JS
141enum ID_CONTROLS
142{
143 ID_RADIO_ORIENT = wxID_HIGHEST,
144 ID_CHK_SHOWIMAGES,
9a6c9e31 145 ID_CHK_MULTILINE,
c1dfe277
JS
146 ID_BTN_ADD_PAGE,
147 ID_BTN_INSERT_PAGE,
3957448a
VZ
148 ID_BTN_DELETE_CUR_PAGE,
149 ID_BTN_DELETE_LAST_PAGE,
c1dfe277
JS
150 ID_BTN_NEXT_PAGE,
151 ID_NOTEBOOK
152};
0b4d4194 153
c1dfe277
JS
154// notebook orientations
155enum ORIENT
156{
157 ORIENT_TOP,
158 ORIENT_BOTTOM,
159 ORIENT_LEFT,
160 ORIENT_RIGHT,
161 ORIENT_MAX
162};
76645ab3
VZ
163
164/*
165Name of each notebook page.
166Used as a label for a page, and used when cloning the notebook
167to decide what type of page it is.
168*/
169
170#define I_WAS_INSERTED_PAGE_NAME wxT("Inserted")
171#define RADIOBUTTONS_PAGE_NAME wxT("Radiobuttons")
172#define VETO_PAGE_NAME wxT("Veto")
173#define MAXIMIZED_BUTTON_PAGE_NAME wxT("Maximized button")
174
175// Pages that can be added by the user
176#define INSERTED_PAGE_NAME wxT("Inserted ")
177#define ADDED_PAGE_NAME wxT("Added ")