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
)
28 wxTabCtrl::wxTabCtrl()
33 bool wxTabCtrl::Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
,
34 long style
, const wxString
& name
)
36 m_macIsUserPane
= FALSE
;
38 if ( !wxControl::Create(parent
, id
, pos
, size
,
39 style
, wxDefaultValidator
, name
) )
44 Rect bounds
= wxMacGetBoundsForControl( this , pos
, size
) ;
46 UInt16 tabstyle
= kControlTabDirectionNorth
;
47 ControlTabSize tabsize
= kControlTabSizeLarge
;
48 if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL
)
49 tabsize
= kControlTabSizeSmall
;
50 else if ( GetWindowVariant() == wxWINDOW_VARIANT_MINI
)
52 if (UMAGetSystemVersion() >= 0x1030 )
55 tabsize
= kControlSizeSmall
;
58 m_peer
= new wxMacControl(this) ;
59 verify_noerr ( CreateTabsControl( MAC_WXHWND(parent
->MacGetTopLevelWindowRef()) , &bounds
,
60 tabsize
, tabstyle
, 0, NULL
, m_peer
->GetControlRefAddr() ) );
63 MacPostControlCreate(pos
,size
) ;
67 wxTabCtrl::~wxTabCtrl()
71 void wxTabCtrl::Command(wxCommandEvent
& event
)
76 bool wxTabCtrl::DeleteAllItems()
83 bool wxTabCtrl::DeleteItem(int item
)
90 int wxTabCtrl::GetSelection() const
96 // Get the tab with the current keyboard focus
97 int wxTabCtrl::GetCurFocus() const
103 // Get the associated image list
104 wxImageList
* wxTabCtrl::GetImageList() const
109 // Get the number of items
110 int wxTabCtrl::GetItemCount() const
116 // Get the rect corresponding to the tab
117 bool wxTabCtrl::GetItemRect(int item
, wxRect
& wxrect
) const
123 // Get the number of rows
124 int wxTabCtrl::GetRowCount() const
131 wxString
wxTabCtrl::GetItemText(int item
) const
134 return wxEmptyString
;
137 // Get the item image
138 int wxTabCtrl::GetItemImage(int item
) const
145 void* wxTabCtrl::GetItemData(int item
) const
152 int wxTabCtrl::HitTest(const wxPoint
& pt
, long& flags
)
159 bool wxTabCtrl::InsertItem(int item
, const wxString
& text
, int imageId
, void* data
)
166 int wxTabCtrl::SetSelection(int item
)
172 // Set the image list
173 void wxTabCtrl::SetImageList(wxImageList
* imageList
)
178 // Set the text for an item
179 bool wxTabCtrl::SetItemText(int item
, const wxString
& text
)
185 // Set the image for an item
186 bool wxTabCtrl::SetItemImage(int item
, int image
)
192 // Set the data for an item
193 bool wxTabCtrl::SetItemData(int item
, void* data
)
199 // Set the size for a fixed-width tab control
200 void wxTabCtrl::SetItemSize(const wxSize
& size
)
205 // Set the padding between tabs
206 void wxTabCtrl::SetPadding(const wxSize
& padding
)