1 ///////////////////////////////////////////////////////////////////////////// 
   2 // Name:        src/mac/carbon/tabctrl.cpp 
   4 // Author:      Stefan Csomor 
   8 // Copyright:   (c) Stefan Csomor 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  12 #include "wx/wxprec.h" 
  16 #include "wx/tabctrl.h" 
  19     #include "wx/control.h" 
  22 #include "wx/mac/uma.h" 
  24 IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl
, wxControl
) 
  25 IMPLEMENT_DYNAMIC_CLASS(wxTabEvent
, wxNotifyEvent
) 
  27 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGED
) 
  28 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING
) 
  31 BEGIN_EVENT_TABLE(wxTabCtrl
, wxControl
) 
  35 wxTabCtrl::wxTabCtrl() 
  37     m_macIsUserPane 
= false; 
  41 bool wxTabCtrl::Create( wxWindow 
*parent
, 
  42     wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, 
  43     long style
, const wxString
& name 
) 
  45     m_macIsUserPane 
= false; 
  48     if ( !wxControl::Create( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name 
) ) 
  51     Rect bounds 
= wxMacGetBoundsForControl( this, pos
, size 
); 
  53     UInt16 tabstyle 
= kControlTabDirectionNorth
; 
  54     ControlTabSize tabsize 
= kControlTabSizeLarge
; 
  55     if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL 
) 
  56         tabsize 
= kControlTabSizeSmall 
; 
  57     else if ( GetWindowVariant() == wxWINDOW_VARIANT_MINI 
) 
  62     m_peer 
= new wxMacControl( this ); 
  63     OSStatus err 
= CreateTabsControl( 
  64         MAC_WXHWND(parent
->MacGetTopLevelWindowRef()), &bounds
, 
  65         tabsize
, tabstyle
, 0, NULL
, m_peer
->GetControlRefAddr() ); 
  68     MacPostControlCreate( pos
, size 
); 
  73 wxTabCtrl::~wxTabCtrl() 
  77 void wxTabCtrl::Command(wxCommandEvent
& event
) 
  81 bool wxTabCtrl::DeleteAllItems() 
  87 bool wxTabCtrl::DeleteItem(int item
) 
  93 int wxTabCtrl::GetSelection() const 
  99 // Get the tab with the current keyboard focus 
 101 int wxTabCtrl::GetCurFocus() const 
 107 wxImageList 
* wxTabCtrl::GetImageList() const 
 112 int wxTabCtrl::GetItemCount() const 
 118 // Get the rect corresponding to the tab 
 119 bool wxTabCtrl::GetItemRect(int item
, wxRect
& wxrect
) const 
 125 int wxTabCtrl::GetRowCount() const 
 131 wxString 
wxTabCtrl::GetItemText(int item
) const 
 134     return wxEmptyString
; 
 137 int wxTabCtrl::GetItemImage(int item
) const 
 143 void* wxTabCtrl::GetItemData(int item
) const 
 149 int wxTabCtrl::HitTest(const wxPoint
& pt
, long& flags
) 
 155 bool wxTabCtrl::InsertItem(int item
, const wxString
& text
, int imageId
, void* data
) 
 161 int wxTabCtrl::SetSelection(int item
) 
 167 void wxTabCtrl::SetImageList(wxImageList
* imageList
) 
 172 bool wxTabCtrl::SetItemText(int item
, const wxString
& text
) 
 178 bool wxTabCtrl::SetItemImage(int item
, int image
) 
 184 bool wxTabCtrl::SetItemData(int item
, void* data
) 
 190 // Set the size for a fixed-width tab control 
 191 void wxTabCtrl::SetItemSize(const wxSize
& size
) 
 196 // Set the padding between tabs 
 197 void wxTabCtrl::SetPadding(const wxSize
& padding
) 
 202 #endif // wxUSE_TAB_DIALOG