[1558] | 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: notebook.h,v 1.16 2004/11/23 11:44:31 ABX Exp $
|
---|
| 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 |
|
---|
[1563] | 31 |
|
---|
[1558] | 32 | class MyFrame : public wxFrame
|
---|
| 33 | {
|
---|
| 34 | public:
|
---|
[1563] | 35 | MyFrame(const wxString& title,
|
---|
| 36 | const wxPoint& pos = wxDefaultPosition,
|
---|
| 37 | const wxSize& size = wxDefaultSize,
|
---|
| 38 | long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE);
|
---|
[1558] | 39 |
|
---|
| 40 | virtual ~MyFrame();
|
---|
| 41 |
|
---|
| 42 | void OnType(wxCommandEvent& event);
|
---|
| 43 | void OnOrient(wxCommandEvent& event);
|
---|
| 44 | void OnShowImages(wxCommandEvent& event);
|
---|
| 45 | void OnMulti(wxCommandEvent& event);
|
---|
| 46 | void OnExit(wxCommandEvent& event);
|
---|
| 47 |
|
---|
| 48 | void OnAddPage(wxCommandEvent& event);
|
---|
| 49 | void OnInsertPage(wxCommandEvent& event);
|
---|
| 50 | void OnDeleteCurPage(wxCommandEvent& event);
|
---|
| 51 | void OnDeleteLastPage(wxCommandEvent& event);
|
---|
| 52 | void OnNextPage(wxCommandEvent& event);
|
---|
| 53 |
|
---|
| 54 | #if wxUSE_NOTEBOOK
|
---|
| 55 | void OnNotebook(wxNotebookEvent& event);
|
---|
| 56 | #endif
|
---|
| 57 | #if wxUSE_CHOICEBOOK
|
---|
| 58 | void OnChoicebook(wxChoicebookEvent& event);
|
---|
| 59 | #endif
|
---|
| 60 | #if wxUSE_LISTBOOK
|
---|
| 61 | void OnListbook(wxListbookEvent& event);
|
---|
| 62 | #endif
|
---|
| 63 |
|
---|
| 64 | void OnIdle(wxIdleEvent& event);
|
---|
| 65 |
|
---|
| 66 | wxBookCtrlBase *GetCurrentBook();
|
---|
| 67 |
|
---|
[1563] | 68 | wxPanel *CreateUserCreatedPage(wxBookCtrlBase *parent);
|
---|
| 69 | wxPanel *CreatePreprocessorPage(wxBookCtrlBase *parent);
|
---|
| 70 | wxPanel *CreateViewCellsPage(wxBookCtrlBase *parent);
|
---|
| 71 | void CreateInitialPages(wxBookCtrlBase *parent);
|
---|
| 72 | wxPanel *CreatePage(wxBookCtrlBase *parent, const wxString&pageName);
|
---|
| 73 |
|
---|
[1558] | 74 | private:
|
---|
| 75 |
|
---|
| 76 | int SelectFlag(int id, int nb, int lb, int chb);
|
---|
| 77 | void ShowCurrentBook();
|
---|
| 78 | void RecreateBooks();
|
---|
| 79 |
|
---|
| 80 | // Sample setup
|
---|
[1563] | 81 | int mType;
|
---|
| 82 | int mOrient;
|
---|
| 83 | bool mChkShowImages;
|
---|
| 84 | bool mMulti;
|
---|
[1558] | 85 |
|
---|
[1563] | 86 | wxLog *mLogTargetOld;
|
---|
| 87 |
|
---|
| 88 | /////////
|
---|
[1558] | 89 | // Controls
|
---|
| 90 |
|
---|
[1563] | 91 | /// Panel containing notebook and other controls
|
---|
| 92 | wxPanel *mPanel;
|
---|
[1558] | 93 |
|
---|
| 94 | #if wxUSE_NOTEBOOK
|
---|
[1563] | 95 | wxNotebook *mNotebook;
|
---|
[1558] | 96 | #endif
|
---|
| 97 | #if wxUSE_CHOICEBOOK
|
---|
[1563] | 98 | wxChoicebook *mChoicebook;
|
---|
[1558] | 99 | #endif
|
---|
| 100 | #if wxUSE_LISTBOOK
|
---|
[1563] | 101 | wxListbook *mListbook;
|
---|
[1558] | 102 | #endif
|
---|
| 103 |
|
---|
| 104 | #if USE_LOG
|
---|
| 105 | // Log window
|
---|
[1563] | 106 | wxTextCtrl *mText;
|
---|
[1558] | 107 | #endif // USE_LOG
|
---|
| 108 |
|
---|
[1563] | 109 | wxTextCtrl *mDetectEmptyViewSpaceText;
|
---|
| 110 | wxCheckBox *mDetectEmptyViewSpaceCheckBox;
|
---|
[1558] | 111 |
|
---|
[1563] | 112 | wxBoxSizer *mSizerFrame;
|
---|
| 113 | wxImageList *mImageList;
|
---|
[1558] | 114 |
|
---|
| 115 | DECLARE_EVENT_TABLE()
|
---|
| 116 | };
|
---|
| 117 |
|
---|
| 118 | enum ID_COMMANDS
|
---|
| 119 | {
|
---|
| 120 | ID_BOOK_NOTEBOOK = wxID_HIGHEST,
|
---|
| 121 | ID_BOOK_LISTBOOK,
|
---|
| 122 | ID_BOOK_CHOICEBOOK,
|
---|
| 123 | ID_BOOK_MAX,
|
---|
| 124 | ID_ORIENT_DEFAULT,
|
---|
| 125 | ID_ORIENT_TOP,
|
---|
| 126 | ID_ORIENT_BOTTOM,
|
---|
| 127 | ID_ORIENT_LEFT,
|
---|
| 128 | ID_ORIENT_RIGHT,
|
---|
| 129 | ID_ORIENT_MAX,
|
---|
| 130 | ID_SHOW_IMAGES,
|
---|
| 131 | ID_MULTI,
|
---|
| 132 | ID_ADD_PAGE,
|
---|
| 133 | ID_INSERT_PAGE,
|
---|
| 134 | ID_DELETE_CUR_PAGE,
|
---|
| 135 | ID_DELETE_LAST_PAGE,
|
---|
| 136 | ID_NEXT_PAGE,
|
---|
| 137 | ID_NOTEBOOK,
|
---|
| 138 | ID_LISTBOOK,
|
---|
| 139 | ID_CHOICEBOOK
|
---|
| 140 | };
|
---|
| 141 |
|
---|
[1563] | 142 |
|
---|
| 143 | /*class PreprocessorFrontEnd
|
---|
| 144 | {
|
---|
| 145 | wxPanel *CreateUserCreatedPage(wxBookCtrlBase *parent);
|
---|
| 146 | wxPanel *CreatePreprocessorPage(wxBookCtrlBase *parent);
|
---|
| 147 | wxPanel *CreateViewCellsPage(wxBookCtrlBase *parent);
|
---|
| 148 |
|
---|
| 149 | MyFrame *mFrame;
|
---|
| 150 | }*/
|
---|
| 151 |
|
---|
| 152 |
|
---|
[1558] | 153 | /*
|
---|
| 154 | Name of each notebook page.
|
---|
| 155 | Used as a label for a page, and used when cloning the notebook
|
---|
| 156 | to decide what type of page it is.
|
---|
| 157 | */
|
---|
[1563] | 158 | #define PREPROCESSOR_PAGE_NAME wxT("Preprocessor")
|
---|
| 159 | #define VIEWCELLS_PAGE_NAME wxT("ViewCells")
|
---|
[1558] | 160 |
|
---|
| 161 | #define I_WAS_INSERTED_PAGE_NAME wxT("Inserted")
|
---|
| 162 | #define VETO_PAGE_NAME wxT("Veto")
|
---|
| 163 | #define MAXIMIZED_BUTTON_PAGE_NAME wxT("Maximized button")
|
---|
| 164 |
|
---|
| 165 | // Pages that can be added by the user
|
---|
| 166 | #define INSERTED_PAGE_NAME wxT("Inserted ")
|
---|
| 167 | #define ADDED_PAGE_NAME wxT("Added ")
|
---|