1998-06-14 19:16:19 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: msw/notebook.h
|
|
|
|
// Purpose: MSW/GTK compatible notebook (a.k.a. property sheet)
|
|
|
|
// Author: Robert Roebling
|
|
|
|
// Modified by: Vadim Zeitlin for Windows version
|
|
|
|
// RCS-ID: $Id$
|
2003-03-17 05:34:04 -05:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-06-14 19:16:19 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _NOTEBOOK_H
|
|
|
|
#define _NOTEBOOK_H
|
|
|
|
|
2003-08-09 08:38:21 -04:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1998-06-14 19:16:19 -04:00
|
|
|
#pragma interface "notebook.h"
|
|
|
|
#endif
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
#if wxUSE_NOTEBOOK
|
|
|
|
|
1998-06-14 19:16:19 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
1999-09-29 18:47:56 -04:00
|
|
|
|
1999-11-16 16:31:40 -05:00
|
|
|
#include "wx/control.h"
|
1998-06-14 19:16:19 -04:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxNotebook
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2003-08-14 14:06:49 -04:00
|
|
|
class WXDLLEXPORT wxNotebookPageInfo : public wxObject
|
|
|
|
{
|
|
|
|
public :
|
2005-02-06 11:17:18 -05:00
|
|
|
wxNotebookPageInfo() { m_page = NULL; m_imageId = -1; m_selected = false; }
|
2003-08-14 14:06:49 -04:00
|
|
|
virtual ~wxNotebookPageInfo() { }
|
|
|
|
|
2005-02-06 11:17:18 -05:00
|
|
|
void Create(wxNotebookPage *page,
|
|
|
|
const wxString& text,
|
|
|
|
bool selected,
|
|
|
|
int imageId)
|
|
|
|
{
|
|
|
|
m_page = page;
|
|
|
|
m_text = text;
|
|
|
|
m_selected = selected;
|
|
|
|
m_imageId = imageId;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxNotebookPage* GetPage() const { return m_page; }
|
|
|
|
wxString GetText() const { return m_text; }
|
|
|
|
bool GetSelected() const { return m_selected; }
|
2003-08-14 14:06:49 -04:00
|
|
|
int GetImageId() const { return m_imageId; }
|
|
|
|
|
2005-02-06 11:17:18 -05:00
|
|
|
private:
|
|
|
|
wxNotebookPage *m_page;
|
|
|
|
wxString m_text;
|
|
|
|
bool m_selected;
|
|
|
|
int m_imageId;
|
|
|
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxNotebookPageInfo)
|
|
|
|
};
|
2003-08-14 14:06:49 -04:00
|
|
|
|
|
|
|
|
2003-08-24 11:41:05 -04:00
|
|
|
WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList );
|
2003-08-14 14:06:49 -04:00
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
class WXDLLEXPORT wxNotebook : public wxNotebookBase
|
1998-06-14 19:16:19 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// ctors
|
|
|
|
// -----
|
|
|
|
// default for dynamic class
|
|
|
|
wxNotebook();
|
|
|
|
// the same arguments as for wxControl (@@@ any special styles?)
|
|
|
|
wxNotebook(wxWindow *parent,
|
1998-08-07 13:32:54 -04:00
|
|
|
wxWindowID id,
|
1998-06-14 19:16:19 -04:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
1998-07-04 11:17:59 -04:00
|
|
|
long style = 0,
|
2005-01-13 15:30:21 -05:00
|
|
|
const wxString& name = wxNotebookNameStr);
|
1998-06-14 19:16:19 -04:00
|
|
|
// Create() function
|
|
|
|
bool Create(wxWindow *parent,
|
1998-08-07 13:32:54 -04:00
|
|
|
wxWindowID id,
|
1998-06-14 19:16:19 -04:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
1998-07-04 11:17:59 -04:00
|
|
|
long style = 0,
|
2005-01-13 15:30:21 -05:00
|
|
|
const wxString& name = wxNotebookNameStr);
|
2004-11-19 13:36:45 -05:00
|
|
|
virtual ~wxNotebook();
|
1998-06-14 19:16:19 -04:00
|
|
|
|
|
|
|
// accessors
|
|
|
|
// ---------
|
|
|
|
// get number of pages in the dialog
|
2003-08-21 08:54:31 -04:00
|
|
|
virtual size_t GetPageCount() const;
|
1998-06-14 19:16:19 -04:00
|
|
|
|
|
|
|
// 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 18:57:07 -04:00
|
|
|
int SetSelection(size_t nPage);
|
1998-06-14 19:16:19 -04:00
|
|
|
// get the currently selected page
|
|
|
|
int GetSelection() const { return m_nSelection; }
|
|
|
|
|
|
|
|
// set/get the title of a page
|
2003-08-20 18:57:07 -04:00
|
|
|
bool SetPageText(size_t nPage, const wxString& strText);
|
|
|
|
wxString GetPageText(size_t nPage) const;
|
1998-06-14 19:16:19 -04:00
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
|
|
// sets/returns item's image index in the current image list
|
2003-08-20 18:57:07 -04:00
|
|
|
int GetPageImage(size_t nPage) const;
|
|
|
|
bool SetPageImage(size_t nPage, int nImage);
|
1998-06-14 19:16:19 -04:00
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
|
|
// operations
|
|
|
|
// ----------
|
|
|
|
// remove all pages
|
|
|
|
bool DeleteAllPages();
|
2003-07-06 17:02:24 -04:00
|
|
|
|
2003-04-06 13:46:48 -04:00
|
|
|
// inserts a new page to the notebook (it will be deleted ny the notebook,
|
1998-06-14 19:16:19 -04:00
|
|
|
// don't delete it yourself). If bSelect, this page becomes active.
|
2003-08-20 18:57:07 -04:00
|
|
|
bool InsertPage(size_t nPage,
|
1998-06-14 19:16:19 -04:00
|
|
|
wxNotebookPage *pPage,
|
|
|
|
const wxString& strText,
|
2004-08-31 08:38:46 -04:00
|
|
|
bool bSelect = false,
|
1998-07-08 18:39:21 -04:00
|
|
|
int imageId = -1);
|
1998-06-14 19:16:19 -04:00
|
|
|
|
2005-02-06 11:17:18 -05:00
|
|
|
void AddPageInfo( wxNotebookPageInfo* info ) { AddPage( info->GetPage() , info->GetText() , info->GetSelected() , info->GetImageId() ); }
|
|
|
|
const wxNotebookPageInfoList& GetPageInfos() const;
|
2003-08-14 14:06:49 -04:00
|
|
|
|
1999-03-21 17:39:45 -05:00
|
|
|
// Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
|
|
|
|
// style.
|
|
|
|
void SetTabSize(const wxSize& sz);
|
|
|
|
|
2003-07-06 17:02:24 -04:00
|
|
|
// hit test
|
|
|
|
virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
|
|
|
|
|
|
|
|
// calculate the size of the notebook from the size of its page
|
2003-06-01 09:13:03 -04:00
|
|
|
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
|
|
|
|
|
1998-06-14 19:16:19 -04:00
|
|
|
// callbacks
|
|
|
|
// ---------
|
1999-06-10 16:48:15 -04:00
|
|
|
void OnSize(wxSizeEvent& event);
|
1998-06-14 19:16:19 -04:00
|
|
|
void OnSelChange(wxNotebookEvent& event);
|
1998-07-08 18:39:21 -04:00
|
|
|
void OnNavigationKey(wxNavigationKeyEvent& event);
|
1998-08-07 13:32:54 -04:00
|
|
|
|
1998-06-14 19:16:19 -04:00
|
|
|
// base class virtuals
|
|
|
|
// -------------------
|
2003-01-14 14:40:55 -05:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
2002-04-09 20:22:49 -04:00
|
|
|
virtual bool MSWOnScroll(int orientation, WXWORD nSBCode,
|
|
|
|
WXWORD pos, WXHWND control);
|
2003-09-26 17:36:33 -04:00
|
|
|
virtual bool MSWTranslateMessage(WXMSG *wxmsg);
|
2003-01-14 14:40:55 -05:00
|
|
|
|
|
|
|
#if wxUSE_CONSTRAINTS
|
2004-08-31 08:38:46 -04:00
|
|
|
virtual void SetConstraintSizes(bool recurse = true);
|
1998-07-12 18:47:09 -04:00
|
|
|
virtual bool DoPhase(int nPhase);
|
2003-01-14 14:40:55 -05:00
|
|
|
#endif // wxUSE_CONSTRAINTS
|
1998-06-14 19:16:19 -04:00
|
|
|
|
2005-02-06 14:17:35 -05:00
|
|
|
// Attempts to get colour for UX theme page background
|
|
|
|
wxColour GetThemeBackgroundColour() const;
|
2004-11-19 13:36:45 -05:00
|
|
|
|
|
|
|
// implementation only
|
|
|
|
// -------------------
|
|
|
|
|
|
|
|
#if wxUSE_UXTHEME
|
2004-12-12 19:11:14 -05:00
|
|
|
virtual bool SetBackgroundColour(const wxColour& colour)
|
|
|
|
{
|
|
|
|
if ( !wxNotebookBase::SetBackgroundColour(colour) )
|
|
|
|
return false;
|
2004-11-19 13:36:45 -05:00
|
|
|
|
2004-12-12 19:11:14 -05:00
|
|
|
UpdateBgBrush();
|
2004-11-19 15:50:25 -05:00
|
|
|
|
2004-12-12 19:11:14 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, wxWindow *win);
|
|
|
|
virtual wxColour MSWGetBgColourForChild(wxWindow *win);
|
2004-11-19 13:36:45 -05:00
|
|
|
#endif // wxUSE_UXTHEME
|
|
|
|
|
1998-06-14 19:16:19 -04:00
|
|
|
protected:
|
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
2002-04-09 20:22:49 -04:00
|
|
|
// translate wxWin styles to the Windows ones
|
|
|
|
virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
// remove one page from the notebook, without deleting
|
2003-08-20 18:57:07 -04:00
|
|
|
virtual wxNotebookPage *DoRemovePage(size_t nPage);
|
2001-06-26 16:59:19 -04:00
|
|
|
|
2003-05-01 12:39:59 -04:00
|
|
|
// set the size of the given page to fit in the notebook
|
|
|
|
void AdjustPageSize(wxNotebookPage *page);
|
|
|
|
|
2003-12-11 17:20:22 -05:00
|
|
|
#if wxUSE_UXTHEME
|
2005-03-23 15:59:00 -05:00
|
|
|
// gets the bitmap of notebook background and returns a brush from it
|
|
|
|
WXHBRUSH QueryBgBitmap();
|
2004-12-12 19:11:14 -05:00
|
|
|
|
2004-11-19 13:36:45 -05:00
|
|
|
// creates the brush to be used for drawing the tab control background
|
|
|
|
void UpdateBgBrush();
|
2005-02-19 15:49:50 -05:00
|
|
|
|
|
|
|
// paint themed children background here
|
|
|
|
virtual bool MSWPrintChild(wxWindow *win, WXWPARAM wParam, WXLPARAM lParam);
|
2004-11-19 13:36:45 -05:00
|
|
|
#endif // wxUSE_UXTHEME
|
2003-05-01 12:39:59 -04:00
|
|
|
|
2002-12-04 09:11:26 -05:00
|
|
|
// the current selection (-1 if none)
|
|
|
|
int m_nSelection;
|
1998-06-14 19:16:19 -04:00
|
|
|
|
2004-11-19 13:36:45 -05:00
|
|
|
wxNotebookPageInfoList m_pageInfos;
|
|
|
|
|
|
|
|
#if wxUSE_UXTHEME
|
|
|
|
// background brush used to paint the tab control
|
|
|
|
WXHBRUSH m_hbrBackground;
|
|
|
|
#endif // wxUSE_UXTHEME
|
2003-08-14 14:06:49 -04:00
|
|
|
|
2003-05-01 12:39:59 -04:00
|
|
|
|
2003-07-21 20:24:07 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook)
|
1998-06-14 19:16:19 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
#endif // wxUSE_NOTEBOOK
|
|
|
|
|
1998-06-14 19:16:19 -04:00
|
|
|
#endif // _NOTEBOOK_H
|