1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: MSW/GTK compatible notebook (a.k.a. property sheet)
4 // Author: Stefan Csomor
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_NOTEBOOK_H_
12 #define _WX_NOTEBOOK_H_
14 // ----------------------------------------------------------------------------
16 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
21 // ----------------------------------------------------------------------------
24 class WXDLLEXPORT wxImageList
;
25 class WXDLLEXPORT wxWindow
;
27 // ----------------------------------------------------------------------------
29 // ----------------------------------------------------------------------------
31 // @@@ this class should really derive from wxTabCtrl, but the interface is not
32 // exactly the same, so I can't do it right now and instead we reimplement
33 // part of wxTabCtrl here
34 class wxNotebook
: public wxNotebookBase
39 // default for dynamic class
41 // the same arguments as for wxControl (@@@ any special styles?)
42 wxNotebook(wxWindow
*parent
,
44 const wxPoint
& pos
= wxDefaultPosition
,
45 const wxSize
& size
= wxDefaultSize
,
47 const wxString
& name
= wxNotebookNameStr
);
49 bool Create(wxWindow
*parent
,
51 const wxPoint
& pos
= wxDefaultPosition
,
52 const wxSize
& size
= wxDefaultSize
,
54 const wxString
& name
= wxNotebookNameStr
);
60 // set the currently selected page, return the index of the previously
61 // selected one (or -1 on error)
62 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
63 int SetSelection(size_t nPage
);
64 // get the currently selected page
65 int GetSelection() const { return m_nSelection
; }
67 // set/get the title of a page
68 bool SetPageText(size_t nPage
, const wxString
& strText
);
69 wxString
GetPageText(size_t nPage
) const;
71 // sets/returns item's image index in the current image list
72 int GetPageImage(size_t nPage
) const;
73 bool SetPageImage(size_t nPage
, int nImage
);
75 // control the appearance of the notebook pages
76 // set the size (the same for all pages)
77 virtual void SetPageSize(const wxSize
& size
);
78 // set the padding between tabs (in pixels)
79 virtual void SetPadding(const wxSize
& padding
);
80 // sets the size of the tabs (assumes all tabs are the same size)
81 virtual void SetTabSize(const wxSize
& sz
);
83 // calculate size for wxNotebookSizer
84 wxSize
CalcSizeFromPage(const wxSize
& sizePage
) const;
85 wxRect
GetPageRect() const ;
87 // get number of pages in the dialog
88 int GetPageCount() const;
90 // cycle thru the tabs
91 void AdvanceSelection(bool bForward = true);
94 // currently it's always 1 because wxGTK doesn't support multi-row
96 int GetRowCount() const;
101 bool DeleteAllPages();
102 // the same as AddPage(), but adds it at the specified position
103 bool InsertPage(size_t nPage
,
104 wxNotebookPage
*pPage
,
105 const wxString
& strText
,
106 bool bSelect
= false,
109 // get the panel which represents the given page
110 wxNotebookPage *GetPage(int nPage) { return m_aPages[nPage]; }
114 void OnSize(wxSizeEvent
& event
);
115 void OnSelChange(wxNotebookEvent
& event
);
116 void OnSetFocus(wxFocusEvent
& event
);
117 void OnNavigationKey(wxNavigationKeyEvent
& event
);
122 #if wxUSE_CONSTRAINTS
123 virtual void SetConstraintSizes(bool recurse
= true);
124 virtual bool DoPhase(int nPhase
);
128 // base class virtuals
129 // -------------------
130 virtual void Command(wxCommandEvent
& event
);
132 virtual wxNotebookPage
*DoRemovePage(size_t page
) ;
133 virtual wxInt32
MacControlHit( WXEVENTHANDLERREF handler
, WXEVENTREF event
) ;
134 // common part of all ctors
138 void ChangePage(int nOldSel
, int nSel
); // change pages
144 int m_nSelection
; // the current selection (-1 if none)
146 DECLARE_DYNAMIC_CLASS(wxNotebook
)
147 DECLARE_EVENT_TABLE()
151 #endif // _WX_NOTEBOOK_H_