]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/palmos/tabctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/palmos/tabctrl.h
3 // Purpose: wxTabCtrl class
4 // Author: William Osborne - minimal working wxPalmOS port
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_TABCTRL_H_
13 #define _WX_TABCTRL_H_
17 // WXDLLEXPORT_DATA(extern const wxChar) wxToolBarNameStr[];
20 * Flags returned by HitTest
23 #define wxTAB_HITTEST_NOWHERE 1
24 #define wxTAB_HITTEST_ONICON 2
25 #define wxTAB_HITTEST_ONLABEL 4
26 #define wxTAB_HITTEST_ONITEM 6
28 class WXDLLEXPORT wxTabCtrl
: public wxControl
30 DECLARE_DYNAMIC_CLASS(wxTabCtrl
)
38 inline wxTabCtrl(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
39 long style
= 0, const wxString
& name
= wxT("tabCtrl"))
41 Create(parent
, id
, pos
, size
, style
, name
);
48 int GetSelection() const;
50 // Get the tab with the current keyboard focus
51 int GetCurFocus() const;
53 // Get the associated image list
54 wxImageList
* GetImageList() const;
56 // Get the number of items
57 int GetItemCount() const;
59 // Get the rect corresponding to the tab
60 bool GetItemRect(int item
, wxRect
& rect
) const;
62 // Get the number of rows
63 int GetRowCount() const;
66 wxString
GetItemText(int item
) const ;
69 int GetItemImage(int item
) const;
72 void* GetItemData(int item
) const;
75 int SetSelection(int item
);
78 void SetImageList(wxImageList
* imageList
);
80 // Set the text for an item
81 bool SetItemText(int item
, const wxString
& text
);
83 // Set the image for an item
84 bool SetItemImage(int item
, int image
);
86 // Set the data for an item
87 bool SetItemData(int item
, void* data
);
89 // Set the size for a fixed-width tab control
90 void SetItemSize(const wxSize
& size
);
92 // Set the padding between tabs
93 void SetPadding(const wxSize
& padding
);
97 bool Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
98 long style
= 0, const wxString
& name
= wxT("tabCtrl"));
101 bool DeleteAllItems();
104 bool DeleteItem(int item
);
107 int HitTest(const wxPoint
& pt
, long& flags
);
110 bool InsertItem(int item
, const wxString
& text
, int imageId
= -1, void* data
= NULL
);
114 virtual bool MSWOnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
);
117 wxImageList
* m_imageList
;
119 DECLARE_EVENT_TABLE()
120 DECLARE_NO_COPY_CLASS(wxTabCtrl
)
123 class WXDLLEXPORT wxTabEvent
: public wxNotifyEvent
126 wxTabEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0,
127 int nSel
= -1, int nOldSel
= -1)
128 : wxNotifyEvent(commandType
, id
)
135 // the currently selected page (-1 if none)
136 int GetSelection() const { return m_nSel
; }
137 void SetSelection(int nSel
) { m_nSel
= nSel
; }
138 // the page that was selected before the change (-1 if none)
139 int GetOldSelection() const { return m_nOldSel
; }
140 void SetOldSelection(int nOldSel
) { m_nOldSel
= nOldSel
; }
143 int m_nSel
, // currently selected page
144 m_nOldSel
; // previously selected page
146 DECLARE_DYNAMIC_CLASS_NO_COPY(wxTabEvent
)
149 typedef void (wxEvtHandler::*wxTabEventFunction
)(wxTabEvent
&);
151 #define EVT_TAB_SEL_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGED, \
152 id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL),
153 #define EVT_TAB_SEL_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGING, \
154 id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL),