1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/palmos/notebook.h
3 // Purpose: notebook interface (a.k.a. property sheet)
4 // Author: William Osborne - minimal working wxPalmOS port
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
17 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
21 #include "wx/control.h"
23 // ----------------------------------------------------------------------------
25 // ----------------------------------------------------------------------------
27 class WXDLLEXPORT wxNotebookPageInfo
: public wxObject
30 wxNotebookPageInfo() { m_page
= NULL
; m_imageId
= -1 ; m_selected
= false ; }
31 virtual ~wxNotebookPageInfo() { }
33 void Create( wxNotebookPage
*page
, const wxString
&text
, bool selected
, int imageId
)
34 { m_page
= page
; m_text
= text
; m_selected
= selected
; m_imageId
= imageId
; }
35 wxNotebookPage
* GetPage() const { return m_page
; }
36 wxString
GetText() const { return m_text
; }
37 bool GetSelected() const { return m_selected
; }
38 int GetImageId() const { return m_imageId
; }
40 wxNotebookPage
*m_page
;
45 DECLARE_DYNAMIC_CLASS(wxNotebookPageInfo
) ;
49 WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo
, wxNotebookPageInfoList
);
51 class WXDLLEXPORT wxNotebook
: public wxNotebookBase
57 // default for dynamic class
60 // the same arguments as for wxControl (@@@ any special styles?)
61 wxNotebook(wxWindow
*parent
,
63 const wxPoint
& pos
= wxDefaultPosition
,
64 const wxSize
& size
= wxDefaultSize
,
66 const wxString
& name
= wxNotebookNameStr
);
69 bool Create(wxWindow
*parent
,
71 const wxPoint
& pos
= wxDefaultPosition
,
72 const wxSize
& size
= wxDefaultSize
,
74 const wxString
& name
= wxNotebookNameStr
);
79 // get number of pages in the dialog
80 virtual size_t GetPageCount() const;
82 // set the currently selected page, return the index of the previously
83 // selected one (or -1 on error)
84 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
85 int SetSelection(size_t nPage
);
87 // get the currently selected page
88 int GetSelection() const { return m_nSelection
; }
90 // set/get the title of a page
91 bool SetPageText(size_t nPage
, const wxString
& strText
);
92 wxString
GetPageText(size_t nPage
) const;
94 // image list stuff: each page may have an image associated with it. All
95 // the images belong to an image list, so you have to
96 // 1) create an image list
97 // 2) associate it with the notebook
98 // 3) set for each page it's image
99 // associate image list with a control
100 void SetImageList(wxImageList
* imageList
);
102 // sets/returns item's image index in the current image list
103 int GetPageImage(size_t nPage
) const;
104 bool SetPageImage(size_t nPage
, int nImage
);
106 // currently it's always 1 because wxGTK doesn't support multi-row
108 int GetRowCount() const;
110 // control the appearance of the notebook pages
111 // set the size (the same for all pages)
112 void SetPageSize(const wxSize
& size
);
113 // set the padding between tabs (in pixels)
114 void SetPadding(const wxSize
& padding
);
119 bool DeleteAllPages();
121 // inserts a new page to the notebook (it will be deleted ny the notebook,
122 // don't delete it yourself). If bSelect, this page becomes active.
123 bool InsertPage(size_t nPage
,
124 wxNotebookPage
*pPage
,
125 const wxString
& strText
,
126 bool bSelect
= false,
129 void AddPageInfo( wxNotebookPageInfo
* info
) { AddPage( info
->GetPage() , info
->GetText() , info
->GetSelected() , info
->GetImageId() ) ; }
130 const wxNotebookPageInfoList
& GetPageInfos() const ;
132 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
134 void SetTabSize(const wxSize
& sz
);
137 virtual int HitTest(const wxPoint
& pt
, long *flags
= NULL
) const;
139 // calculate the size of the notebook from the size of its page
140 virtual wxSize
CalcSizeFromPage(const wxSize
& sizePage
) const;
144 void OnSize(wxSizeEvent
& event
);
145 void OnSelChange(wxNotebookEvent
& event
);
146 void OnNavigationKey(wxNavigationKeyEvent
& event
);
148 // base class virtuals
149 // -------------------
151 #if wxUSE_CONSTRAINTS
152 virtual void SetConstraintSizes(bool recurse
= true);
153 virtual bool DoPhase(int nPhase
);
154 #endif // wxUSE_CONSTRAINTS
157 // common part of all ctors
160 // remove one page from the notebook, without deleting
161 virtual wxNotebookPage
*DoRemovePage(size_t nPage
);
163 // set the size of the given page to fit in the notebook
164 void AdjustPageSize(wxNotebookPage
*page
);
166 // the current selection (-1 if none)
169 wxNotebookPageInfoList m_pageInfos
;
172 DECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook
)
173 DECLARE_EVENT_TABLE()
176 #endif // wxUSE_NOTEBOOK
178 #endif // _NOTEBOOK_H