2009-01-17 05:43:43 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2011-03-19 20:14:35 -04:00
|
|
|
// Name: wx/osx/notebook.h
|
2009-01-17 05:43:43 -05:00
|
|
|
// Purpose: MSW/GTK compatible notebook (a.k.a. property sheet)
|
|
|
|
// Author: Stefan Csomor
|
|
|
|
// Modified by:
|
|
|
|
// Copyright: (c) Stefan Csomor
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_NOTEBOOK_H_
|
|
|
|
#define _WX_NOTEBOOK_H_
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
#include "wx/event.h"
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// types
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// fwd declarations
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxImageList;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxWindow;
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxNotebook
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// ctors
|
|
|
|
// -----
|
|
|
|
// default for dynamic class
|
2010-10-27 12:54:36 -04:00
|
|
|
wxNotebook() { }
|
2009-01-17 05:43:43 -05:00
|
|
|
// the same arguments as for wxControl (@@@ any special styles?)
|
|
|
|
wxNotebook(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
2019-10-22 06:34:29 -04:00
|
|
|
const wxString& name = wxASCII_STR(wxNotebookNameStr))
|
2010-10-27 12:54:36 -04:00
|
|
|
{ Create( parent, id, pos, size, style, name ); }
|
2009-01-17 05:43:43 -05:00
|
|
|
// Create() function
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
2019-10-22 06:34:29 -04:00
|
|
|
const wxString& name = wxASCII_STR(wxNotebookNameStr));
|
2009-01-17 05:43:43 -05:00
|
|
|
// dtor
|
|
|
|
virtual ~wxNotebook();
|
|
|
|
|
|
|
|
// accessors
|
|
|
|
// ---------
|
|
|
|
// set the currently selected page, return the index of the previously
|
2010-10-27 12:54:24 -04:00
|
|
|
// selected one (or wxNOT_FOUND on error)
|
2009-01-17 05:43:43 -05:00
|
|
|
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
|
2015-11-22 04:15:41 -05:00
|
|
|
int SetSelection(size_t nPage) wxOVERRIDE { return DoSetSelection(nPage, SetSelection_SendEvent); }
|
2009-01-17 05:43:43 -05:00
|
|
|
|
|
|
|
// changes selected page without sending events
|
2015-11-22 04:15:41 -05:00
|
|
|
int ChangeSelection(size_t nPage) wxOVERRIDE { return DoSetSelection(nPage); }
|
2009-01-17 05:43:43 -05:00
|
|
|
|
|
|
|
// set/get the title of a page
|
2015-11-22 04:15:41 -05:00
|
|
|
bool SetPageText(size_t nPage, const wxString& strText) wxOVERRIDE;
|
|
|
|
wxString GetPageText(size_t nPage) const wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
|
|
|
|
// sets/returns item's image index in the current image list
|
2015-11-22 04:15:41 -05:00
|
|
|
int GetPageImage(size_t nPage) const wxOVERRIDE;
|
|
|
|
bool SetPageImage(size_t nPage, int nImage) wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
|
|
|
|
// control the appearance of the notebook pages
|
|
|
|
// set the size (the same for all pages)
|
2015-11-22 04:15:41 -05:00
|
|
|
virtual void SetPageSize(const wxSize& size) wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
// set the padding between tabs (in pixels)
|
2015-11-22 04:15:41 -05:00
|
|
|
virtual void SetPadding(const wxSize& padding) wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
// sets the size of the tabs (assumes all tabs are the same size)
|
2015-11-22 04:15:41 -05:00
|
|
|
virtual void SetTabSize(const wxSize& sz) wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
|
|
|
|
// hit test
|
2015-11-22 04:15:41 -05:00
|
|
|
virtual int HitTest(const wxPoint& pt, long *flags = NULL) const wxOVERRIDE;
|
2009-08-21 06:41:26 -04:00
|
|
|
|
2009-01-17 05:43:43 -05:00
|
|
|
// calculate size for wxNotebookSizer
|
2015-11-22 04:15:41 -05:00
|
|
|
wxSize CalcSizeFromPage(const wxSize& sizePage) const wxOVERRIDE;
|
|
|
|
wxRect GetPageRect() const wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
|
|
|
|
// operations
|
|
|
|
// ----------
|
|
|
|
// remove all pages
|
2015-11-22 04:15:41 -05:00
|
|
|
bool DeleteAllPages() wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
// the same as AddPage(), but adds it at the specified position
|
|
|
|
bool InsertPage(size_t nPage,
|
|
|
|
wxNotebookPage *pPage,
|
|
|
|
const wxString& strText,
|
|
|
|
bool bSelect = false,
|
2015-11-22 04:15:41 -05:00
|
|
|
int imageId = NO_IMAGE) wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
|
|
|
|
// callbacks
|
|
|
|
// ---------
|
|
|
|
void OnSize(wxSizeEvent& event);
|
|
|
|
void OnSetFocus(wxFocusEvent& event);
|
|
|
|
void OnNavigationKey(wxNavigationKeyEvent& event);
|
|
|
|
|
|
|
|
// implementation
|
|
|
|
// --------------
|
|
|
|
|
|
|
|
#if wxUSE_CONSTRAINTS
|
2015-11-22 04:15:41 -05:00
|
|
|
virtual void SetConstraintSizes(bool recurse = true) wxOVERRIDE;
|
|
|
|
virtual bool DoPhase(int nPhase) wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
|
2008-06-11 12:30:48 -04:00
|
|
|
#endif
|
2009-01-17 05:43:43 -05:00
|
|
|
|
|
|
|
// base class virtuals
|
|
|
|
// -------------------
|
2015-11-22 04:15:41 -05:00
|
|
|
virtual void Command(wxCommandEvent& event) wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
// osx specific event handling common for all osx-ports
|
2009-08-21 06:41:26 -04:00
|
|
|
|
2015-11-22 04:15:41 -05:00
|
|
|
virtual bool OSXHandleClicked( double timestampsec ) wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
|
|
|
|
protected:
|
2015-11-22 04:15:41 -05:00
|
|
|
virtual wxNotebookPage *DoRemovePage(size_t page) wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
|
|
|
// helper functions
|
|
|
|
void ChangePage(int nOldSel, int nSel); // change pages
|
|
|
|
void MacSetupTabs();
|
|
|
|
|
2015-11-22 04:15:41 -05:00
|
|
|
int DoSetSelection(size_t nPage, int flags = 0) wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
|
|
|
|
// the icon indices
|
|
|
|
wxArrayInt m_images;
|
|
|
|
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxNotebook);
|
|
|
|
wxDECLARE_EVENT_TABLE();
|
2009-01-17 05:43:43 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _WX_NOTEBOOK_H_
|