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