]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/tabctrl.cpp
don't call TB_GETITEMRECT with invalid tool index
[wxWidgets.git] / src / mac / carbon / tabctrl.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/carbon/tabctrl.cpp
3 // Purpose: wxTabCtrl
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #if wxUSE_TAB_DIALOG
15
16 #include "wx/tabctrl.h"
17
18 #ifndef WX_PRECOMP
19 #include "wx/control.h"
20 #endif
21
22 #include "wx/mac/uma.h"
23
24 IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl, wxControl)
25 IMPLEMENT_DYNAMIC_CLASS(wxTabEvent, wxNotifyEvent)
26
27 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGED)
28 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING)
29
30
31 BEGIN_EVENT_TABLE(wxTabCtrl, wxControl)
32 END_EVENT_TABLE()
33
34
35 wxTabCtrl::wxTabCtrl()
36 {
37 m_macIsUserPane = false;
38 m_imageList = NULL;
39 }
40
41 bool wxTabCtrl::Create( wxWindow *parent,
42 wxWindowID id, const wxPoint& pos, const wxSize& size,
43 long style, const wxString& name )
44 {
45 m_macIsUserPane = false;
46 m_imageList = NULL;
47
48 if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) )
49 return false;
50
51 Rect bounds = wxMacGetBoundsForControl( this, pos, size );
52
53 UInt16 tabstyle = kControlTabDirectionNorth;
54 ControlTabSize tabsize = kControlTabSizeLarge;
55 if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL )
56 tabsize = kControlTabSizeSmall ;
57 else if ( GetWindowVariant() == wxWINDOW_VARIANT_MINI )
58 {
59 tabsize = 3 ;
60 }
61
62 m_peer = new wxMacControl( this );
63 OSStatus err = CreateTabsControl(
64 MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
65 tabsize, tabstyle, 0, NULL, m_peer->GetControlRefAddr() );
66 verify_noerr( err );
67
68 MacPostControlCreate( pos, size );
69
70 return true;
71 }
72
73 wxTabCtrl::~wxTabCtrl()
74 {
75 }
76
77 void wxTabCtrl::Command(wxCommandEvent& event)
78 {
79 }
80
81 bool wxTabCtrl::DeleteAllItems()
82 {
83 // TODO:
84 return false;
85 }
86
87 bool wxTabCtrl::DeleteItem(int item)
88 {
89 // TODO:
90 return false;
91 }
92
93 int wxTabCtrl::GetSelection() const
94 {
95 // TODO:
96 return 0;
97 }
98
99 // Get the tab with the current keyboard focus
100 //
101 int wxTabCtrl::GetCurFocus() const
102 {
103 // TODO:
104 return 0;
105 }
106
107 wxImageList * wxTabCtrl::GetImageList() const
108 {
109 return m_imageList;
110 }
111
112 int wxTabCtrl::GetItemCount() const
113 {
114 // TODO:
115 return 0;
116 }
117
118 // Get the rect corresponding to the tab
119 bool wxTabCtrl::GetItemRect(int item, wxRect& wxrect) const
120 {
121 // TODO:
122 return false;
123 }
124
125 int wxTabCtrl::GetRowCount() const
126 {
127 // TODO:
128 return 0;
129 }
130
131 wxString wxTabCtrl::GetItemText(int item) const
132 {
133 // TODO:
134 return wxEmptyString;
135 }
136
137 int wxTabCtrl::GetItemImage(int item) const
138 {
139 // TODO:
140 return 0;
141 }
142
143 void* wxTabCtrl::GetItemData(int item) const
144 {
145 // TODO:
146 return NULL;
147 }
148
149 int wxTabCtrl::HitTest(const wxPoint& pt, long& flags)
150 {
151 // TODO:
152 return 0;
153 }
154
155 bool wxTabCtrl::InsertItem(int item, const wxString& text, int imageId, void* data)
156 {
157 // TODO:
158 return false;
159 }
160
161 int wxTabCtrl::SetSelection(int item)
162 {
163 // TODO:
164 return 0;
165 }
166
167 void wxTabCtrl::SetImageList(wxImageList* imageList)
168 {
169 // TODO:
170 }
171
172 bool wxTabCtrl::SetItemText(int item, const wxString& text)
173 {
174 // TODO:
175 return false;
176 }
177
178 bool wxTabCtrl::SetItemImage(int item, int image)
179 {
180 // TODO:
181 return false;
182 }
183
184 bool wxTabCtrl::SetItemData(int item, void* data)
185 {
186 // TODO:
187 return false;
188 }
189
190 // Set the size for a fixed-width tab control
191 void wxTabCtrl::SetItemSize(const wxSize& size)
192 {
193 // TODO:
194 }
195
196 // Set the padding between tabs
197 void wxTabCtrl::SetPadding(const wxSize& padding)
198 {
199 // TODO:
200 }
201
202 #endif // wxUSE_TAB_DIALOG