1 /////////////////////////////////////////////////////////////////////////////
2 // Name: palmos/notebook.h
3 // Purpose: notebook interface (a.k.a. property sheet)
4 // Author: William Osborne
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "notebook.h"
21 // ----------------------------------------------------------------------------
23 // ----------------------------------------------------------------------------
25 #include "wx/control.h"
27 // ----------------------------------------------------------------------------
29 // ----------------------------------------------------------------------------
31 class WXDLLEXPORT wxNotebookPageInfo
: public wxObject
34 wxNotebookPageInfo() { m_page
= NULL
; m_imageId
= -1 ; m_selected
= false ; }
35 virtual ~wxNotebookPageInfo() { }
37 void Create( wxNotebookPage
*page
, const wxString
&text
, bool selected
, int imageId
)
38 { m_page
= page
; m_text
= text
; m_selected
= selected
; m_imageId
= imageId
; }
39 wxNotebookPage
* GetPage() const { return m_page
; }
40 wxString
GetText() const { return m_text
; }
41 bool GetSelected() const { return m_selected
; }
42 int GetImageId() const { return m_imageId
; }
44 wxNotebookPage
*m_page
;
49 DECLARE_DYNAMIC_CLASS(wxNotebookPageInfo
) ;
53 WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo
, wxNotebookPageInfoList
);
55 class WXDLLEXPORT wxNotebook
: public wxNotebookBase
61 // default for dynamic class
64 // the same arguments as for wxControl (@@@ any special styles?)
65 wxNotebook(wxWindow
*parent
,
67 const wxPoint
& pos
= wxDefaultPosition
,
68 const wxSize
& size
= wxDefaultSize
,
70 const wxString
& name
= wxNotebookNameStr
);
73 bool Create(wxWindow
*parent
,
75 const wxPoint
& pos
= wxDefaultPosition
,
76 const wxSize
& size
= wxDefaultSize
,
78 const wxString
& name
= wxNotebookNameStr
);
83 // get number of pages in the dialog
84 virtual size_t GetPageCount() const;
86 // set the currently selected page, return the index of the previously
87 // selected one (or -1 on error)
88 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
89 int SetSelection(size_t nPage
);
91 // get the currently selected page
92 int GetSelection() const { return m_nSelection
; }
94 // set/get the title of a page
95 bool SetPageText(size_t nPage
, const wxString
& strText
);
96 wxString
GetPageText(size_t nPage
) const;
98 // image list stuff: each page may have an image associated with it. All
99 // the images belong to an image list, so you have to
100 // 1) create an image list
101 // 2) associate it with the notebook
102 // 3) set for each page it's image
103 // associate image list with a control
104 void SetImageList(wxImageList
* imageList
);
106 // sets/returns item's image index in the current image list
107 int GetPageImage(size_t nPage
) const;
108 bool SetPageImage(size_t nPage
, int nImage
);
110 // currently it's always 1 because wxGTK doesn't support multi-row
112 int GetRowCount() const;
114 // control the appearance of the notebook pages
115 // set the size (the same for all pages)
116 void SetPageSize(const wxSize
& size
);
117 // set the padding between tabs (in pixels)
118 void SetPadding(const wxSize
& padding
);
123 bool DeleteAllPages();
125 // inserts a new page to the notebook (it will be deleted ny the notebook,
126 // don't delete it yourself). If bSelect, this page becomes active.
127 bool InsertPage(size_t nPage
,
128 wxNotebookPage
*pPage
,
129 const wxString
& strText
,
130 bool bSelect
= false,
133 void AddPageInfo( wxNotebookPageInfo
* info
) { AddPage( info
->GetPage() , info
->GetText() , info
->GetSelected() , info
->GetImageId() ) ; }
134 const wxNotebookPageInfoList
& GetPageInfos() const ;
136 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
138 void SetTabSize(const wxSize
& sz
);
141 virtual int HitTest(const wxPoint
& pt
, long *flags
= NULL
) const;
143 // calculate the size of the notebook from the size of its page
144 virtual wxSize
CalcSizeFromPage(const wxSize
& sizePage
) const;
148 void OnSize(wxSizeEvent
& event
);
149 void OnSelChange(wxNotebookEvent
& event
);
150 void OnNavigationKey(wxNavigationKeyEvent
& event
);
152 // base class virtuals
153 // -------------------
155 #if wxUSE_CONSTRAINTS
156 virtual void SetConstraintSizes(bool recurse
= true);
157 virtual bool DoPhase(int nPhase
);
158 #endif // wxUSE_CONSTRAINTS
161 // common part of all ctors
164 // remove one page from the notebook, without deleting
165 virtual wxNotebookPage
*DoRemovePage(size_t nPage
);
167 // set the size of the given page to fit in the notebook
168 void AdjustPageSize(wxNotebookPage
*page
);
170 // the current selection (-1 if none)
173 wxNotebookPageInfoList m_pageInfos
;
176 DECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook
)
177 DECLARE_EVENT_TABLE()
180 #endif // wxUSE_NOTEBOOK
182 #endif // _NOTEBOOK_H