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