+/////////////////////////////////////////////////////////////////////////////
+// Name: cocoa/NSComboBox.mm
+// Purpose: wxCocoaNSComboBox
+// Author: Ryan Norton
+// Modified by:
+// Created: 2005/02/16
+// RCS-ID: $Id:
+// Copyright: (c) 2003 David Elliott
+// Licence: wxWidgets licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/wxprec.h"
+#ifndef WX_PRECOMP
+ #include "wx/window.h"
+#endif // WX_PRECOMP
+
+#include "wx/cocoa/ObjcPose.h"
+#include "wx/combobox.h"
+
+#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_IMPLEMENT_POSER(wxPoserNSComboBox);
+@implementation wxPoserNSComboBox : NSComboBox
+
+- (void)comboBoxSelectionDidChange:(NSNotification *)notification
+{
+ wxCocoaNSComboBox *win = wxCocoaNSComboBox::GetFromCocoa(self);
+ win->doWxEvent(wxEVT_COMMAND_COMBOBOX_SELECTED);
+}
+
+- (void)comboBoxSelectionIsChanging:(NSNotification *)notification
+{
+ //...
+}
+
+- (void)comboBoxWillDismiss:(NSNotification *)notification
+{
+ //...
+}
+
+- (void)comboBoxWillPopUp:(NSNotification *)notification
+{
+ //...
+}
+
+@end // implementation wxPoserNSComboBox
+