1998-10-26 13:32:07 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2002-07-19 15:57:58 -04:00
|
|
|
// Name: samples/notebook/notebook.h
|
|
|
|
// Purpose: a sample demonstrating notebook usage
|
1998-10-26 13:32:07 -05:00
|
|
|
// Author: Julian Smart
|
2002-07-19 15:57:58 -04:00
|
|
|
// Modified by: Dimitri Schoolwerth
|
1998-10-26 13:32:07 -05:00
|
|
|
// Created: 25/10/98
|
|
|
|
// RCS-ID: $Id$
|
2004-05-25 07:20:37 -04:00
|
|
|
// Copyright: (c) 1998-2002 wxWidgets team
|
2002-07-19 15:57:58 -04:00
|
|
|
// License: wxWindows license
|
1998-10-26 13:32:07 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2004-09-17 13:39:53 -04:00
|
|
|
#include "wx/choicebk.h"
|
|
|
|
#include "wx/listbook.h"
|
|
|
|
#include "wx/notebook.h"
|
|
|
|
|
|
|
|
#if wxUSE_LOG && !defined( __SMARTPHONE__ )
|
|
|
|
#define USE_LOG 1
|
2003-08-21 19:12:41 -04:00
|
|
|
#else
|
2004-09-17 13:39:53 -04:00
|
|
|
#define USE_LOG 0
|
2003-08-21 19:12:41 -04:00
|
|
|
#endif
|
1998-10-26 13:32:07 -05:00
|
|
|
|
|
|
|
// Define a new application
|
2002-07-19 15:57:58 -04:00
|
|
|
class MyApp : public wxApp
|
1998-10-26 13:32:07 -05:00
|
|
|
{
|
|
|
|
public:
|
2000-02-28 20:49:05 -05:00
|
|
|
bool OnInit();
|
1998-10-26 13:32:07 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
DECLARE_APP(MyApp)
|
|
|
|
|
2002-07-19 15:57:58 -04:00
|
|
|
class MyFrame : public wxFrame
|
1998-10-26 13:32:07 -05:00
|
|
|
{
|
|
|
|
public:
|
2002-07-19 15:57:58 -04:00
|
|
|
MyFrame(const wxString& title, const wxPoint& pos = wxDefaultPosition,
|
2003-07-31 09:59:28 -04:00
|
|
|
const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE);
|
2002-07-19 15:57:58 -04:00
|
|
|
|
|
|
|
virtual ~MyFrame();
|
|
|
|
|
2004-09-17 13:39:53 -04:00
|
|
|
void OnType(wxCommandEvent& event);
|
|
|
|
void OnOrient(wxCommandEvent& event);
|
|
|
|
void OnShowImages(wxCommandEvent& event);
|
|
|
|
void OnMulti(wxCommandEvent& event);
|
|
|
|
void OnExit(wxCommandEvent& event);
|
2002-07-19 15:57:58 -04:00
|
|
|
|
2004-09-17 13:39:53 -04:00
|
|
|
void OnAddPage(wxCommandEvent& event);
|
|
|
|
void OnInsertPage(wxCommandEvent& event);
|
|
|
|
void OnDeleteCurPage(wxCommandEvent& event);
|
|
|
|
void OnDeleteLastPage(wxCommandEvent& event);
|
|
|
|
void OnNextPage(wxCommandEvent& event);
|
2002-07-19 15:57:58 -04:00
|
|
|
|
2004-09-24 09:45:52 -04:00
|
|
|
#if wxUSE_NOTEBOOK
|
2002-07-19 15:57:58 -04:00
|
|
|
void OnNotebook(wxNotebookEvent& event);
|
2004-09-24 09:45:52 -04:00
|
|
|
#endif
|
|
|
|
#if wxUSE_CHOICEBOOK
|
2004-09-17 13:39:53 -04:00
|
|
|
void OnChoicebook(wxChoicebookEvent& event);
|
2004-09-24 09:45:52 -04:00
|
|
|
#endif
|
|
|
|
#if wxUSE_LISTBOOK
|
2004-09-17 13:39:53 -04:00
|
|
|
void OnListbook(wxListbookEvent& event);
|
2004-09-24 09:45:52 -04:00
|
|
|
#endif
|
1999-06-24 17:27:52 -04:00
|
|
|
|
2002-08-15 20:09:29 -04:00
|
|
|
void OnIdle(wxIdleEvent& event);
|
1999-06-24 17:27:52 -04:00
|
|
|
|
2004-09-17 13:39:53 -04:00
|
|
|
wxBookCtrl *GetCurrentBook();
|
|
|
|
|
2002-07-19 15:57:58 -04:00
|
|
|
private:
|
|
|
|
wxLog *m_logTargetOld;
|
|
|
|
|
2004-09-17 13:39:53 -04:00
|
|
|
int SelectFlag(int id, int nb, int lb, int chb);
|
|
|
|
void ShowCurrentBook();
|
|
|
|
void RecreateBooks();
|
|
|
|
|
|
|
|
// Sample setup
|
|
|
|
int m_type;
|
|
|
|
int m_orient;
|
|
|
|
bool m_chkShowImages;
|
|
|
|
bool m_multi;
|
2002-07-19 15:57:58 -04:00
|
|
|
|
|
|
|
// Controls
|
|
|
|
|
|
|
|
wxPanel *m_panel; // Panel containing notebook and other controls
|
|
|
|
|
2004-09-24 09:45:52 -04:00
|
|
|
#if wxUSE_NOTEBOOK
|
2004-09-17 13:39:53 -04:00
|
|
|
wxNotebook *m_notebook;
|
2004-09-24 09:45:52 -04:00
|
|
|
#endif
|
|
|
|
#if wxUSE_CHOICEBOOK
|
2004-09-17 13:39:53 -04:00
|
|
|
wxChoicebook *m_choicebook;
|
2004-09-24 09:45:52 -04:00
|
|
|
#endif
|
|
|
|
#if wxUSE_LISTBOOK
|
2004-09-17 13:39:53 -04:00
|
|
|
wxListbook *m_listbook;
|
2004-09-24 09:45:52 -04:00
|
|
|
#endif
|
2002-07-19 15:57:58 -04:00
|
|
|
|
2004-09-17 13:39:53 -04:00
|
|
|
#if USE_LOG
|
2002-07-19 15:57:58 -04:00
|
|
|
// Log window
|
|
|
|
wxTextCtrl *m_text;
|
2004-09-17 13:39:53 -04:00
|
|
|
#endif // USE_LOG
|
2002-07-19 15:57:58 -04:00
|
|
|
|
|
|
|
wxBoxSizer *m_sizerFrame;
|
|
|
|
|
|
|
|
wxImageList *m_imageList;
|
1998-10-26 13:32:07 -05:00
|
|
|
|
1999-08-02 17:31:09 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
1998-10-26 13:32:07 -05:00
|
|
|
};
|
|
|
|
|
2004-09-17 13:39:53 -04:00
|
|
|
enum ID_COMMANDS
|
2002-07-19 15:57:58 -04:00
|
|
|
{
|
2004-09-17 13:39:53 -04:00
|
|
|
ID_BOOK_NOTEBOOK = wxID_HIGHEST,
|
|
|
|
ID_BOOK_LISTBOOK,
|
|
|
|
ID_BOOK_CHOICEBOOK,
|
|
|
|
ID_BOOK_MAX,
|
|
|
|
ID_ORIENT_DEFAULT,
|
|
|
|
ID_ORIENT_TOP,
|
|
|
|
ID_ORIENT_BOTTOM,
|
|
|
|
ID_ORIENT_LEFT,
|
|
|
|
ID_ORIENT_RIGHT,
|
|
|
|
ID_ORIENT_MAX,
|
|
|
|
ID_SHOW_IMAGES,
|
|
|
|
ID_MULTI,
|
|
|
|
ID_ADD_PAGE,
|
|
|
|
ID_INSERT_PAGE,
|
|
|
|
ID_DELETE_CUR_PAGE,
|
|
|
|
ID_DELETE_LAST_PAGE,
|
|
|
|
ID_NEXT_PAGE,
|
|
|
|
ID_NOTEBOOK,
|
|
|
|
ID_LISTBOOK,
|
|
|
|
ID_CHOICEBOOK
|
2002-07-19 15:57:58 -04:00
|
|
|
};
|
2002-07-21 10:43:09 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
Name of each notebook page.
|
|
|
|
Used as a label for a page, and used when cloning the notebook
|
|
|
|
to decide what type of page it is.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define I_WAS_INSERTED_PAGE_NAME wxT("Inserted")
|
|
|
|
#define RADIOBUTTONS_PAGE_NAME wxT("Radiobuttons")
|
|
|
|
#define VETO_PAGE_NAME wxT("Veto")
|
|
|
|
#define MAXIMIZED_BUTTON_PAGE_NAME wxT("Maximized button")
|
|
|
|
|
|
|
|
// Pages that can be added by the user
|
|
|
|
#define INSERTED_PAGE_NAME wxT("Inserted ")
|
|
|
|
#define ADDED_PAGE_NAME wxT("Added ")
|