1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "tabctrl.h"
18 #include "wx/control.h"
19 #include "wx/tabctrl.h"
20 #include "wx/mac/uma.h"
22 #if !USE_SHARED_LIBRARY
23 IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl
, wxControl
)
25 BEGIN_EVENT_TABLE(wxTabCtrl
, wxControl
)
29 wxTabCtrl::wxTabCtrl()
34 bool wxTabCtrl::Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
,
35 long style
, const wxString
& name
)
37 m_macIsUserPane
= FALSE
;
39 if ( !wxControl::Create(parent
, id
, pos
, size
,
40 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 verify_noerr ( CreateTabsControl( MAC_WXHWND(parent
->MacGetTopLevelWindowRef()) , &bounds
,
60 tabsize
, tabstyle
, 0, NULL
, (ControlRef
*) &m_macControl
) );
62 MacPostControlCreate(pos
,size
) ;
66 wxTabCtrl::~wxTabCtrl()
70 void wxTabCtrl::Command(wxCommandEvent
& event
)
75 bool wxTabCtrl::DeleteAllItems()
82 bool wxTabCtrl::DeleteItem(int item
)
89 int wxTabCtrl::GetSelection() const
95 // Get the tab with the current keyboard focus
96 int wxTabCtrl::GetCurFocus() const
102 // Get the associated image list
103 wxImageList
* wxTabCtrl::GetImageList() const
108 // Get the number of items
109 int wxTabCtrl::GetItemCount() const
115 // Get the rect corresponding to the tab
116 bool wxTabCtrl::GetItemRect(int item
, wxRect
& wxrect
) const
122 // Get the number of rows
123 int wxTabCtrl::GetRowCount() const
130 wxString
wxTabCtrl::GetItemText(int item
) const
133 return wxEmptyString
;
136 // Get the item image
137 int wxTabCtrl::GetItemImage(int item
) const
144 void* wxTabCtrl::GetItemData(int item
) const
151 int wxTabCtrl::HitTest(const wxPoint
& pt
, long& flags
)
158 bool wxTabCtrl::InsertItem(int item
, const wxString
& text
, int imageId
, void* data
)
165 int wxTabCtrl::SetSelection(int item
)
171 // Set the image list
172 void wxTabCtrl::SetImageList(wxImageList
* imageList
)
177 // Set the text for an item
178 bool wxTabCtrl::SetItemText(int item
, const wxString
& text
)
184 // Set the image for an item
185 bool wxTabCtrl::SetItemImage(int item
, int image
)
191 // Set the data for an item
192 bool wxTabCtrl::SetItemData(int item
, void* data
)
198 // Set the size for a fixed-width tab control
199 void wxTabCtrl::SetItemSize(const wxSize
& size
)
204 // Set the padding between tabs
205 void wxTabCtrl::SetPadding(const wxSize
& padding
)
211 IMPLEMENT_DYNAMIC_CLASS(wxTabEvent
, wxCommandEvent
)
213 wxTabEvent::wxTabEvent(wxEventType commandType
, int id
):
214 wxCommandEvent(commandType
, id
)