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