1998-06-02 19:04:33 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
1998-07-22 22:13:31 +00:00
|
|
|
// Name: notebook.h
|
|
|
|
// Purpose: wxNotebook class
|
1998-06-02 19:04:33 +00:00
|
|
|
// Author: Robert Roebling
|
|
|
|
// Modified by:
|
|
|
|
// RCS-ID: $Id$
|
1998-12-04 07:43:56 +00:00
|
|
|
// Copyright: (c) Julian Smart and Robert Roebling
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-06-02 19:04:33 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-11-03 11:19:58 +00:00
|
|
|
#ifndef __GTKNOTEBOOKH__
|
|
|
|
#define __GTKNOTEBOOKH__
|
1998-06-02 19:04:33 +00:00
|
|
|
|
2000-02-11 12:28:21 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// internal class
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 22:58:06 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxGtkNotebookPage;
|
1998-06-02 19:04:33 +00:00
|
|
|
|
2001-07-02 18:34:13 +00:00
|
|
|
#include "wx/list.h"
|
|
|
|
WX_DECLARE_LIST(wxGtkNotebookPage, wxGtkNotebookPagesList);
|
|
|
|
|
1998-06-02 19:04:33 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
1998-06-26 14:29:11 +00:00
|
|
|
// wxNotebook
|
1998-06-02 19:04:33 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 22:58:06 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase
|
1998-06-02 19:04:33 +00:00
|
|
|
{
|
1998-06-26 14:29:11 +00:00
|
|
|
public:
|
2000-01-23 15:51:36 +00:00
|
|
|
// default for dynamic class
|
|
|
|
wxNotebook();
|
|
|
|
// the same arguments as for wxControl
|
|
|
|
wxNotebook(wxWindow *parent,
|
1998-07-04 15:17:59 +00:00
|
|
|
wxWindowID id,
|
1998-06-26 14:29:11 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
1998-07-04 15:17:59 +00:00
|
|
|
long style = 0,
|
2005-01-13 20:30:21 +00:00
|
|
|
const wxString& name = wxNotebookNameStr);
|
2000-01-23 15:51:36 +00:00
|
|
|
// Create() function
|
|
|
|
bool Create(wxWindow *parent,
|
1998-07-04 15:17:59 +00:00
|
|
|
wxWindowID id,
|
1998-06-26 14:29:11 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
1998-07-04 15:17:59 +00:00
|
|
|
long style = 0,
|
2005-01-13 20:30:21 +00:00
|
|
|
const wxString& name = wxNotebookNameStr);
|
2000-01-23 15:51:36 +00:00
|
|
|
// dtor
|
2001-07-02 18:34:13 +00:00
|
|
|
virtual ~wxNotebook();
|
1998-06-26 14:29:11 +00:00
|
|
|
|
|
|
|
// accessors
|
|
|
|
// ---------
|
|
|
|
|
|
|
|
// set the currently selected page, return the index of the previously
|
|
|
|
// selected one (or -1 on error)
|
|
|
|
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
|
2003-08-20 22:57:07 +00:00
|
|
|
int SetSelection(size_t nPage);
|
1998-06-26 14:29:11 +00:00
|
|
|
// get the currently selected page
|
|
|
|
int GetSelection() const;
|
|
|
|
|
|
|
|
// set/get the title of a page
|
2003-08-20 22:57:07 +00:00
|
|
|
bool SetPageText(size_t nPage, const wxString& strText);
|
|
|
|
wxString GetPageText(size_t nPage) const;
|
1998-06-26 14:29:11 +00:00
|
|
|
|
|
|
|
// sets/returns item's image index in the current image list
|
2003-08-20 22:57:07 +00:00
|
|
|
int GetPageImage(size_t nPage) const;
|
|
|
|
bool SetPageImage(size_t nPage, int nImage);
|
1998-06-26 14:29:11 +00:00
|
|
|
|
|
|
|
// control the appearance of the notebook pages
|
|
|
|
// set the size (the same for all pages)
|
|
|
|
void SetPageSize(const wxSize& size);
|
|
|
|
// set the padding between tabs (in pixels)
|
|
|
|
void SetPadding(const wxSize& padding);
|
1999-05-11 11:49:11 +00:00
|
|
|
// sets the size of the tabs (assumes all tabs are the same size)
|
1999-04-06 16:32:33 +00:00
|
|
|
void SetTabSize(const wxSize& sz);
|
|
|
|
|
2004-01-22 14:47:19 +00:00
|
|
|
virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
|
|
|
|
|
1998-06-26 14:29:11 +00:00
|
|
|
// operations
|
|
|
|
// ----------
|
|
|
|
// remove all pages
|
|
|
|
bool DeleteAllPages();
|
2001-06-26 20:59:19 +00:00
|
|
|
|
2005-11-19 01:07:56 +00:00
|
|
|
// adds a new page to the notebook (it will be deleted by the notebook,
|
1998-06-26 14:29:11 +00:00
|
|
|
// don't delete it yourself). If bSelect, this page becomes active.
|
1999-05-24 19:33:05 +00:00
|
|
|
// the same as AddPage(), but adds it at the specified position
|
2003-08-21 12:44:52 +00:00
|
|
|
bool InsertPage( size_t position,
|
2000-02-11 12:28:21 +00:00
|
|
|
wxNotebookPage *win,
|
|
|
|
const wxString& strText,
|
2005-01-13 20:30:21 +00:00
|
|
|
bool bSelect = false,
|
2000-02-11 12:28:21 +00:00
|
|
|
int imageId = -1 );
|
1998-06-26 14:29:11 +00:00
|
|
|
|
2000-01-23 15:51:36 +00:00
|
|
|
// handler for tab navigation
|
|
|
|
// --------------------------
|
|
|
|
void OnNavigationKey(wxNavigationKeyEvent& event);
|
1999-08-20 22:52:21 +00:00
|
|
|
|
2004-05-06 17:26:25 +00:00
|
|
|
|
|
|
|
static wxVisualAttributes
|
|
|
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
2005-01-13 20:30:21 +00:00
|
|
|
|
2000-01-04 13:02:27 +00:00
|
|
|
// implementation
|
|
|
|
// --------------
|
1999-05-11 11:49:11 +00:00
|
|
|
|
2000-02-27 21:04:26 +00:00
|
|
|
#if wxUSE_CONSTRAINTS
|
2000-01-04 13:02:27 +00:00
|
|
|
void SetConstraintSizes(bool recurse);
|
|
|
|
bool DoPhase(int phase);
|
2000-02-27 21:04:26 +00:00
|
|
|
#endif
|
2001-06-26 20:59:19 +00:00
|
|
|
// report if window belongs to notebook
|
2000-01-04 13:02:27 +00:00
|
|
|
bool IsOwnGtkWindow( GdkWindow *window );
|
1999-05-06 14:30:49 +00:00
|
|
|
|
2000-01-04 13:02:27 +00:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
1998-06-26 14:29:11 +00:00
|
|
|
|
2000-01-04 13:02:27 +00:00
|
|
|
// helper function
|
2000-02-11 12:28:21 +00:00
|
|
|
wxGtkNotebookPage* GetNotebookPage(int page) const;
|
1998-06-26 14:29:11 +00:00
|
|
|
|
2001-07-02 18:34:13 +00:00
|
|
|
// the additional page data (the pages themselves are in m_pages array)
|
|
|
|
wxGtkNotebookPagesList m_pagesData;
|
2001-05-22 14:01:02 +00:00
|
|
|
|
|
|
|
// for reasons explained in gtk/notebook.cpp we store the current
|
|
|
|
// selection internally instead of querying the notebook for it
|
2001-07-02 18:34:13 +00:00
|
|
|
int m_selection;
|
1998-06-02 19:04:33 +00:00
|
|
|
|
2005-01-13 20:30:21 +00:00
|
|
|
// flag set to true while we're inside "switch_page" callback
|
2002-12-04 14:11:26 +00:00
|
|
|
bool m_inSwitchPage;
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
protected:
|
2006-02-08 21:47:09 +00:00
|
|
|
// set all page's attributes
|
|
|
|
void DoApplyWidgetStyle(GtkRcStyle *style);
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
// remove one page from the notebook but do not destroy it
|
2003-08-20 22:57:07 +00:00
|
|
|
virtual wxNotebookPage *DoRemovePage(size_t nPage);
|
2001-06-26 20:59:19 +00:00
|
|
|
|
2000-01-04 13:02:27 +00:00
|
|
|
private:
|
2002-12-04 14:11:26 +00:00
|
|
|
// the padding set by SetPadding()
|
2002-08-08 10:11:32 +00:00
|
|
|
int m_padding;
|
|
|
|
|
2000-01-04 13:02:27 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxNotebook)
|
|
|
|
DECLARE_EVENT_TABLE()
|
1998-06-02 19:04:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-11-03 11:19:58 +00:00
|
|
|
// __GTKNOTEBOOKH__
|