]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/tabctrl.h
Applied patch [ 1341085 ] richtext xml build fix
[wxWidgets.git] / include / wx / msw / tabctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: tabctrl.h
3 // Purpose: wxTabCtrl class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_TABCTRL_H_
13 #define _WX_TABCTRL_H_
14
15 class WXDLLIMPEXP_CORE wxImageList;
16
17 // extern WXDLLEXPORT_DATA(const wxChar*) wxToolBarNameStr;
18
19 /*
20 * Flags returned by HitTest
21 */
22
23 #define wxTAB_HITTEST_NOWHERE 1
24 #define wxTAB_HITTEST_ONICON 2
25 #define wxTAB_HITTEST_ONLABEL 4
26 #define wxTAB_HITTEST_ONITEM 6
27
28 class WXDLLEXPORT wxTabCtrl: public wxControl
29 {
30 DECLARE_DYNAMIC_CLASS(wxTabCtrl)
31 public:
32 /*
33 * Public interface
34 */
35
36 wxTabCtrl();
37
38 inline wxTabCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
39 long style = 0, const wxString& name = wxT("tabCtrl"))
40 {
41 Create(parent, id, pos, size, style, name);
42 }
43 ~wxTabCtrl();
44
45 // Accessors
46
47 // Get the selection
48 int GetSelection() const;
49
50 // Get the tab with the current keyboard focus
51 int GetCurFocus() const;
52
53 // Get the associated image list
54 wxImageList* GetImageList() const;
55
56 // Get the number of items
57 int GetItemCount() const;
58
59 // Get the rect corresponding to the tab
60 bool GetItemRect(int item, wxRect& rect) const;
61
62 // Get the number of rows
63 int GetRowCount() const;
64
65 // Get the item text
66 wxString GetItemText(int item) const ;
67
68 // Get the item image
69 int GetItemImage(int item) const;
70
71 // Get the item data
72 void* GetItemData(int item) const;
73
74 // Set the selection
75 int SetSelection(int item);
76
77 // Set the image list
78 void SetImageList(wxImageList* imageList);
79
80 // Set the text for an item
81 bool SetItemText(int item, const wxString& text);
82
83 // Set the image for an item
84 bool SetItemImage(int item, int image);
85
86 // Set the data for an item
87 bool SetItemData(int item, void* data);
88
89 // Set the size for a fixed-width tab control
90 void SetItemSize(const wxSize& size);
91
92 // Set the padding between tabs
93 void SetPadding(const wxSize& padding);
94
95 // Operations
96
97 bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
98 long style = 0, const wxString& name = wxT("tabCtrl"));
99
100 // Delete all items
101 bool DeleteAllItems();
102
103 // Delete an item
104 bool DeleteItem(int item);
105
106 // Hit test
107 int HitTest(const wxPoint& pt, long& flags);
108
109 // Insert an item
110 bool InsertItem(int item, const wxString& text, int imageId = -1, void* data = NULL);
111
112 // Implementation
113
114 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
115
116 // Responds to colour changes
117 void OnSysColourChanged(wxSysColourChangedEvent& event);
118
119 protected:
120 wxImageList* m_imageList;
121
122 DECLARE_EVENT_TABLE()
123 DECLARE_NO_COPY_CLASS(wxTabCtrl)
124 };
125
126 class WXDLLEXPORT wxTabEvent : public wxNotifyEvent
127 {
128 public:
129 wxTabEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
130 int nSel = -1, int nOldSel = -1)
131 : wxNotifyEvent(commandType, id)
132 {
133 m_nSel = nSel;
134 m_nOldSel = nOldSel;
135 }
136
137 // accessors
138 // the currently selected page (-1 if none)
139 int GetSelection() const { return m_nSel; }
140 void SetSelection(int nSel) { m_nSel = nSel; }
141 // the page that was selected before the change (-1 if none)
142 int GetOldSelection() const { return m_nOldSel; }
143 void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; }
144
145 private:
146 int m_nSel, // currently selected page
147 m_nOldSel; // previously selected page
148
149 DECLARE_DYNAMIC_CLASS_NO_COPY(wxTabEvent)
150 };
151
152 typedef void (wxEvtHandler::*wxTabEventFunction)(wxTabEvent&);
153
154 #define EVT_TAB_SEL_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGED, \
155 id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL),
156 #define EVT_TAB_SEL_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGING, \
157 id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL),
158
159 #endif
160 // _WX_TABCTRL_H_