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
This commit is contained in:
David Elliott
2008-02-18 21:26:51 +00:00
parent 580cc1eb85
commit 861b3043ca
2 changed files with 7 additions and 24 deletions

View File

@@ -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
// ------------------------------------------------------------------------

View File

@@ -33,23 +33,6 @@
#import <AppKit/NSScrollView.h>
#import <AppKit/NSCell.h>
// ============================================================================
// @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<wxCocoaListBoxNSTableDataSource*>(m_cocoaDataSource)->m_needsUpdate;
return m_needsUpdate;
}
void wxListBox::_WxCocoa_SetNeedsUpdate(bool needsUpdate)
{
static_cast<wxCocoaListBoxNSTableDataSource*>(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);