1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/carbon/tabctrl.cpp
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
16 #include "wx/tabctrl.h"
19 #include "wx/control.h"
22 #include "wx/mac/uma.h"
24 IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl
, wxControl
)
25 IMPLEMENT_DYNAMIC_CLASS(wxTabEvent
, wxNotifyEvent
)
27 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGED
)
28 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING
)
31 BEGIN_EVENT_TABLE(wxTabCtrl
, wxControl
)
35 wxTabCtrl::wxTabCtrl()
37 m_macIsUserPane
= false;
41 bool wxTabCtrl::Create( wxWindow
*parent
,
42 wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
,
43 long style
, const wxString
& name
)
45 m_macIsUserPane
= false;
48 if ( !wxControl::Create( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
) )
51 Rect bounds
= wxMacGetBoundsForControl( this, pos
, size
);
53 UInt16 tabstyle
= kControlTabDirectionNorth
;
54 ControlTabSize tabsize
= kControlTabSizeLarge
;
55 if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL
)
56 tabsize
= kControlTabSizeSmall
;
57 else if ( GetWindowVariant() == wxWINDOW_VARIANT_MINI
)
59 if (UMAGetSystemVersion() >= 0x1030 )
62 tabsize
= kControlSizeSmall
;
65 m_peer
= new wxMacControl( this );
66 OSStatus err
= CreateTabsControl(
67 MAC_WXHWND(parent
->MacGetTopLevelWindowRef()), &bounds
,
68 tabsize
, tabstyle
, 0, NULL
, m_peer
->GetControlRefAddr() );
71 MacPostControlCreate( pos
, size
);
76 wxTabCtrl::~wxTabCtrl()
80 void wxTabCtrl::Command(wxCommandEvent
& event
)
84 bool wxTabCtrl::DeleteAllItems()
90 bool wxTabCtrl::DeleteItem(int item
)
96 int wxTabCtrl::GetSelection() const
102 // Get the tab with the current keyboard focus
104 int wxTabCtrl::GetCurFocus() const
110 wxImageList
* wxTabCtrl::GetImageList() const
115 int wxTabCtrl::GetItemCount() const
121 // Get the rect corresponding to the tab
122 bool wxTabCtrl::GetItemRect(int item
, wxRect
& wxrect
) const
128 int wxTabCtrl::GetRowCount() const
134 wxString
wxTabCtrl::GetItemText(int item
) const
137 return wxEmptyString
;
140 int wxTabCtrl::GetItemImage(int item
) const
146 void* wxTabCtrl::GetItemData(int item
) const
152 int wxTabCtrl::HitTest(const wxPoint
& pt
, long& flags
)
158 bool wxTabCtrl::InsertItem(int item
, const wxString
& text
, int imageId
, void* data
)
164 int wxTabCtrl::SetSelection(int item
)
170 void wxTabCtrl::SetImageList(wxImageList
* imageList
)
175 bool wxTabCtrl::SetItemText(int item
, const wxString
& text
)
181 bool wxTabCtrl::SetItemImage(int item
, int image
)
187 bool wxTabCtrl::SetItemData(int item
, void* data
)
193 // Set the size for a fixed-width tab control
194 void wxTabCtrl::SetItemSize(const wxSize
& size
)
199 // Set the padding between tabs
200 void wxTabCtrl::SetPadding(const wxSize
& padding
)
205 #endif // wxUSE_TAB_DIALOG