]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/tabctrl.cpp
Column position changes after each delete, so always delete the 0 column.
[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 if (UMAGetSystemVersion() >= 0x1030 )
60 tabsize = 3 ;
61 else
62 tabsize = kControlSizeSmall;
63 }
64
65 m_peer = new wxMacControl( this );
66 OSStatus err = CreateTabsControl(
67 MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
68 tabsize, tabstyle, 0, NULL, m_peer->GetControlRefAddr() );
69 verify_noerr( err );
70
71 MacPostControlCreate( pos, size );
72
73 return true;
74 }
75
76 wxTabCtrl::~wxTabCtrl()
77 {
78 }
79
80 void wxTabCtrl::Command(wxCommandEvent& event)
81 {
82 }
83
84 bool wxTabCtrl::DeleteAllItems()
85 {
86 // TODO:
87 return false;
88 }
89
90 bool wxTabCtrl::DeleteItem(int item)
91 {
92 // TODO:
93 return false;
94 }
95
96 int wxTabCtrl::GetSelection() const
97 {
98 // TODO:
99 return 0;
100 }
101
102 // Get the tab with the current keyboard focus
103 //
104 int wxTabCtrl::GetCurFocus() const
105 {
106 // TODO:
107 return 0;
108 }
109
110 wxImageList * wxTabCtrl::GetImageList() const
111 {
112 return m_imageList;
113 }
114
115 int wxTabCtrl::GetItemCount() const
116 {
117 // TODO:
118 return 0;
119 }
120
121 // Get the rect corresponding to the tab
122 bool wxTabCtrl::GetItemRect(int item, wxRect& wxrect) const
123 {
124 // TODO:
125 return false;
126 }
127
128 int wxTabCtrl::GetRowCount() const
129 {
130 // TODO:
131 return 0;
132 }
133
134 wxString wxTabCtrl::GetItemText(int item) const
135 {
136 // TODO:
137 return wxEmptyString;
138 }
139
140 int wxTabCtrl::GetItemImage(int item) const
141 {
142 // TODO:
143 return 0;
144 }
145
146 void* wxTabCtrl::GetItemData(int item) const
147 {
148 // TODO:
149 return NULL;
150 }
151
152 int wxTabCtrl::HitTest(const wxPoint& pt, long& flags)
153 {
154 // TODO:
155 return 0;
156 }
157
158 bool wxTabCtrl::InsertItem(int item, const wxString& text, int imageId, void* data)
159 {
160 // TODO:
161 return false;
162 }
163
164 int wxTabCtrl::SetSelection(int item)
165 {
166 // TODO:
167 return 0;
168 }
169
170 void wxTabCtrl::SetImageList(wxImageList* imageList)
171 {
172 // TODO:
173 }
174
175 bool wxTabCtrl::SetItemText(int item, const wxString& text)
176 {
177 // TODO:
178 return false;
179 }
180
181 bool wxTabCtrl::SetItemImage(int item, int image)
182 {
183 // TODO:
184 return false;
185 }
186
187 bool wxTabCtrl::SetItemData(int item, void* data)
188 {
189 // TODO:
190 return false;
191 }
192
193 // Set the size for a fixed-width tab control
194 void wxTabCtrl::SetItemSize(const wxSize& size)
195 {
196 // TODO:
197 }
198
199 // Set the padding between tabs
200 void wxTabCtrl::SetPadding(const wxSize& padding)
201 {
202 // TODO:
203 }
204
205 #endif // wxUSE_TAB_DIALOG