]> git.saurik.com Git - wxWidgets.git/blame - samples/notebook/notebook.h
workaround for not appearing vertical scrollbar in wxTE_RICH2 controls
[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
b2f757f9 12#include "wx/notebook.h"
0b4d4194
JS
13
14// Define a new application
c1dfe277 15class MyApp : public wxApp
0b4d4194
JS
16{
17public:
477350ce 18 bool OnInit();
0b4d4194
JS
19};
20
21DECLARE_APP(MyApp)
22
c1dfe277
JS
23//
24class MyNotebook : public wxNotebook
0b4d4194
JS
25{
26public:
c1dfe277
JS
27 MyNotebook(wxWindow *parent, wxWindowID id = -1,
28 const wxPoint& pos = wxDefaultPosition,
29 const wxSize& size = wxDefaultSize, long style = 0);
0b4d4194 30
c1dfe277 31 void CreateInitialPages();
0b4d4194 32
76645ab3
VZ
33 wxPanel *CreatePage(const wxString& pageName);
34
35 wxPanel *CreateUserCreatedPage();
36
c1dfe277 37 int GetIconIndex() const;
76645ab3
VZ
38
39private:
40 wxPanel *CreateInsertPage();
41 wxPanel *CreateRadioButtonsPage();
42 wxPanel *CreateVetoPage();
43 wxPanel *CreateBigButtonPage();
0b4d4194
JS
44};
45
c1dfe277
JS
46//
47class MyFrame : public wxFrame
0b4d4194
JS
48{
49public:
c1dfe277
JS
50 MyFrame(const wxString& title, const wxPoint& pos = wxDefaultPosition,
51 const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE);
52
53 virtual ~MyFrame();
54
55 // Recreates the notebook with the same pages, but with possibly
56 // a different orientation and optionally with images.
57 void ReInitNotebook();
58
c1dfe277
JS
59 void OnCheckOrRadioBox(wxCommandEvent& event);
60
61 void OnButtonAddPage(wxCommandEvent& event);
62 void OnButtonInsertPage(wxCommandEvent& event);
3957448a
VZ
63 void OnButtonDeleteCurPage(wxCommandEvent& event);
64 void OnButtonDeleteLastPage(wxCommandEvent& event);
c1dfe277 65 void OnButtonNextPage(wxCommandEvent& event);
c1dfe277
JS
66 void OnButtonExit(wxCommandEvent& event);
67
68 void OnNotebook(wxNotebookEvent& event);
69
3957448a
VZ
70 void OnUpdateUIBtnDeleteCurPage(wxUpdateUIEvent& event);
71 void OnUpdateUIBtnDeleteLastPage(wxUpdateUIEvent& event);
96d37807 72
3957448a 73 void OnIdle(wxIdleEvent& event);
96d37807 74
c1dfe277
JS
75private:
76 wxLog *m_logTargetOld;
77
78
79 // Controls
80
81 wxPanel *m_panel; // Panel containing notebook and other controls
82
83 wxRadioBox *m_radioOrient;
84 wxCheckBox *m_chkShowImages;
85
86 wxButton *m_btnAddPage;
87 wxButton *m_btnInsertPage;
3957448a
VZ
88 wxButton *m_btnDeleteCurPage;
89 wxButton *m_btnDeleteLastPage;
c1dfe277
JS
90 wxButton *m_btnNextPage;
91 wxButton *m_btnExit;
92
93 MyNotebook *m_notebook;
94
95 // Log window
96 wxTextCtrl *m_text;
97
98
99 // Sizers
100
101 // The frame's sizer. Consists of m_sizerTop and the log window
102 // at the bottom.
103 wxBoxSizer *m_sizerFrame;
104
105 // Sizer that contains the notebook and controls on the left
106 wxBoxSizer *m_sizerTop;
107
108 // Sizer for m_notebook
109 wxNotebookSizer *m_sizerNotebook;
110
111 wxImageList *m_imageList;
0b4d4194 112
d22699b5 113 DECLARE_EVENT_TABLE()
0b4d4194
JS
114};
115
c1dfe277
JS
116enum ID_CONTROLS
117{
118 ID_RADIO_ORIENT = wxID_HIGHEST,
119 ID_CHK_SHOWIMAGES,
120 ID_BTN_ADD_PAGE,
121 ID_BTN_INSERT_PAGE,
3957448a
VZ
122 ID_BTN_DELETE_CUR_PAGE,
123 ID_BTN_DELETE_LAST_PAGE,
c1dfe277
JS
124 ID_BTN_NEXT_PAGE,
125 ID_NOTEBOOK
126};
0b4d4194 127
c1dfe277
JS
128// notebook orientations
129enum ORIENT
130{
131 ORIENT_TOP,
132 ORIENT_BOTTOM,
133 ORIENT_LEFT,
134 ORIENT_RIGHT,
135 ORIENT_MAX
136};
76645ab3
VZ
137
138/*
139Name of each notebook page.
140Used as a label for a page, and used when cloning the notebook
141to decide what type of page it is.
142*/
143
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")
148
149// Pages that can be added by the user
150#define INSERTED_PAGE_NAME wxT("Inserted ")
151#define ADDED_PAGE_NAME wxT("Added ")