00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #ifndef _AX_MENU_SHORTCUTS_H_
00013 #define _AX_MENU_SHORTCUTS_H_
00014
00015
00016
00017
00018
00019 #include "ax/ax_activator.h"
00020 #include "ax/ax_menu_text.h"
00021
00022 class AxSpeech;
00023 class wxShortcutManager;
00024 class wxShortcutItem;
00025
00032 class AxShortcutsMenuItem: public AxMenuItem
00033 {
00034 DECLARE_CLASS( AxShortcutsMenuItem )
00035 DECLARE_EVENT_TABLE( )
00036
00037 friend class AxShortcutTextActivator;
00038
00039 public:
00040
00041
00042 AxShortcutsMenuItem(const AxShortcutsMenuItem& item)
00043 {
00044 Copy(item);
00045 }
00049 AxShortcutsMenuItem(AxMenuController* controller, AxSpeech* speech,
00050 wxShortcutManager* manager, wxWindow* window, wxMenuBar* menuBar = NULL);
00051
00052 void Copy(const AxShortcutsMenuItem& item)
00053 {
00054 AxMenuItem::Copy(item);
00055
00056 m_speech = item.m_speech;
00057 m_controller = item.m_controller;
00058 m_shortcutManager = item.m_shortcutManager;
00059 m_window = item.m_window;
00060 m_menuBar = item.m_menuBar;
00061 }
00062
00063 void OnChangeShortcut(wxCommandEvent& event);
00064
00065 void UpdateShortcuts();
00066
00067 virtual AxMenuItem* Clone() { return new AxShortcutsMenuItem(* this); }
00068
00069 protected:
00070 AxSpeech* m_speech;
00071 AxMenuController* m_controller;
00072 wxShortcutManager* m_shortcutManager;
00073 wxWindow* m_window;
00074 wxMenuBar* m_menuBar;
00075 };
00076
00087 class AxShortcutsActivator: public AxActivator
00088 {
00089 public:
00090
00091 DECLARE_DYNAMIC_CLASS( AxShortcutsActivator )
00092
00093 public:
00094
00095
00096 AxShortcutsActivator() { Init(); }
00097
00098 AxShortcutsActivator(AxSpeech* speech, wxShortcutManager* shortcutsManager)
00099 { m_speech = speech; m_shortcutManager = shortcutsManager; }
00100
00101 AxShortcutsActivator(const AxShortcutsActivator& activator) { Init(); Copy(activator); }
00102
00103 void Init() { m_speech = NULL; m_shortcutManager = NULL; }
00104
00105 void Copy(const AxShortcutsActivator& activator)
00106 {
00107 AxActivator::Copy(activator);
00108 m_speech = activator.m_speech;
00109 m_shortcutManager = activator.m_shortcutManager;
00110 }
00111
00112 virtual AxActivator* Clone() const { return new AxShortcutsActivator(* this); }
00113
00115 virtual AxMenu* Activate(AxMenuController* controller, AxMenuItem* item);
00116
00117 protected:
00118 AxSpeech* m_speech;
00119 wxShortcutManager* m_shortcutManager;
00120 };
00121
00130 class AxShortcutTextActivator: public AxTextActivator
00131 {
00132 public:
00133
00134 DECLARE_DYNAMIC_CLASS( AxShortcutTextActivator )
00135
00136 public:
00137 typedef enum
00138 {
00139 AxShortcutCommandUnknown,
00140 AxShortcutCommandShortcut,
00141 AxShortcutCommandReset
00142
00143 } AxShortcutCommand;
00144
00145
00146
00147 AxShortcutTextActivator() { Init(); }
00148
00149 AxShortcutTextActivator(
00150 AxShortcutCommand command,
00151 const wxString& labelSpec,
00152 const wxString& descriptionSpec,
00153 wxShortcutManager* shortcutManager,
00154 AxSpeech* speech,
00155 wxShortcutItem* shortcut);
00156
00157 AxShortcutTextActivator(const AxShortcutTextActivator& activator) { Init(); Copy(activator); }
00158
00159 void Init();
00160
00161 void Copy(const AxShortcutTextActivator& activator);
00162
00163 virtual AxActivator* Clone() const { return new AxShortcutTextActivator(* this); }
00164
00166 virtual AxMenu* Activate(AxMenuController* controller, AxMenuItem* item);
00167
00168 protected:
00169
00170 AxSpeech* m_speech;
00171 wxShortcutManager* m_shortcutManager;
00172 wxShortcutItem* m_shortcut;
00173 AxShortcutCommand m_command;
00174 };
00175
00176 #endif
00177