+#ifndef WX_PRECOMP
+ #include "wx/log.h"
+ #include "wx/app.h"
+#endif //WX_PRECOMP
+
+#include "wx/cocoa/string.h"
+#include "wx/cocoa/autorelease.h"
+#include "wx/cocoa/ObjcRef.h"
+#include "wx/cocoa/private/scrollview.h"
+#include "wx/cocoa/NSTableDataSource.h"
+
+#import <Foundation/NSArray.h>
+#import <Foundation/NSEnumerator.h>
+#import <AppKit/NSTableView.h>
+#import <AppKit/NSTableColumn.h>
+#import <AppKit/NSScrollView.h>
+#import <AppKit/NSCell.h>
+
+
+// ============================================================================
+// helper functions
+// ============================================================================
+
+static CGFloat _TableColumnMaxWidthForItems(NSTableColumn *tableColumn, NSArray *items)
+{
+ wxAutoNSAutoreleasePool pool;
+
+ NSCell *dataCell = [[[tableColumn dataCell] copy] autorelease];
+ CGFloat width = 0.0f;
+ NSEnumerator *itemEnum = [items objectEnumerator];
+ NSString *item;
+ while( (item = [itemEnum nextObject]) != nil )
+ {
+ [dataCell setStringValue: item];
+ NSSize itemSize = [dataCell cellSize];
+ CGFloat itemWidth = itemSize.width;
+ if(itemWidth > width)
+ width = itemWidth;
+ }
+ return width;
+}
+
+static void _SetWidthOfTableColumnToFitItems(NSTableColumn *tableColumn, NSArray *items)
+{
+ CGFloat width = _TableColumnMaxWidthForItems(tableColumn, items);
+ [tableColumn setWidth:width];
+ [tableColumn setMinWidth:width];
+}
+
+// ============================================================================
+// class wxListBox
+// ============================================================================