+- (BOOL) triggerMenu:(SEL) action
+{
+ wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar();
+ if ( mbar )
+ {
+ wxMenu* menu = NULL;
+ wxMenuItem* menuitem = mbar->FindItem(wxOSXGetIdFromSelector(action), &menu);
+ if ( menu != NULL && menuitem != NULL)
+ return menu->HandleCommandProcess(menuitem);
+ }
+ return NO;
+}
+
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
+{
+ SEL action = [menuItem action];
+
+ wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar();
+ if ( mbar )
+ {
+ wxMenu* menu = NULL;
+ wxMenuItem* menuitem = mbar->FindItem(wxOSXGetIdFromSelector(action), &menu);
+ if ( menu != NULL && menuitem != NULL)
+ {
+ menu->HandleCommandUpdateStatus(menuitem);
+ return menuitem->IsEnabled();
+ }
+ }
+ return YES;
+}
+
+- (void)undo:(id)sender
+{
+ wxUnusedVar(sender);
+ [self triggerMenu:_cmd];
+}
+
+- (void)redo:(id)sender
+{
+ wxUnusedVar(sender);
+ [self triggerMenu:_cmd];
+}
+
+- (void)cut:(id)sender
+{
+ wxUnusedVar(sender);
+ [self triggerMenu:_cmd];
+}
+
+- (void)copy:(id)sender
+{
+ wxUnusedVar(sender);
+ [self triggerMenu:_cmd];
+}
+
+- (void)paste:(id)sender
+{
+ wxUnusedVar(sender);
+ [self triggerMenu:_cmd];
+}
+
+- (void)delete:(id)sender
+{
+ wxUnusedVar(sender);
+ [self triggerMenu:_cmd];
+}
+
+- (void)selectAll:(id)sender
+{
+ wxUnusedVar(sender);
+ [self triggerMenu:_cmd];
+}
+