]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/notebook.h
467a27e58b03f2404f2e169e0004b279fe8ec769
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxNotebook class (a.k.a. property sheet, tabbed dialog)
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_NOTEBOOK_H_
12 #define _WX_NOTEBOOK_H_
14 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
15 #pragma interface "notebook.h"
18 // ----------------------------------------------------------------------------
20 // ----------------------------------------------------------------------------
22 #include "wx/control.h"
24 // ----------------------------------------------------------------------------
26 // ----------------------------------------------------------------------------
29 class WXDLLEXPORT wxImageList
;
30 class WXDLLEXPORT wxWindow
;
31 class WXDLLEXPORT wxTabView
;
33 // ----------------------------------------------------------------------------
35 // ----------------------------------------------------------------------------
37 class wxNotebook
: public wxNotebookBase
42 // default for dynamic class
44 // the same arguments as for wxControl (@@@ any special styles?)
45 wxNotebook(wxWindow
*parent
,
47 const wxPoint
& pos
= wxDefaultPosition
,
48 const wxSize
& size
= wxDefaultSize
,
50 const wxString
& name
= "notebook");
52 bool Create(wxWindow
*parent
,
54 const wxPoint
& pos
= wxDefaultPosition
,
55 const wxSize
& size
= wxDefaultSize
,
57 const wxString
& name
= "notebook");
63 // Find the position of the wxNotebookPage, -1 if not found.
64 int FindPagePosition(wxNotebookPage
* page
) const;
66 // set the currently selected page, return the index of the previously
67 // selected one (or -1 on error)
68 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
69 int SetSelection(size_t nPage
);
70 // cycle thru the tabs
71 // void AdvanceSelection(bool bForward = TRUE);
72 // get the currently selected page
73 int GetSelection() const { return m_nSelection
; }
75 // set/get the title of a page
76 bool SetPageText(size_t nPage
, const wxString
& strText
);
77 wxString
GetPageText(size_t nPage
) const;
79 // get the number of rows for a control with wxNB_MULTILINE style (not all
80 // versions support it - they will always return 1 then)
81 virtual int GetRowCount() const ;
83 // sets/returns item's image index in the current image list
84 int GetPageImage(size_t nPage
) const;
85 bool SetPageImage(size_t nPage
, int nImage
);
87 // control the appearance of the notebook pages
88 // set the size (the same for all pages)
89 void SetPageSize(const wxSize
& size
);
90 // set the padding between tabs (in pixels)
91 void SetPadding(const wxSize
& padding
);
93 // Sets the size of the tabs (assumes all tabs are the same size)
94 void SetTabSize(const wxSize
& sz
);
98 // remove one page from the notebook, and delete the page.
99 bool DeletePage(size_t nPage
);
100 bool DeletePage(wxNotebookPage
* page
);
101 // remove one page from the notebook, without deleting the page.
102 bool RemovePage(size_t nPage
);
103 bool RemovePage(wxNotebookPage
* page
);
104 virtual wxWindow
* DoRemovePage(size_t nPage
);
107 bool DeleteAllPages();
108 // the same as AddPage(), but adds it at the specified position
109 bool InsertPage(size_t nPage
,
110 wxNotebookPage
*pPage
,
111 const wxString
& strText
,
112 bool bSelect
= FALSE
,
117 void OnSize(wxSizeEvent
& event
);
118 void OnInternalIdle();
119 void OnSelChange(wxNotebookEvent
& event
);
120 void OnSetFocus(wxFocusEvent
& event
);
121 void OnNavigationKey(wxNavigationKeyEvent
& event
);
123 // base class virtuals
124 // -------------------
125 virtual void Command(wxCommandEvent
& event
);
126 virtual void SetConstraintSizes(bool recurse
= TRUE
);
127 virtual bool DoPhase(int nPhase
);
131 // wxNotebook on Motif uses a generic wxTabView to implement itself.
132 wxTabView
*GetTabView() const { return m_tabView
; }
133 void SetTabView(wxTabView
*v
) { m_tabView
= v
; }
135 void OnMouseEvent(wxMouseEvent
& event
);
136 void OnPaint(wxPaintEvent
& event
);
138 virtual wxRect
GetAvailableClientSize();
140 // Implementation: calculate the layout of the view rect
141 // and resize the children if required
142 bool RefreshLayout(bool force
= TRUE
);
145 // common part of all ctors
149 void ChangePage(int nOldSel
, int nSel
); // change pages
151 int m_nSelection
; // the current selection (-1 if none)
153 wxTabView
* m_tabView
;
155 DECLARE_DYNAMIC_CLASS(wxNotebook
)
156 DECLARE_EVENT_TABLE()
159 #endif // _WX_NOTEBOOK_H_