1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
16 #include "wx/control.h"
17 #include "wx/tabctrl.h"
18 #include "wx/mac/uma.h"
20 IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl
, wxControl
)
21 IMPLEMENT_DYNAMIC_CLASS(wxTabEvent
, wxNotifyEvent
)
23 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGED
)
24 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING
)
27 BEGIN_EVENT_TABLE(wxTabCtrl
, wxControl
)
31 wxTabCtrl::wxTabCtrl()
33 m_macIsUserPane
= false;
37 bool wxTabCtrl::Create( wxWindow
*parent
,
38 wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
,
39 long style
, const wxString
& name
)
41 m_macIsUserPane
= false;
44 if ( !wxControl::Create( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
) )
47 Rect bounds
= wxMacGetBoundsForControl( this, pos
, size
);
49 UInt16 tabstyle
= kControlTabDirectionNorth
;
50 ControlTabSize tabsize
= kControlTabSizeLarge
;
51 if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL
)
52 tabsize
= kControlTabSizeSmall
;
53 else if ( GetWindowVariant() == wxWINDOW_VARIANT_MINI
)
55 if (UMAGetSystemVersion() >= 0x1030 )
58 tabsize
= kControlSizeSmall
;
61 m_peer
= new wxMacControl( this );
62 OSStatus err
= CreateTabsControl(
63 MAC_WXHWND(parent
->MacGetTopLevelWindowRef()), &bounds
,
64 tabsize
, tabstyle
, 0, NULL
, m_peer
->GetControlRefAddr() );
67 MacPostControlCreate( pos
, size
);
72 wxTabCtrl::~wxTabCtrl()
76 void wxTabCtrl::Command(wxCommandEvent
& event
)
80 bool wxTabCtrl::DeleteAllItems()
86 bool wxTabCtrl::DeleteItem(int item
)
92 int wxTabCtrl::GetSelection() const
98 // Get the tab with the current keyboard focus
100 int wxTabCtrl::GetCurFocus() const
106 wxImageList
* wxTabCtrl::GetImageList() const
111 int wxTabCtrl::GetItemCount() const
117 // Get the rect corresponding to the tab
118 bool wxTabCtrl::GetItemRect(int item
, wxRect
& wxrect
) const
124 int wxTabCtrl::GetRowCount() const
130 wxString
wxTabCtrl::GetItemText(int item
) const
133 return wxEmptyString
;
136 int wxTabCtrl::GetItemImage(int item
) const
142 void* wxTabCtrl::GetItemData(int item
) const
148 int wxTabCtrl::HitTest(const wxPoint
& pt
, long& flags
)
154 bool wxTabCtrl::InsertItem(int item
, const wxString
& text
, int imageId
, void* data
)
160 int wxTabCtrl::SetSelection(int item
)
166 void wxTabCtrl::SetImageList(wxImageList
* imageList
)
171 bool wxTabCtrl::SetItemText(int item
, const wxString
& text
)
177 bool wxTabCtrl::SetItemImage(int item
, int image
)
183 bool wxTabCtrl::SetItemData(int item
, void* data
)
189 // Set the size for a fixed-width tab control
190 void wxTabCtrl::SetItemSize(const wxSize
& size
)
195 // Set the padding between tabs
196 void wxTabCtrl::SetPadding(const wxSize
& padding
)
201 #endif // wxUSE_TAB_DIALOG