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
|
1998-06-26 10:29:11 -04:00
|
|
|
// Licence: wxWindows license
|
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
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1998-11-03 06:19:58 -05:00
|
|
|
#pragma interface
|
1998-06-02 15:04:33 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
1999-06-14 19:04:05 -04:00
|
|
|
|
|
|
|
#if wxUSE_NOTEBOOK
|
|
|
|
|
1998-06-02 15:04:33 -04:00
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/string.h"
|
|
|
|
#include "wx/control.h"
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxImageList;
|
|
|
|
class wxNotebook;
|
1998-06-15 05:21:45 -04:00
|
|
|
class wxNotebookPage;
|
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
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-06-26 10:29:11 -04:00
|
|
|
class wxNotebook : public wxControl
|
1998-06-02 15:04:33 -04:00
|
|
|
{
|
1998-06-26 10:29:11 -04:00
|
|
|
public:
|
|
|
|
// ctors
|
|
|
|
// -----
|
|
|
|
// default for dynamic class
|
|
|
|
wxNotebook();
|
|
|
|
// the same arguments as for wxControl (@@@ any special styles?)
|
|
|
|
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,
|
1998-06-26 10:29:11 -04:00
|
|
|
const wxString& name = "notebook");
|
|
|
|
// 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,
|
1998-06-26 10:29:11 -04:00
|
|
|
const wxString& name = "notebook");
|
|
|
|
// dtor
|
|
|
|
~wxNotebook();
|
|
|
|
|
|
|
|
// accessors
|
|
|
|
// ---------
|
|
|
|
// get number of pages in the dialog
|
|
|
|
int GetPageCount() const;
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
// cycle thru the tabs
|
|
|
|
void AdvanceSelection(bool bForward = TRUE);
|
|
|
|
// 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;
|
|
|
|
|
|
|
|
// image list stuff: each page may have an image associated with it. All
|
|
|
|
// the images belong to an image list, so you have to
|
|
|
|
// 1) create an image list
|
|
|
|
// 2) associate it with the notebook
|
|
|
|
// 3) set for each page it's image
|
|
|
|
// associate image list with a control
|
|
|
|
void SetImageList(wxImageList* imageList);
|
|
|
|
// get pointer (may be NULL) to the associated image list
|
1999-05-11 07:49:11 -04:00
|
|
|
wxImageList *GetImageList() const { return m_imageList; }
|
1998-06-26 10:29:11 -04:00
|
|
|
|
|
|
|
// sets/returns item's image index in the current image list
|
|
|
|
int GetPageImage(int nPage) const;
|
|
|
|
bool SetPageImage(int nPage, int nImage);
|
|
|
|
|
|
|
|
// currently it's always 1 because wxGTK doesn't support multi-row
|
|
|
|
// tab controls
|
|
|
|
int GetRowCount() const;
|
|
|
|
|
|
|
|
// 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
|
|
|
|
// ----------
|
1998-11-24 08:29:09 -05:00
|
|
|
// remove one page from the notebook but do not destroy it
|
|
|
|
bool RemovePage(int nPage);
|
1998-06-26 10:29:11 -04:00
|
|
|
// remove one page from the notebook
|
|
|
|
bool DeletePage(int nPage);
|
|
|
|
// remove all pages
|
|
|
|
bool DeleteAllPages();
|
1999-05-24 15:33:05 -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
|
|
|
bool AddPage( wxWindow *win,
|
|
|
|
const wxString& strText,
|
|
|
|
bool select = FALSE,
|
|
|
|
int imageId = -1 );
|
|
|
|
// the same as AddPage(), but adds it at the specified position
|
|
|
|
bool InsertPage( int position,
|
|
|
|
wxWindow *win,
|
|
|
|
const wxString& strText,
|
|
|
|
bool bSelect = FALSE,
|
|
|
|
int imageId = -1 );
|
1998-06-26 10:29:11 -04:00
|
|
|
|
|
|
|
// get the panel which represents the given page
|
|
|
|
wxWindow *GetPage(int nPage) const;
|
|
|
|
|
1999-02-11 15:44:38 -05:00
|
|
|
void OnNavigationKey(wxNavigationKeyEvent& event);
|
1999-05-11 07:49:11 -04:00
|
|
|
|
1999-08-20 18:52:21 -04:00
|
|
|
// overridden from wxWindow to make tabbing work
|
|
|
|
void SetFocus();
|
|
|
|
|
1998-07-13 12:57:43 -04:00
|
|
|
// implementation
|
1999-05-11 07:49:11 -04:00
|
|
|
|
1998-10-29 13:03:18 -05:00
|
|
|
void SetConstraintSizes(bool recurse);
|
|
|
|
bool DoPhase(int phase);
|
|
|
|
void ApplyWidgetStyle();
|
1998-06-26 10:29:11 -04:00
|
|
|
|
1999-05-06 10:30:49 -04:00
|
|
|
// report if window belongs to notebook
|
|
|
|
bool IsOwnGtkWindow( GdkWindow *window );
|
|
|
|
|
1998-06-26 10:29:11 -04:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
|
|
|
// helper function
|
|
|
|
wxNotebookPage* GetNotebookPage(int page) const;
|
|
|
|
|
|
|
|
wxImageList* m_imageList;
|
|
|
|
wxList m_pages;
|
1999-05-25 06:40:07 -04:00
|
|
|
int m_lastSelection; /* hack */
|
1998-06-02 15:04:33 -04:00
|
|
|
|
1998-06-26 10:29:11 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxNotebook)
|
1999-02-11 15:44:38 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
1998-06-02 15:04:33 -04:00
|
|
|
};
|
|
|
|
|
1999-06-14 19:04:05 -04:00
|
|
|
#endif
|
|
|
|
|
1998-06-02 15:04:33 -04:00
|
|
|
#endif
|
1998-11-03 06:19:58 -05:00
|
|
|
// __GTKNOTEBOOKH__
|