]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/carbon/tabctrl.h
compilation fix: wxGenericCollapsiblePane needs wxButton and wxStaticLine
[wxWidgets.git] / include / wx / mac / carbon / tabctrl.h
CommitLineData
8cf73271
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: tabctrl.h
3// Purpose: wxTabCtrl class
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
7// RCS-ID: $Id$
8// Copyright: (c) Stefan Csomor
65571936 9// Licence: wxWindows licence
8cf73271
SC
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_TABCTRL_H_
13#define _WX_TABCTRL_H_
14
179e085f
RN
15#include "wx/control.h"
16
8cf73271
SC
17class wxImageList;
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
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 }
d3c7fc99 43 virtual ~wxTabCtrl();
8cf73271
SC
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 void Command(wxCommandEvent& event);
113
114protected:
115 wxImageList* m_imageList;
116
117DECLARE_EVENT_TABLE()
118};
119
5eee8dcf 120class WXDLLEXPORT wxTabEvent : public wxNotifyEvent
8cf73271 121{
5eee8dcf
SC
122public:
123 wxTabEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
124 int nSel = -1, int nOldSel = -1)
125 : wxNotifyEvent(commandType, id)
126 {
127 m_nSel = nSel;
128 m_nOldSel = nOldSel;
129 }
130
131 // accessors
132 // the currently selected page (-1 if none)
133 int GetSelection() const { return m_nSel; }
134 void SetSelection(int nSel) { m_nSel = nSel; }
135 // the page that was selected before the change (-1 if none)
136 int GetOldSelection() const { return m_nOldSel; }
137 void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; }
138
139private:
140 int m_nSel, // currently selected page
141 m_nOldSel; // previously selected page
142
143 DECLARE_DYNAMIC_CLASS_NO_COPY(wxTabEvent)
8cf73271
SC
144};
145
146typedef void (wxEvtHandler::*wxTabEventFunction)(wxTabEvent&);
147
5eee8dcf
SC
148#define EVT_TAB_SEL_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGED, \
149 id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL),
150#define EVT_TAB_SEL_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGING, \
151 id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL),
8cf73271
SC
152
153#endif
154 // _WX_TABCTRL_H_