X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1d8c3e58b88ecef633154776708fc90fba221b5c..874dbd3a4a318bd7f34548b84cfe0aed9efa42d5:/include/wx/univ/notebook.h diff --git a/include/wx/univ/notebook.h b/include/wx/univ/notebook.h index 3e29d78106..064eb2cbed 100644 --- a/include/wx/univ/notebook.h +++ b/include/wx/univ/notebook.h @@ -12,26 +12,24 @@ #ifndef _WX_UNIV_NOTEBOOK_H_ #define _WX_UNIV_NOTEBOOK_H_ -#ifdef __GNUG__ - #pragma interface "univnotebook.h" -#endif +#include "wx/arrstr.h" -class WXDLLEXPORT wxSpinButton; +class WXDLLIMPEXP_FWD_CORE wxSpinButton; // ---------------------------------------------------------------------------- // the actions supported by this control // ---------------------------------------------------------------------------- // change the page: to the next/previous/given one -#define wxACTION_NOTEBOOK_NEXT _T("nexttab") -#define wxACTION_NOTEBOOK_PREV _T("prevtab") -#define wxACTION_NOTEBOOK_GOTO _T("gototab") +#define wxACTION_NOTEBOOK_NEXT wxT("nexttab") +#define wxACTION_NOTEBOOK_PREV wxT("prevtab") +#define wxACTION_NOTEBOOK_GOTO wxT("gototab") // ---------------------------------------------------------------------------- // wxNotebook // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxNotebook : public wxNotebookBase +class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase { public: // ctors and such @@ -44,7 +42,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = wxNOTEBOOK_NAME) + const wxString& name = wxNotebookNameStr) { Init(); @@ -57,7 +55,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = wxNOTEBOOK_NAME); + const wxString& name = wxNotebookNameStr); // dtor virtual ~wxNotebook(); @@ -65,48 +63,49 @@ public: // implement wxNotebookBase pure virtuals // -------------------------------------- - virtual int SetSelection(int nPage); - virtual int GetSelection() const { return m_sel; } + virtual int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); } + virtual int GetSelection() const { return (int) m_sel; } - virtual bool SetPageText(int nPage, const wxString& strText); - virtual wxString GetPageText(int nPage) const; + // changes selected page without sending events + int ChangeSelection(size_t nPage) { return DoSetSelection(nPage); } - virtual int GetPageImage(int nPage) const; - virtual bool SetPageImage(int nPage, int nImage); + virtual bool SetPageText(size_t nPage, const wxString& strText); + virtual wxString GetPageText(size_t nPage) const; + + virtual int GetPageImage(size_t nPage) const; + virtual bool SetPageImage(size_t nPage, int nImage); virtual void SetPageSize(const wxSize& size); virtual void SetPadding(const wxSize& padding); virtual void SetTabSize(const wxSize& sz); - virtual wxSize CalcSizeFromPage(const wxSize& sizePage); + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; virtual bool DeleteAllPages(); - virtual bool InsertPage(int nPage, + virtual bool InsertPage(size_t nPage, wxNotebookPage *pPage, const wxString& strText, - bool bSelect = FALSE, + bool bSelect = false, int imageId = -1); // style tests // ----------- - // return TRUE if all tabs have the same width - bool FixedSizeTabs() const - { return GetWindowStyle() & wxNB_FIXEDWIDTH != 0; } + // return true if all tabs have the same width + bool FixedSizeTabs() const { return HasFlag(wxNB_FIXEDWIDTH); } // return wxTOP/wxBOTTOM/wxRIGHT/wxLEFT wxDirection GetTabOrientation() const; - // return TRUE if the notebook has tabs at the sidesand not at the top (or + // return true if the notebook has tabs at the sidesand not at the top (or // bottom) as usual bool IsVertical() const; // hit testing // ----------- - // return the tab at this position or -1 if none - int HitTest(const wxPoint& pt) const; + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; // input handling // -------------- @@ -115,11 +114,17 @@ public: long numArg = 0l, const wxString& strArg = wxEmptyString); + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) + { + return GetStdInputHandler(handlerDef); + } + // refresh the currently selected tab void RefreshCurrent(); protected: - virtual wxNotebookPage *DoRemovePage(int nPage); + virtual wxNotebookPage *DoRemovePage(size_t nPage); // drawing virtual void DoDraw(wxControlRenderer *renderer); @@ -132,6 +137,8 @@ protected: int width, int height, int sizeFlags = wxSIZE_AUTO); + int DoSetSelection(size_t nPage, int flags = 0); + // common part of all ctors void Init(); @@ -155,7 +162,7 @@ protected: void PositionSpinBtn(); // refresh the given tab only - void RefreshTab(int page, bool forceSelected = FALSE); + void RefreshTab(int page, bool forceSelected = false); // refresh all tabs void RefreshAllTabs(); @@ -180,7 +187,7 @@ protected: wxCoord GetTabWidth(int page) const { return FixedSizeTabs() ? m_widthMax : m_widths[page]; } - // return TRUE if the tab has an associated image + // return true if the tab has an associated image bool HasImage(int page) const { return m_imageList && m_images[page] != -1; } @@ -194,9 +201,6 @@ protected: // get our client size from the page size wxSize GetSizeForPage(const wxSize& size) const; - // change thep age and send events about it (can be vetoed by user code) - void ChangePage(int nPage); - // scroll the tabs so that the first page shown becomes the given one void ScrollTo(int page); @@ -249,28 +253,5 @@ protected: DECLARE_DYNAMIC_CLASS(wxNotebook) }; -// ---------------------------------------------------------------------------- -// wxStdNotebookInputHandler: translates SPACE and ENTER keys and the left mouse -// click into button press/release actions -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStdNotebookInputHandler : public wxStdInputHandler -{ -public: - wxStdNotebookInputHandler(wxInputHandler *inphand); - - virtual bool HandleKey(wxInputConsumer *consumer, - const wxKeyEvent& event, - bool pressed); - virtual bool HandleMouse(wxInputConsumer *consumer, - const wxMouseEvent& event); - virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event); - virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event); - virtual bool HandleActivation(wxInputConsumer *consumer, bool activated); - -protected: - void HandleFocusChange(wxInputConsumer *consumer); -}; - #endif // _WX_UNIV_NOTEBOOK_H_