From: David Elliott Date: Mon, 18 Feb 2008 21:26:51 +0000 (+0000) Subject: Revert the 2.8 hacks from r51892 on the trunk. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/861b3043ca08b53d6110fd2c95c70ca5e9d25885?hp=580cc1eb856780d56396da36a9f0f5826638ba3a Revert the 2.8 hacks from r51892 on the trunk. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51893 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/cocoa/listbox.h b/include/wx/cocoa/listbox.h index 855ee09fc8..d7bae5cb52 100644 --- a/include/wx/cocoa/listbox.h +++ b/include/wx/cocoa/listbox.h @@ -76,9 +76,10 @@ protected: WX_NSMutableArray m_cocoaItems; wxArrayPtrVoid m_itemClientData; struct objc_object *m_cocoaDataSource; + bool m_needsUpdate; inline bool _WxCocoa_GetNeedsUpdate(); inline void _WxCocoa_SetNeedsUpdate(bool needsUpdate); - void _WxCocoa_OnIdle(wxIdleEvent &event); + virtual void OnInternalIdle(); // ------------------------------------------------------------------------ // Implementation // ------------------------------------------------------------------------ diff --git a/src/cocoa/listbox.mm b/src/cocoa/listbox.mm index 50b5c79472..969dff9445 100644 --- a/src/cocoa/listbox.mm +++ b/src/cocoa/listbox.mm @@ -33,23 +33,6 @@ #import #import -// ============================================================================ -// @class wxCocoaListBoxNSTableDataSource -// ============================================================================ -// 2.8 hack: We can't add an i-var to wxListBox so we add one here -@interface wxCocoaListBoxNSTableDataSource : wxCocoaNSTableDataSource -{ - BOOL m_needsUpdate; -} - -@end -WX_DECLARE_GET_OBJC_CLASS(wxCocoaListBoxNSTableDataSource,wxCocoaNSTableDataSource) - -@implementation wxCocoaListBoxNSTableDataSource -// No methods -@end -WX_IMPLEMENT_GET_OBJC_CLASS_WITH_UNIQUIFIED_SUPERCLASS(wxCocoaListBoxNSTableDataSource,wxCocoaNSTableDataSource) - // ============================================================================ // helper functions @@ -87,7 +70,6 @@ static void _SetWidthOfTableColumnToFitItems(NSTableColumn *tableColumn, NSArray IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControlWithItems) BEGIN_EVENT_TABLE(wxListBox, wxListBoxBase) - EVT_IDLE(wxListBox::_WxCocoa_OnIdle) END_EVENT_TABLE() WX_IMPLEMENT_COCOA_OWNER(wxListBox,NSTableView,NSControl,NSView) @@ -155,7 +137,7 @@ The listbox contents are sorted in alphabetical order. [GetNSTableView() setHeaderView: nil]; // Set up the data source - m_cocoaDataSource = [[WX_GET_OBJC_CLASS(wxCocoaListBoxNSTableDataSource) alloc] init]; + m_cocoaDataSource = [[WX_GET_OBJC_CLASS(wxCocoaNSTableDataSource) alloc] init]; [GetNSTableView() setDataSource:m_cocoaDataSource]; // Add the single column @@ -202,17 +184,17 @@ wxListBox::~wxListBox() bool wxListBox::_WxCocoa_GetNeedsUpdate() { - return static_cast(m_cocoaDataSource)->m_needsUpdate; + return m_needsUpdate; } void wxListBox::_WxCocoa_SetNeedsUpdate(bool needsUpdate) { - static_cast(m_cocoaDataSource)->m_needsUpdate = needsUpdate; + m_needsUpdate = needsUpdate; } -void wxListBox::_WxCocoa_OnIdle(wxIdleEvent &event) +void wxListBox::OnInternalIdle() { - event.Skip(); + wxControlWithItems::OnInternalIdle(); if(_WxCocoa_GetNeedsUpdate()) { _SetWidthOfTableColumnToFitItems([[GetNSTableView() tableColumns] objectAtIndex:0], m_cocoaItems);