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