1 /////////////////////////////////////////////////////////////////////////////
2 // Name: samples/notebook/notebook.h
3 // Purpose: a sample demonstrating notebook usage
4 // Author: Julian Smart
5 // Modified by: Dimitri Schoolwerth
8 // Copyright: (c) 1998-2002 wxWindows team
9 // License: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/notebook.h"
14 // Define a new application
15 class MyApp
: public wxApp
24 class MyNotebook
: public wxNotebook
27 MyNotebook(wxWindow
*parent
, wxWindowID id
= -1,
28 const wxPoint
& pos
= wxDefaultPosition
,
29 const wxSize
& size
= wxDefaultSize
, long style
= 0);
31 void CreateInitialPages();
33 wxPanel
*CreatePage(const wxString
& pageName
);
35 wxPanel
*CreateUserCreatedPage();
37 int GetIconIndex() const;
40 wxPanel
*CreateInsertPage();
41 wxPanel
*CreateRadioButtonsPage();
42 wxPanel
*CreateVetoPage();
43 wxPanel
*CreateBigButtonPage();
47 class MyFrame
: public wxFrame
50 MyFrame(const wxString
& title
, const wxPoint
& pos
= wxDefaultPosition
,
51 const wxSize
& size
= wxDefaultSize
, long style
= wxDEFAULT_FRAME_STYLE
|wxCLIP_CHILDREN
|wxNO_FULL_REPAINT_ON_RESIZE
);
55 // Recreates the notebook with the same pages, but with possibly
56 // a different orientation and optionally with images.
57 void ReInitNotebook();
59 void OnCheckOrRadioBox(wxCommandEvent
& event
);
61 void OnButtonAddPage(wxCommandEvent
& event
);
62 void OnButtonInsertPage(wxCommandEvent
& event
);
63 void OnButtonDeleteCurPage(wxCommandEvent
& event
);
64 void OnButtonDeleteLastPage(wxCommandEvent
& event
);
65 void OnButtonNextPage(wxCommandEvent
& event
);
66 void OnButtonExit(wxCommandEvent
& event
);
68 void OnNotebook(wxNotebookEvent
& event
);
70 void OnUpdateUIBtnDeleteCurPage(wxUpdateUIEvent
& event
);
71 void OnUpdateUIBtnDeleteLastPage(wxUpdateUIEvent
& event
);
73 void OnIdle(wxIdleEvent
& event
);
76 wxLog
*m_logTargetOld
;
81 wxPanel
*m_panel
; // Panel containing notebook and other controls
83 wxRadioBox
*m_radioOrient
;
84 wxCheckBox
*m_chkShowImages
;
86 wxButton
*m_btnAddPage
;
87 wxButton
*m_btnInsertPage
;
88 wxButton
*m_btnDeleteCurPage
;
89 wxButton
*m_btnDeleteLastPage
;
90 wxButton
*m_btnNextPage
;
93 MyNotebook
*m_notebook
;
101 // The frame's sizer. Consists of m_sizerTop and the log window
103 wxBoxSizer
*m_sizerFrame
;
105 // Sizer that contains the notebook and controls on the left
106 wxBoxSizer
*m_sizerTop
;
108 // Sizer for m_notebook
109 wxNotebookSizer
*m_sizerNotebook
;
111 wxImageList
*m_imageList
;
113 DECLARE_EVENT_TABLE()
118 ID_RADIO_ORIENT
= wxID_HIGHEST
,
122 ID_BTN_DELETE_CUR_PAGE
,
123 ID_BTN_DELETE_LAST_PAGE
,
128 // notebook orientations
139 Name of each notebook page.
140 Used as a label for a page, and used when cloning the notebook
141 to decide what type of page it is.
144 #define I_WAS_INSERTED_PAGE_NAME wxT("Inserted")
145 #define RADIOBUTTONS_PAGE_NAME wxT("Radiobuttons")
146 #define VETO_PAGE_NAME wxT("Veto")
147 #define MAXIMIZED_BUTTON_PAGE_NAME wxT("Maximized button")
149 // Pages that can be added by the user
150 #define INSERTED_PAGE_NAME wxT("Inserted ")
151 #define ADDED_PAGE_NAME wxT("Added ")