+- (id) init
+{
+ [super init];
+ impl = NULL;
+ [self setTarget: self];
+ [self setAction: @selector(clickedAction:)];
+ [self setDoubleAction: @selector(doubleClickedAction:)];
+ return self;
+}
+
+- (void) clickedAction: (id) sender
+{
+ if ( impl )
+ {
+ wxListBox *list = static_cast<wxListBox*> ( impl->GetWXPeer());
+ wxCHECK_RET( list != NULL , wxT("Listbox expected"));
+
+ wxCommandEvent event( wxEVT_COMMAND_LISTBOX_SELECTED, list->GetId() );
+
+ int sel = [self clickedRow];
+ if ((sel < 0) || (sel > (int) list->GetCount())) // OS X can select an item below the last item (why?)
+ return;
+
+ list->HandleLineEvent( sel, false );
+ }
+}
+
+- (void) doubleClickedAction: (id) sender
+{
+ if ( impl )
+ {
+ wxListBox *list = static_cast<wxListBox*> ( impl->GetWXPeer());
+ wxCHECK_RET( list != NULL , wxT("Listbox expected"));
+
+ int sel = [self clickedRow];
+ if ((sel < 0) || (sel > (int) list->GetCount())) // OS X can select an item below the last item (why?)
+ return;
+
+ list->HandleLineEvent( sel, true );
+ }
+}