2001-06-26 16:59:19 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/notebook.h
|
|
|
|
// Purpose: wxNotebook interface
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01.02.01
|
|
|
|
// RCS-ID: $Id$
|
2005-05-04 14:57:50 -04:00
|
|
|
// Copyright: (c) 1996-2000 Vadim Zeitlin
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2001-06-26 16:59:19 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-14 20:23:28 -04:00
|
|
|
#ifndef _WX_NOTEBOOK_H_BASE_
|
|
|
|
#define _WX_NOTEBOOK_H_BASE_
|
1998-06-02 15:04:33 -04:00
|
|
|
|
1999-05-25 09:38:50 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
#include "wx/defs.h"
|
|
|
|
|
|
|
|
#if wxUSE_NOTEBOOK
|
|
|
|
|
2003-08-20 18:57:07 -04:00
|
|
|
#include "wx/bookctrl.h"
|
2001-06-26 16:59:19 -04:00
|
|
|
|
2003-07-06 17:02:24 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// constants
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2006-07-05 08:21:13 -04:00
|
|
|
// wxNotebook hit results, use wxBK_HITTEST so other book controls can share them
|
|
|
|
// if wxUSE_NOTEBOOK is disabled
|
2003-07-06 17:02:24 -04:00
|
|
|
enum
|
|
|
|
{
|
2006-07-05 08:21:13 -04:00
|
|
|
wxNB_HITTEST_NOWHERE = wxBK_HITTEST_NOWHERE,
|
|
|
|
wxNB_HITTEST_ONICON = wxBK_HITTEST_ONICON,
|
|
|
|
wxNB_HITTEST_ONLABEL = wxBK_HITTEST_ONLABEL,
|
|
|
|
wxNB_HITTEST_ONITEM = wxBK_HITTEST_ONITEM,
|
|
|
|
wxNB_HITTEST_ONPAGE = wxBK_HITTEST_ONPAGE
|
2003-07-06 17:02:24 -04:00
|
|
|
};
|
|
|
|
|
2006-10-20 05:16:41 -04:00
|
|
|
// wxNotebook flags
|
|
|
|
|
|
|
|
// use common book wxBK_* flags for describing alignment
|
|
|
|
#define wxNB_DEFAULT wxBK_DEFAULT
|
|
|
|
#define wxNB_TOP wxBK_TOP
|
|
|
|
#define wxNB_BOTTOM wxBK_BOTTOM
|
|
|
|
#define wxNB_LEFT wxBK_LEFT
|
|
|
|
#define wxNB_RIGHT wxBK_RIGHT
|
|
|
|
|
|
|
|
#define wxNB_FIXEDWIDTH 0x0100
|
|
|
|
#define wxNB_MULTILINE 0x0200
|
|
|
|
#define wxNB_NOPAGETHEME 0x0400
|
|
|
|
#define wxNB_FLAT 0x0800
|
|
|
|
|
2006-07-05 08:21:13 -04:00
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
typedef wxWindow wxNotebookPage; // so far, any window can be a page
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
extern WXDLLIMPEXP_DATA_CORE(const char) wxNotebookNameStr[];
|
2005-01-13 15:30:21 -05:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
#if wxUSE_EXTENDED_RTTI
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// XTI accessor
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxNotebookPageInfo : public wxObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxNotebookPageInfo() { m_page = NULL; m_imageId = -1; m_selected = false; }
|
|
|
|
virtual ~wxNotebookPageInfo() { }
|
|
|
|
|
|
|
|
bool Create(wxNotebookPage *page,
|
|
|
|
const wxString& text,
|
|
|
|
bool selected,
|
|
|
|
int imageId)
|
|
|
|
{
|
|
|
|
m_page = page;
|
|
|
|
m_text = text;
|
|
|
|
m_selected = selected;
|
|
|
|
m_imageId = imageId;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxNotebookPage* GetPage() const { return m_page; }
|
|
|
|
wxString GetText() const { return m_text; }
|
|
|
|
bool GetSelected() const { return m_selected; }
|
|
|
|
int GetImageId() const { return m_imageId; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxNotebookPage *m_page;
|
|
|
|
wxString m_text;
|
|
|
|
bool m_selected;
|
|
|
|
int m_imageId;
|
|
|
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxNotebookPageInfo)
|
|
|
|
};
|
|
|
|
|
|
|
|
WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList );
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxNotebookBase: define wxNotebook interface
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxNotebookBase : public wxBookCtrlBase
|
2001-06-26 16:59:19 -04:00
|
|
|
{
|
|
|
|
public:
|
2003-08-20 18:57:07 -04:00
|
|
|
// ctors
|
|
|
|
// -----
|
|
|
|
|
2004-01-15 08:49:22 -05:00
|
|
|
wxNotebookBase() { }
|
2003-08-20 18:57:07 -04:00
|
|
|
|
2004-11-23 06:45:07 -05:00
|
|
|
// wxNotebook-specific additions to wxBookCtrlBase interface
|
|
|
|
// ---------------------------------------------------------
|
2001-06-26 16:59:19 -04:00
|
|
|
|
|
|
|
// get the number of rows for a control with wxNB_MULTILINE style (not all
|
|
|
|
// versions support it - they will always return 1 then)
|
|
|
|
virtual int GetRowCount() const { return 1; }
|
|
|
|
|
|
|
|
// set the padding between tabs (in pixels)
|
|
|
|
virtual void SetPadding(const wxSize& padding) = 0;
|
|
|
|
|
|
|
|
// set the size of the tabs for wxNB_FIXEDWIDTH controls
|
|
|
|
virtual void SetTabSize(const wxSize& sz) = 0;
|
|
|
|
|
2003-07-06 17:02:24 -04:00
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
|
2003-08-20 18:57:07 -04:00
|
|
|
// implement some base class functions
|
|
|
|
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
|
2003-01-02 18:38:11 -05:00
|
|
|
|
2005-02-06 14:17:35 -05:00
|
|
|
// On platforms that support it, get the theme page background colour, else invalid colour
|
|
|
|
virtual wxColour GetThemeBackgroundColour() const { return wxNullColour; }
|
|
|
|
|
2006-10-08 19:41:52 -04:00
|
|
|
|
|
|
|
// send wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING/ED events
|
|
|
|
|
|
|
|
// returns false if the change to nPage is vetoed by the program
|
|
|
|
bool SendPageChangingEvent(int nPage);
|
|
|
|
|
|
|
|
// sends the event about page change from old to new (or GetSelection() if
|
2010-10-27 12:54:24 -04:00
|
|
|
// new is wxNOT_FOUND)
|
|
|
|
void SendPageChangedEvent(int nPageOld, int nPageNew = wxNOT_FOUND);
|
2006-10-08 19:41:52 -04:00
|
|
|
|
2007-03-25 19:00:36 -04:00
|
|
|
// wxBookCtrlBase overrides this method to return false but we do need
|
|
|
|
// focus because we have tabs
|
|
|
|
virtual bool AcceptsFocus() const { return wxControl::AcceptsFocus(); }
|
2006-10-08 19:41:52 -04:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
#if wxUSE_EXTENDED_RTTI
|
|
|
|
// XTI accessors
|
|
|
|
virtual void AddPageInfo( wxNotebookPageInfo* info );
|
|
|
|
virtual const wxNotebookPageInfoList& GetPageInfos() const;
|
|
|
|
#endif
|
|
|
|
|
2003-08-20 18:57:07 -04:00
|
|
|
protected:
|
2011-01-04 03:31:53 -05:00
|
|
|
#if wxUSE_EXTENDED_RTTI
|
|
|
|
wxNotebookPageInfoList m_pageInfos;
|
|
|
|
#endif
|
2009-02-08 06:45:59 -05:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxNotebookBase);
|
2001-06-26 16:59:19 -04:00
|
|
|
};
|
1999-05-25 09:38:50 -04:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2003-08-20 18:57:07 -04:00
|
|
|
// notebook event class and related stuff
|
1999-05-25 09:38:50 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-09-18 12:56:53 -04:00
|
|
|
// wxNotebookEvent is obsolete and defined for compatibility only (notice that
|
|
|
|
// we use #define and not typedef to also keep compatibility with the existing
|
|
|
|
// code which forward declares it)
|
|
|
|
#define wxNotebookEvent wxBookCtrlEvent
|
2008-08-01 09:46:46 -04:00
|
|
|
typedef wxBookCtrlEventFunction wxNotebookEventFunction;
|
|
|
|
#define wxNotebookEventHandler(func) wxBookCtrlEventHandler(func)
|
1999-05-25 09:38:50 -04:00
|
|
|
|
2009-02-07 13:59:25 -05:00
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxBookCtrlEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, wxBookCtrlEvent );
|
2001-01-31 12:16:40 -05:00
|
|
|
|
2005-02-14 18:53:48 -05:00
|
|
|
#define EVT_NOTEBOOK_PAGE_CHANGED(winid, fn) \
|
2008-08-01 09:46:46 -04:00
|
|
|
wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
|
2005-02-14 18:53:48 -05:00
|
|
|
|
|
|
|
#define EVT_NOTEBOOK_PAGE_CHANGING(winid, fn) \
|
2008-08-01 09:46:46 -04:00
|
|
|
wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
|
1999-05-25 09:38:50 -04:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxNotebook class itself
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
#if defined(__WXUNIVERSAL__)
|
|
|
|
#include "wx/univ/notebook.h"
|
|
|
|
#elif defined(__WXMSW__)
|
2003-06-26 13:26:34 -04:00
|
|
|
#include "wx/msw/notebook.h"
|
1998-07-10 10:15:17 -04:00
|
|
|
#elif defined(__WXMOTIF__)
|
2001-06-26 16:59:19 -04:00
|
|
|
#include "wx/generic/notebook.h"
|
2006-01-22 22:27:34 -05:00
|
|
|
#elif defined(__WXGTK20__)
|
2001-06-26 16:59:19 -04:00
|
|
|
#include "wx/gtk/notebook.h"
|
2006-01-22 22:27:34 -05:00
|
|
|
#elif defined(__WXGTK__)
|
|
|
|
#include "wx/gtk1/notebook.h"
|
1998-08-14 20:23:28 -04:00
|
|
|
#elif defined(__WXMAC__)
|
2008-06-11 15:17:41 -04:00
|
|
|
#include "wx/osx/notebook.h"
|
2003-03-22 01:13:03 -05:00
|
|
|
#elif defined(__WXCOCOA__)
|
2004-04-09 16:20:51 -04:00
|
|
|
#include "wx/cocoa/notebook.h"
|
1999-07-27 23:38:12 -04:00
|
|
|
#elif defined(__WXPM__)
|
2001-06-26 16:59:19 -04:00
|
|
|
#include "wx/os2/notebook.h"
|
1998-06-02 15:04:33 -04:00
|
|
|
#endif
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
#endif // wxUSE_NOTEBOOK
|
|
|
|
|
1998-06-02 15:04:33 -04:00
|
|
|
#endif
|
1998-08-14 20:23:28 -04:00
|
|
|
// _WX_NOTEBOOK_H_BASE_
|