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 m_peer
= new wxMacControl() ;
60 verify_noerr ( CreateTabsControl( MAC_WXHWND(parent
->MacGetTopLevelWindowRef()) , &bounds
,
61 tabsize
, tabstyle
, 0, NULL
, *m_peer
) );
64 MacPostControlCreate(pos
,size
) ;
68 wxTabCtrl::~wxTabCtrl()
72 void wxTabCtrl::Command(wxCommandEvent
& event
)
77 bool wxTabCtrl::DeleteAllItems()
84 bool wxTabCtrl::DeleteItem(int item
)
91 int wxTabCtrl::GetSelection() const
97 // Get the tab with the current keyboard focus
98 int wxTabCtrl::GetCurFocus() const
104 // Get the associated image list
105 wxImageList
* wxTabCtrl::GetImageList() const
110 // Get the number of items
111 int wxTabCtrl::GetItemCount() const
117 // Get the rect corresponding to the tab
118 bool wxTabCtrl::GetItemRect(int item
, wxRect
& wxrect
) const
124 // Get the number of rows
125 int wxTabCtrl::GetRowCount() const
132 wxString
wxTabCtrl::GetItemText(int item
) const
135 return wxEmptyString
;
138 // Get the item image
139 int wxTabCtrl::GetItemImage(int item
) const
146 void* wxTabCtrl::GetItemData(int item
) const
153 int wxTabCtrl::HitTest(const wxPoint
& pt
, long& flags
)
160 bool wxTabCtrl::InsertItem(int item
, const wxString
& text
, int imageId
, void* data
)
167 int wxTabCtrl::SetSelection(int item
)
173 // Set the image list
174 void wxTabCtrl::SetImageList(wxImageList
* imageList
)
179 // Set the text for an item
180 bool wxTabCtrl::SetItemText(int item
, const wxString
& text
)
186 // Set the image for an item
187 bool wxTabCtrl::SetItemImage(int item
, int image
)
193 // Set the data for an item
194 bool wxTabCtrl::SetItemData(int item
, void* data
)
200 // Set the size for a fixed-width tab control
201 void wxTabCtrl::SetItemSize(const wxSize
& size
)
206 // Set the padding between tabs
207 void wxTabCtrl::SetPadding(const wxSize
& padding
)
213 IMPLEMENT_DYNAMIC_CLASS(wxTabEvent
, wxCommandEvent
)
215 wxTabEvent::wxTabEvent(wxEventType commandType
, int id
):
216 wxCommandEvent(commandType
, id
)