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