1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "tabctrl.h"
16 #include "wx/wxprec.h"
18 #include "wx/control.h"
19 #include "wx/tabctrl.h"
20 #include "wx/mac/uma.h"
22 IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl
, wxControl
)
23 IMPLEMENT_DYNAMIC_CLASS(wxTabEvent
, wxNotifyEvent
)
25 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGED
)
26 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING
)
29 BEGIN_EVENT_TABLE(wxTabCtrl
, wxControl
)
32 wxTabCtrl::wxTabCtrl()
37 bool wxTabCtrl::Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
,
38 long style
, const wxString
& name
)
40 m_macIsUserPane
= FALSE
;
42 if ( !wxControl::Create(parent
, id
, pos
, size
,
43 style
, wxDefaultValidator
, name
) )
48 Rect bounds
= wxMacGetBoundsForControl( this , pos
, size
) ;
50 UInt16 tabstyle
= kControlTabDirectionNorth
;
51 ControlTabSize tabsize
= kControlTabSizeLarge
;
52 if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL
)
53 tabsize
= kControlTabSizeSmall
;
54 else if ( GetWindowVariant() == wxWINDOW_VARIANT_MINI
)
56 if (UMAGetSystemVersion() >= 0x1030 )
59 tabsize
= kControlSizeSmall
;
62 m_peer
= new wxMacControl(this) ;
63 verify_noerr ( CreateTabsControl( MAC_WXHWND(parent
->MacGetTopLevelWindowRef()) , &bounds
,
64 tabsize
, tabstyle
, 0, NULL
, m_peer
->GetControlRefAddr() ) );
67 MacPostControlCreate(pos
,size
) ;
71 wxTabCtrl::~wxTabCtrl()
75 void wxTabCtrl::Command(wxCommandEvent
& event
)
80 bool wxTabCtrl::DeleteAllItems()
87 bool wxTabCtrl::DeleteItem(int item
)
94 int wxTabCtrl::GetSelection() const
100 // Get the tab with the current keyboard focus
101 int wxTabCtrl::GetCurFocus() const
107 // Get the associated image list
108 wxImageList
* wxTabCtrl::GetImageList() const
113 // Get the number of items
114 int wxTabCtrl::GetItemCount() const
120 // Get the rect corresponding to the tab
121 bool wxTabCtrl::GetItemRect(int item
, wxRect
& wxrect
) const
127 // Get the number of rows
128 int wxTabCtrl::GetRowCount() const
135 wxString
wxTabCtrl::GetItemText(int item
) const
138 return wxEmptyString
;
141 // Get the item image
142 int wxTabCtrl::GetItemImage(int item
) const
149 void* wxTabCtrl::GetItemData(int item
) const
156 int wxTabCtrl::HitTest(const wxPoint
& pt
, long& flags
)
163 bool wxTabCtrl::InsertItem(int item
, const wxString
& text
, int imageId
, void* data
)
170 int wxTabCtrl::SetSelection(int item
)
176 // Set the image list
177 void wxTabCtrl::SetImageList(wxImageList
* imageList
)
182 // Set the text for an item
183 bool wxTabCtrl::SetItemText(int item
, const wxString
& text
)
189 // Set the image for an item
190 bool wxTabCtrl::SetItemImage(int item
, int image
)
196 // Set the data for an item
197 bool wxTabCtrl::SetItemData(int item
, void* data
)
203 // Set the size for a fixed-width tab control
204 void wxTabCtrl::SetItemSize(const wxSize
& size
)
209 // Set the padding between tabs
210 void wxTabCtrl::SetPadding(const wxSize
& padding
)