]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/tabctrl.h
removed unused wxUSE_XXX options (patch 1759328)
[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
63ec432b 17// extern WXDLLEXPORT_DATA(const wxChar) wxToolBarNameStr[];
2bda0e17
KB
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
28class WXDLLEXPORT wxTabCtrl: public wxControl
29{
30 DECLARE_DYNAMIC_CLASS(wxTabCtrl)
31 public:
32 /*
33 * Public interface
34 */
35
ee4f8c2a 36 wxTabCtrl();
2bda0e17 37
ee4f8c2a 38 inline wxTabCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
2b5f62a0 39 long style = 0, const wxString& name = wxT("tabCtrl"))
2bda0e17
KB
40 {
41 Create(parent, id, pos, size, style, name);
42 }
d3c7fc99 43 virtual ~wxTabCtrl();
2bda0e17
KB
44
45// Accessors
46
47 // Get the selection
ee4f8c2a 48 int GetSelection() const;
2bda0e17 49
da87a1ca
JS
50 // Get the tab with the current keyboard focus
51 int GetCurFocus() const;
52
2bda0e17 53 // Get the associated image list
ee4f8c2a 54 wxImageList* GetImageList() const;
2bda0e17
KB
55
56 // Get the number of items
ee4f8c2a 57 int GetItemCount() const;
2bda0e17
KB
58
59 // Get the rect corresponding to the tab
ee4f8c2a 60 bool GetItemRect(int item, wxRect& rect) const;
2bda0e17
KB
61
62 // Get the number of rows
ee4f8c2a 63 int GetRowCount() const;
2bda0e17
KB
64
65 // Get the item text
ee4f8c2a 66 wxString GetItemText(int item) const ;
2bda0e17
KB
67
68 // Get the item image
ee4f8c2a 69 int GetItemImage(int item) const;
2bda0e17
KB
70
71 // Get the item data
ee4f8c2a 72 void* GetItemData(int item) const;
2bda0e17
KB
73
74 // Set the selection
ee4f8c2a 75 int SetSelection(int item);
2bda0e17
KB
76
77 // Set the image list
78 void SetImageList(wxImageList* imageList);
79
80 // Set the text for an item
ee4f8c2a 81 bool SetItemText(int item, const wxString& text);
2bda0e17
KB
82
83 // Set the image for an item
ee4f8c2a 84 bool SetItemImage(int item, int image);
2bda0e17
KB
85
86 // Set the data for an item
ee4f8c2a 87 bool SetItemData(int item, void* data);
2bda0e17
KB
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
201812a8 97 bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
2b5f62a0 98 long style = 0, const wxString& name = wxT("tabCtrl"));
2bda0e17
KB
99
100 // Delete all items
ee4f8c2a 101 bool DeleteAllItems();
2bda0e17
KB
102
103 // Delete an item
ee4f8c2a 104 bool DeleteItem(int item);
2bda0e17
KB
105
106 // Hit test
107 int HitTest(const wxPoint& pt, long& flags);
108
109 // Insert an item
ee4f8c2a 110 bool InsertItem(int item, const wxString& text, int imageId = -1, void* data = NULL);
2bda0e17 111
42e69d6b 112 // Implementation
2bda0e17 113
a23fd0e1 114 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
2bda0e17
KB
115
116 // Responds to colour changes
117 void OnSysColourChanged(wxSysColourChangedEvent& event);
118
119protected:
120 wxImageList* m_imageList;
121
122DECLARE_EVENT_TABLE()
22f3361e 123 DECLARE_NO_COPY_CLASS(wxTabCtrl)
2bda0e17
KB
124};
125
2b5f62a0 126class WXDLLEXPORT wxTabEvent : public wxNotifyEvent
2bda0e17 127{
2b5f62a0
VZ
128public:
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
145private:
146 int m_nSel, // currently selected page
147 m_nOldSel; // previously selected page
148
2eb10e2a 149 DECLARE_DYNAMIC_CLASS_NO_COPY(wxTabEvent)
2bda0e17
KB
150};
151
152typedef void (wxEvtHandler::*wxTabEventFunction)(wxTabEvent&);
153
2e4df4bf 154#define EVT_TAB_SEL_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGED, \
bfbb0b4c 155 id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL),
2e4df4bf 156#define EVT_TAB_SEL_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGING, \
bfbb0b4c 157 id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL),
2bda0e17
KB
158
159#endif
bbcdf8bc 160 // _WX_TABCTRL_H_