+
+#include "wx/cocoa/objc/objc_uniquifying.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/window.h"
+ #include "wx/log.h"
+ #include "wx/app.h"
+#endif // WX_PRECOMP
+
+#import <AppKit/NSComboBox.h>
+#import <Foundation/NSNotification.h>
+#import <Foundation/NSString.h>
+
+// ----------------------------------------------------------------------------
+// globals
+// ----------------------------------------------------------------------------
+WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSComboBox)
+
+void wxCocoaNSComboBox::AssociateNSComboBox(WX_NSComboBox cocoaNSComboBox)
+{
+ if(cocoaNSComboBox)
+ {
+ sm_cocoaHash.insert(wxCocoaNSComboBoxHash::value_type(cocoaNSComboBox,this));
+
+ [[NSNotificationCenter defaultCenter] addObserver:(id)cocoaNSComboBox selector:@selector(comboBoxSelectionDidChange:) name:@"NSComboBoxSelectionDidChangeNotification" object:cocoaNSComboBox];
+ [[NSNotificationCenter defaultCenter] addObserver:(id)cocoaNSComboBox selector:@selector(comboBoxSelectionDidChange:) name:@"NSComboBoxSelectionIsChangingNotification" object:cocoaNSComboBox];
+ [[NSNotificationCenter defaultCenter] addObserver:(id)cocoaNSComboBox selector:@selector(comboBoxSelectionDidChange:) name:@"NSComboBoxWillDismissNotification" object:cocoaNSComboBox];
+ [[NSNotificationCenter defaultCenter] addObserver:(id)cocoaNSComboBox selector:@selector(comboBoxSelectionDidChange:) name:@"NSComboBoxWillPopUpNotification" object:cocoaNSComboBox];
+ }
+}
+
+void wxCocoaNSComboBox::DisassociateNSComboBox(WX_NSComboBox cocoaNSComboBox)
+{
+ if(cocoaNSComboBox)
+ {
+ sm_cocoaHash.erase(cocoaNSComboBox);
+ [[NSNotificationCenter defaultCenter] removeObserver:(id)cocoaNSComboBox name:@"NSComboBoxSelectionDidChangeNotification" object:cocoaNSComboBox];
+ [[NSNotificationCenter defaultCenter] removeObserver:(id)cocoaNSComboBox name:@"NSComboBoxSelectionIsChangingNotification" object:cocoaNSComboBox];
+ [[NSNotificationCenter defaultCenter] removeObserver:(id)cocoaNSComboBox name:@"NSComboBoxWillDismissNotification" object:cocoaNSComboBox];
+ [[NSNotificationCenter defaultCenter] removeObserver:(id)cocoaNSComboBox name:@"NSComboBoxWillPopUpNotification" object:cocoaNSComboBox];
+ }
+}
+
+// ============================================================================
+// @class wxPoserNSComboBox
+// ============================================================================
+@interface wxPoserNSComboBox : NSComboBox
+{
+}
+
+- (void)comboBoxSelectionDidChange:(NSNotification *)notification;
+- (void)comboBoxSelectionIsChanging:(NSNotification *)notification;
+- (void)comboBoxWillDismiss:(NSNotification *)notification;
+- (void)comboBoxWillPopUp:(NSNotification *)notification;
+@end // wxPoserNSComboBox
+WX_DECLARE_GET_OBJC_CLASS(wxPoserNSComboBox,NSComboBox)
+
+//WX_IMPLEMENT_POSER(wxPoserNSComboBox);
+@implementation wxPoserNSComboBox : NSComboBox
+
+- (void)comboBoxSelectionDidChange:(NSNotification *)notification
+{
+ wxCocoaNSComboBox *win = wxCocoaNSComboBox::GetFromCocoa(self);
+ win->doWxEvent(wxEVT_COMBOBOX);
+}
+
+- (void)comboBoxSelectionIsChanging:(NSNotification *)notification
+{
+ //...
+}
+
+- (void)comboBoxWillDismiss:(NSNotification *)notification
+{
+ //...
+}
+
+- (void)comboBoxWillPopUp:(NSNotification *)notification
+{
+ //...
+}
+
+@end // implementation wxPoserNSComboBox
+WX_IMPLEMENT_GET_OBJC_CLASS(wxPoserNSComboBox,NSComboBox)