X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/76a5e5d21ee1a6230d777ce0209b2df4c6075f0f..59022c25c19cd7eb56b2405a58010df5d0b73eb6:/src/mac/carbon/tabctrl.cpp diff --git a/src/mac/carbon/tabctrl.cpp b/src/mac/carbon/tabctrl.cpp index db1992be6e..bd557b762d 100644 --- a/src/mac/carbon/tabctrl.cpp +++ b/src/mac/carbon/tabctrl.cpp @@ -1,51 +1,73 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: tabctrl.cpp +// Name: src/mac/carbon/tabctrl.cpp // Purpose: wxTabCtrl -// Author: AUTHOR +// Author: Stefan Csomor // Modified by: -// Created: ??/??/98 +// Created: 1998-01-01 // RCS-ID: $Id$ -// Copyright: (c) AUTHOR -// Licence: wxWindows licence +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation "tabctrl.h" -#endif +#include "wx/wxprec.h" -#include "wx/defs.h" +#if wxUSE_TAB_DIALOG -#include "wx/control.h" #include "wx/tabctrl.h" + +#ifndef WX_PRECOMP + #include "wx/control.h" +#endif + #include "wx/mac/uma.h" -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl, wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxTabEvent, wxNotifyEvent) + +DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGED) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING) + BEGIN_EVENT_TABLE(wxTabCtrl, wxControl) END_EVENT_TABLE() -#endif + wxTabCtrl::wxTabCtrl() { + m_macIsUserPane = false; m_imageList = NULL; } -bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, - long style, const wxString& name) +bool wxTabCtrl::Create( wxWindow *parent, + wxWindowID id, const wxPoint& pos, const wxSize& size, + long style, const wxString& name ) { - Rect bounds ; - Str255 title ; + m_macIsUserPane = false; + m_imageList = NULL; - m_imageList = NULL; - - MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ; + if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) ) + return false; - m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, - kControlTabSmallProc , (long) this ) ; - - MacPostControlCreate() ; - return TRUE ; + Rect bounds = wxMacGetBoundsForControl( this, pos, size ); + + UInt16 tabstyle = kControlTabDirectionNorth; + ControlTabSize tabsize = kControlTabSizeLarge; + if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL ) + tabsize = kControlTabSizeSmall ; + else if ( GetWindowVariant() == wxWINDOW_VARIANT_MINI ) + { + tabsize = 3 ; + } + + m_peer = new wxMacControl( this ); + OSStatus err = CreateTabsControl( + MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, + tabsize, tabstyle, 0, NULL, m_peer->GetControlRefAddr() ); + verify_noerr( err ); + + MacPostControlCreate( pos, size ); + + return true; } wxTabCtrl::~wxTabCtrl() @@ -56,147 +78,125 @@ void wxTabCtrl::Command(wxCommandEvent& event) { } -// Delete all items bool wxTabCtrl::DeleteAllItems() { - // TODO - return FALSE; + // TODO: + return false; } -// Delete an item bool wxTabCtrl::DeleteItem(int item) { - // TODO - return FALSE; + // TODO: + return false; } -// Get the selection int wxTabCtrl::GetSelection() const { - // TODO + // TODO: return 0; } // Get the tab with the current keyboard focus +// int wxTabCtrl::GetCurFocus() const { - // TODO + // TODO: return 0; } -// Get the associated image list -wxImageList* wxTabCtrl::GetImageList() const +wxImageList * wxTabCtrl::GetImageList() const { return m_imageList; } -// Get the number of items int wxTabCtrl::GetItemCount() const { - // TODO + // TODO: return 0; } // Get the rect corresponding to the tab bool wxTabCtrl::GetItemRect(int item, wxRect& wxrect) const { - // TODO - return FALSE; + // TODO: + return false; } -// Get the number of rows int wxTabCtrl::GetRowCount() const { - // TODO + // TODO: return 0; } -// Get the item text wxString wxTabCtrl::GetItemText(int item) const { - // TODO - return wxString(""); + // TODO: + return wxEmptyString; } -// Get the item image int wxTabCtrl::GetItemImage(int item) const { - // TODO + // TODO: return 0; } -// Get the item data void* wxTabCtrl::GetItemData(int item) const { - // TODO + // TODO: return NULL; } -// Hit test int wxTabCtrl::HitTest(const wxPoint& pt, long& flags) { - // TODO + // TODO: return 0; } -// Insert an item bool wxTabCtrl::InsertItem(int item, const wxString& text, int imageId, void* data) { - // TODO - return FALSE; + // TODO: + return false; } -// Set the selection int wxTabCtrl::SetSelection(int item) { - // TODO + // TODO: return 0; } -// Set the image list void wxTabCtrl::SetImageList(wxImageList* imageList) { - // TODO + // TODO: } -// Set the text for an item bool wxTabCtrl::SetItemText(int item, const wxString& text) { - // TODO - return FALSE; + // TODO: + return false; } -// Set the image for an item bool wxTabCtrl::SetItemImage(int item, int image) { - // TODO - return FALSE; + // TODO: + return false; } -// Set the data for an item bool wxTabCtrl::SetItemData(int item, void* data) { - // TODO - return FALSE; + // TODO: + return false; } // Set the size for a fixed-width tab control void wxTabCtrl::SetItemSize(const wxSize& size) { - // TODO + // TODO: } // Set the padding between tabs void wxTabCtrl::SetPadding(const wxSize& padding) { - // TODO -} - -// Tab event -IMPLEMENT_DYNAMIC_CLASS(wxTabEvent, wxCommandEvent) - -wxTabEvent::wxTabEvent(wxEventType commandType, int id): - wxCommandEvent(commandType, id) -{ + // TODO: } +#endif // wxUSE_TAB_DIALOG