1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
14 #include "wx/control.h"
15 #include "wx/tabctrl.h"
16 #include "wx/mac/uma.h"
18 IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl
, wxControl
)
19 IMPLEMENT_DYNAMIC_CLASS(wxTabEvent
, wxNotifyEvent
)
21 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGED
)
22 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING
)
25 BEGIN_EVENT_TABLE(wxTabCtrl
, wxControl
)
29 wxTabCtrl::wxTabCtrl()
31 m_macIsUserPane
= false;
35 bool wxTabCtrl::Create( wxWindow
*parent
,
36 wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
,
37 long style
, const wxString
& name
)
39 m_macIsUserPane
= false;
42 if ( !wxControl::Create( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
) )
45 Rect bounds
= wxMacGetBoundsForControl( this, pos
, size
);
47 UInt16 tabstyle
= kControlTabDirectionNorth
;
48 ControlTabSize tabsize
= kControlTabSizeLarge
;
49 if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL
)
50 tabsize
= kControlTabSizeSmall
;
51 else if ( GetWindowVariant() == wxWINDOW_VARIANT_MINI
)
53 if (UMAGetSystemVersion() >= 0x1030 )
56 tabsize
= kControlSizeSmall
;
59 m_peer
= new wxMacControl( this );
60 OSStatus err
= CreateTabsControl(
61 MAC_WXHWND(parent
->MacGetTopLevelWindowRef()), &bounds
,
62 tabsize
, tabstyle
, 0, NULL
, m_peer
->GetControlRefAddr() );
65 MacPostControlCreate( pos
, size
);
70 wxTabCtrl::~wxTabCtrl()
74 void wxTabCtrl::Command(wxCommandEvent
& event
)
78 bool wxTabCtrl::DeleteAllItems()
84 bool wxTabCtrl::DeleteItem(int item
)
90 int wxTabCtrl::GetSelection() const
96 // Get the tab with the current keyboard focus
98 int wxTabCtrl::GetCurFocus() const
104 wxImageList
* wxTabCtrl::GetImageList() const
109 int wxTabCtrl::GetItemCount() const
115 // Get the rect corresponding to the tab
116 bool wxTabCtrl::GetItemRect(int item
, wxRect
& wxrect
) const
122 int wxTabCtrl::GetRowCount() const
128 wxString
wxTabCtrl::GetItemText(int item
) const
131 return wxEmptyString
;
134 int wxTabCtrl::GetItemImage(int item
) const
140 void* wxTabCtrl::GetItemData(int item
) const
146 int wxTabCtrl::HitTest(const wxPoint
& pt
, long& flags
)
152 bool wxTabCtrl::InsertItem(int item
, const wxString
& text
, int imageId
, void* data
)
158 int wxTabCtrl::SetSelection(int item
)
164 void wxTabCtrl::SetImageList(wxImageList
* imageList
)
169 bool wxTabCtrl::SetItemText(int item
, const wxString
& text
)
175 bool wxTabCtrl::SetItemImage(int item
, int image
)
181 bool wxTabCtrl::SetItemData(int item
, void* data
)
187 // Set the size for a fixed-width tab control
188 void wxTabCtrl::SetItemSize(const wxSize
& size
)
193 // Set the padding between tabs
194 void wxTabCtrl::SetPadding(const wxSize
& padding
)