2001-06-26 20:59:19 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/notebook.h
|
|
|
|
// Purpose: wxNotebook interface
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01.02.01
|
|
|
|
// RCS-ID: $Id$
|
2004-05-23 14:56:36 +00:00
|
|
|
// Copyright: (c) 1996-2000 wxWidgets team
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
2001-06-26 20:59:19 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-15 00:23:28 +00:00
|
|
|
#ifndef _WX_NOTEBOOK_H_BASE_
|
|
|
|
#define _WX_NOTEBOOK_H_BASE_
|
1998-06-02 19:04:33 +00:00
|
|
|
|
2003-08-09 12:38:21 +00:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
2001-07-02 18:34:13 +00:00
|
|
|
#pragma interface "notebookbase.h"
|
|
|
|
#endif
|
|
|
|
|
1999-05-25 13:38:50 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
#include "wx/defs.h"
|
|
|
|
|
|
|
|
#if wxUSE_NOTEBOOK
|
|
|
|
|
2003-08-20 22:57:07 +00:00
|
|
|
#include "wx/bookctrl.h"
|
2001-06-26 20:59:19 +00:00
|
|
|
|
2003-07-06 21:02:24 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// constants
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// wxNotebook hit results
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
wxNB_HITTEST_NOWHERE = 1, // not on tab
|
|
|
|
wxNB_HITTEST_ONICON = 2, // on icon
|
|
|
|
wxNB_HITTEST_ONLABEL = 4, // on label
|
|
|
|
wxNB_HITTEST_ONITEM = wxNB_HITTEST_ONICON | wxNB_HITTEST_ONLABEL
|
|
|
|
};
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
typedef wxWindow wxNotebookPage; // so far, any window can be a page
|
|
|
|
|
|
|
|
#define wxNOTEBOOK_NAME _T("notebook")
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxNotebookBase: define wxNotebook interface
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2003-08-20 22:57:07 +00:00
|
|
|
class WXDLLEXPORT wxNotebookBase : public wxBookCtrl
|
2001-06-26 20:59:19 +00:00
|
|
|
{
|
|
|
|
public:
|
2003-08-20 22:57:07 +00:00
|
|
|
// ctors
|
|
|
|
// -----
|
|
|
|
|
2004-01-15 13:49:22 +00:00
|
|
|
wxNotebookBase() { }
|
2003-08-20 22:57:07 +00:00
|
|
|
|
|
|
|
wxNotebookBase(wxWindow *parent,
|
2003-11-06 18:09:48 +00:00
|
|
|
wxWindowID winid,
|
2003-08-20 22:57:07 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
2004-01-11 15:33:01 +00:00
|
|
|
const wxString& name = wxNOTEBOOK_NAME) ;
|
2001-06-26 20:59:19 +00:00
|
|
|
|
2003-08-20 22:57:07 +00:00
|
|
|
// wxNotebook-specific additions to wxBookCtrl interface
|
|
|
|
// -----------------------------------------------------
|
2001-06-26 20:59:19 +00: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 21:02:24 +00:00
|
|
|
// hit test, returns which tab is hit and, optionally, where (icon, label)
|
|
|
|
// (not implemented on all platforms)
|
2003-07-22 00:24:07 +00:00
|
|
|
virtual int HitTest(const wxPoint& WXUNUSED(pt),
|
|
|
|
long * WXUNUSED(flags) = NULL) const
|
2003-07-06 21:02:24 +00:00
|
|
|
{
|
|
|
|
return wxNOT_FOUND;
|
|
|
|
}
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
|
2003-08-20 22:57:07 +00:00
|
|
|
// implement some base class functions
|
|
|
|
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
|
2003-01-02 23:38:11 +00:00
|
|
|
|
2003-08-20 22:57:07 +00:00
|
|
|
protected:
|
2003-01-02 23:38:11 +00:00
|
|
|
DECLARE_NO_COPY_CLASS(wxNotebookBase)
|
2001-06-26 20:59:19 +00:00
|
|
|
};
|
1999-05-25 13:38:50 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2003-08-20 22:57:07 +00:00
|
|
|
// notebook event class and related stuff
|
1999-05-25 13:38:50 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2003-08-20 22:57:07 +00:00
|
|
|
class WXDLLEXPORT wxNotebookEvent : public wxBookCtrlEvent
|
1999-05-25 13:38:50 +00:00
|
|
|
{
|
|
|
|
public:
|
2003-11-06 18:09:48 +00:00
|
|
|
wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int winid = 0,
|
1999-05-25 13:38:50 +00:00
|
|
|
int nSel = -1, int nOldSel = -1)
|
2003-11-06 18:09:48 +00:00
|
|
|
: wxBookCtrlEvent(commandType, winid, nSel, nOldSel)
|
2003-08-20 22:57:07 +00:00
|
|
|
{
|
|
|
|
}
|
1999-05-25 13:38:50 +00:00
|
|
|
|
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebookEvent)
|
1999-05-25 13:38:50 +00:00
|
|
|
};
|
|
|
|
|
2001-01-31 17:16:40 +00:00
|
|
|
BEGIN_DECLARE_EVENT_TYPES()
|
|
|
|
DECLARE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, 802)
|
|
|
|
DECLARE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, 803)
|
|
|
|
END_DECLARE_EVENT_TYPES()
|
|
|
|
|
1999-05-25 13:38:50 +00:00
|
|
|
typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&);
|
|
|
|
|
2003-11-06 18:09:48 +00:00
|
|
|
#define EVT_NOTEBOOK_PAGE_CHANGED(winid, fn) \
|
2001-01-31 17:16:40 +00:00
|
|
|
DECLARE_EVENT_TABLE_ENTRY( \
|
1999-05-25 13:38:50 +00:00
|
|
|
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, \
|
2003-11-06 18:09:48 +00:00
|
|
|
winid, \
|
1999-05-25 13:38:50 +00:00
|
|
|
-1, \
|
2004-02-10 22:15:19 +00:00
|
|
|
(wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent( wxNotebookEventFunction, &fn ), \
|
1999-05-25 13:38:50 +00:00
|
|
|
NULL \
|
2001-01-26 17:35:36 +00:00
|
|
|
),
|
1999-05-25 13:38:50 +00:00
|
|
|
|
2003-11-06 18:09:48 +00:00
|
|
|
#define EVT_NOTEBOOK_PAGE_CHANGING(winid, fn) \
|
2001-01-31 17:16:40 +00:00
|
|
|
DECLARE_EVENT_TABLE_ENTRY( \
|
1999-05-25 13:38:50 +00:00
|
|
|
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, \
|
2003-11-06 18:09:48 +00:00
|
|
|
winid, \
|
1999-05-25 13:38:50 +00:00
|
|
|
-1, \
|
2004-02-10 22:15:19 +00:00
|
|
|
(wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent( wxNotebookEventFunction, &fn ), \
|
1999-05-25 13:38:50 +00:00
|
|
|
NULL \
|
2001-01-26 17:35:36 +00:00
|
|
|
),
|
1999-05-25 13:38:50 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxNotebook class itself
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
#if defined(__WXUNIVERSAL__)
|
|
|
|
#include "wx/univ/notebook.h"
|
|
|
|
#elif defined(__WXMSW__)
|
2003-06-26 17:26:34 +00:00
|
|
|
#include "wx/msw/notebook.h"
|
1998-07-10 14:15:17 +00:00
|
|
|
#elif defined(__WXMOTIF__)
|
2001-06-26 20:59:19 +00:00
|
|
|
#include "wx/generic/notebook.h"
|
1998-07-10 14:15:17 +00:00
|
|
|
#elif defined(__WXGTK__)
|
2001-06-26 20:59:19 +00:00
|
|
|
#include "wx/gtk/notebook.h"
|
1998-08-15 00:23:28 +00:00
|
|
|
#elif defined(__WXMAC__)
|
2001-06-26 20:59:19 +00:00
|
|
|
#include "wx/mac/notebook.h"
|
2003-03-22 06:13:03 +00:00
|
|
|
#elif defined(__WXCOCOA__)
|
2004-04-09 20:20:51 +00:00
|
|
|
#include "wx/cocoa/notebook.h"
|
1999-07-28 03:38:12 +00:00
|
|
|
#elif defined(__WXPM__)
|
2001-06-26 20:59:19 +00:00
|
|
|
#include "wx/os2/notebook.h"
|
1998-06-02 19:04:33 +00:00
|
|
|
#endif
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
#endif // wxUSE_NOTEBOOK
|
|
|
|
|
1998-06-02 19:04:33 +00:00
|
|
|
#endif
|
1998-08-15 00:23:28 +00:00
|
|
|
// _WX_NOTEBOOK_H_BASE_
|