1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: notebook.h
|
|
|
|
// Purpose: MSW/GTK compatible notebook (a.k.a. property sheet)
|
1999-10-12 18:49:24 -04:00
|
|
|
// Author: David Webster
|
1999-07-29 01:11:30 -04:00
|
|
|
// Modified by:
|
|
|
|
// RCS-ID: $Id$
|
1999-10-12 18:49:24 -04:00
|
|
|
// Copyright: (c) David Webster
|
|
|
|
// Licence: wxWindows licence
|
1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2002-08-30 09:37:52 -04:00
|
|
|
#ifndef _NOTEBOOK_H
|
|
|
|
#define _NOTEBOOK_H
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2002-08-30 09:37:52 -04:00
|
|
|
#if wxUSE_NOTEBOOK
|
1999-07-29 01:11:30 -04:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2002-08-30 09:37:52 -04:00
|
|
|
// headers
|
1999-07-29 01:11:30 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2002-08-30 09:37:52 -04:00
|
|
|
#include "wx/control.h"
|
1999-07-29 01:11:30 -04:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxNotebook
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2001-07-06 17:45:11 -04:00
|
|
|
class WXDLLEXPORT wxNotebook : public wxNotebookBase
|
1999-07-29 01:11:30 -04:00
|
|
|
{
|
|
|
|
public:
|
2002-08-30 09:37:52 -04:00
|
|
|
//
|
|
|
|
// Ctors
|
|
|
|
// -----
|
|
|
|
// Default for dynamic class
|
|
|
|
//
|
|
|
|
wxNotebook();
|
|
|
|
|
|
|
|
//
|
|
|
|
// the same arguments as for wxControl
|
|
|
|
//
|
|
|
|
wxNotebook( wxWindow* pParent
|
|
|
|
,wxWindowID vId
|
|
|
|
,const wxPoint& rPos = wxDefaultPosition
|
|
|
|
,const wxSize& rSize = wxDefaultSize
|
|
|
|
,long lStyle = 0
|
|
|
|
,const wxString& rsName = "notebook"
|
|
|
|
);
|
|
|
|
|
|
|
|
bool Create( wxWindow* pParent
|
|
|
|
,wxWindowID vId
|
|
|
|
,const wxPoint& rPos = wxDefaultPosition
|
|
|
|
,const wxSize& rSize = wxDefaultSize
|
|
|
|
,long lStyle = 0
|
|
|
|
,const wxString& rsName = "notebook"
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Accessors
|
|
|
|
// ---------
|
|
|
|
// Get number of pages in the dialog
|
|
|
|
//
|
|
|
|
int GetPageCount(void) const;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Set the currently selected page, return the index of the previously
|
1999-07-29 01:11:30 -04:00
|
|
|
// selected one (or -1 on error)
|
|
|
|
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
|
2002-08-30 09:37:52 -04:00
|
|
|
//
|
|
|
|
int SetSelection(int nPage);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Get the currently selected page
|
|
|
|
//
|
|
|
|
inline int GetSelection(void) const { return m_nSelection; }
|
|
|
|
|
|
|
|
//
|
|
|
|
// Set/Get the title of a page
|
|
|
|
//
|
|
|
|
bool SetPageText( int nPage
|
|
|
|
,const wxString& sStrText
|
|
|
|
);
|
|
|
|
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
|
1999-07-29 01:11:30 -04:00
|
|
|
// associate image list with a control
|
2002-08-30 09:37:52 -04:00
|
|
|
//
|
|
|
|
void SetImageList(wxImageList* pImageList);
|
|
|
|
|
|
|
|
//
|
|
|
|
// 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
|
1999-07-29 01:11:30 -04:00
|
|
|
// tab controls
|
2002-08-30 09:37:52 -04:00
|
|
|
//
|
|
|
|
int GetRowCount(void) const;
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2002-08-30 09:37:52 -04:00
|
|
|
//
|
|
|
|
// control the appearance of the notebook pages
|
1999-07-29 01:11:30 -04:00
|
|
|
// set the size (the same for all pages)
|
2002-08-30 09:37:52 -04:00
|
|
|
//
|
|
|
|
void SetPageSize(const wxSize& rSize);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Set the padding between tabs (in pixels)
|
|
|
|
//
|
|
|
|
void SetPadding(const wxSize& rPadding);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Operations
|
|
|
|
// ----------
|
|
|
|
// Remove all pages
|
|
|
|
//
|
|
|
|
bool DeleteAllPages(void);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Adds a new page to the notebook (it will be deleted ny the notebook,
|
1999-07-29 01:11:30 -04:00
|
|
|
// don't delete it yourself). If bSelect, this page becomes active.
|
2002-08-30 09:37:52 -04:00
|
|
|
//
|
|
|
|
bool AddPage( wxNotebookPage* pPage
|
|
|
|
,const wxString& rsStrText
|
|
|
|
,bool bSelect = FALSE
|
|
|
|
,int nImageId = -1
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
|
|
|
// The same as AddPage(), but adds it at the specified position
|
|
|
|
//
|
|
|
|
bool InsertPage( int nPage
|
|
|
|
,wxNotebookPage* pPage
|
|
|
|
,const wxString& rsStrText
|
|
|
|
,bool bSelect = FALSE
|
|
|
|
,int nImageId = -1
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
1999-10-12 18:49:24 -04:00
|
|
|
// Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
|
|
|
|
// style.
|
2002-08-30 09:37:52 -04:00
|
|
|
//
|
|
|
|
void SetTabSize(const wxSize& rSize);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Callbacks
|
|
|
|
// ---------
|
|
|
|
//
|
|
|
|
void OnSize(wxSizeEvent& rEvent);
|
|
|
|
void OnSelChange(wxNotebookEvent& rEvent);
|
|
|
|
void OnSetFocus(wxFocusEvent& rEvent);
|
|
|
|
void OnNavigationKey(wxNavigationKeyEvent& rEvent);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Base class virtuals
|
|
|
|
// -------------------
|
|
|
|
//
|
|
|
|
virtual bool OS2OnScroll( int nOrientation
|
|
|
|
,WXWORD wSBCode
|
|
|
|
,WXWORD wPos
|
|
|
|
,WXHWND hControl
|
|
|
|
);
|
|
|
|
virtual void SetConstraintSizes(bool bRecurse = TRUE);
|
|
|
|
virtual bool DoPhase(int nPhase);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
//
|
|
|
|
// Common part of all ctors
|
|
|
|
//
|
|
|
|
void Init(void);
|
1999-10-12 18:49:24 -04:00
|
|
|
|
2002-08-30 09:37:52 -04:00
|
|
|
//
|
|
|
|
// Translate wxWin styles to the PM ones
|
|
|
|
//
|
|
|
|
virtual WXDWORD OS2GetStyle( long lFlags
|
|
|
|
,WXDWORD* pwExstyle = NULL
|
|
|
|
) const;
|
1999-10-12 18:49:24 -04:00
|
|
|
|
2002-08-30 09:37:52 -04:00
|
|
|
//
|
|
|
|
// Remove one page from the notebook, without deleting
|
|
|
|
//
|
|
|
|
virtual wxNotebookPage* DoRemovePage(int nPage);
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2002-08-30 09:37:52 -04:00
|
|
|
//
|
|
|
|
// Helper functions
|
|
|
|
//
|
|
|
|
|
|
|
|
int m_nSelection; // The current selection (-1 if none)
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2002-08-30 09:37:52 -04:00
|
|
|
private:
|
|
|
|
wxArrayLong m_alPageId;
|
|
|
|
int m_nTabSize; // holds the largest tab size
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2002-08-30 09:37:52 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxNotebook)
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
}; // end of CLASS wxNotebook
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2002-08-30 09:37:52 -04:00
|
|
|
#endif // wxUSE_NOTEBOOK
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2002-08-30 09:37:52 -04:00
|
|
|
#endif // _NOTEBOOK_H
|
1999-07-29 01:11:30 -04:00
|
|
|
|