00001 00002 // Name: ax_ui_adaptation_standard.h 00003 // Purpose: Voicing adaptation for standard wxWidgets controls 00004 // Author: Julian Smart 00005 // Modified by: 00006 // Created: 2009-03-20 00007 // RCS-ID: 00008 // Copyright: (c) Julian Smart 00009 // Licence: New BSD License 00011 00012 #ifndef _AX_UI_ADAPTATION_STANDARD_H_ 00013 #define _AX_UI_ADAPTATION_STANDARD_H_ 00014 00015 #include "wx/timer.h" 00016 00017 #include "ax/ax_ui_adaptation.h" 00018 00027 class AxStandardControlsVoiceAdaptationHandler: public AxVoiceAdaptationHandler 00028 { 00029 DECLARE_DYNAMIC_CLASS( AxStandardControlsVoiceAdaptationHandler ) 00030 00031 public: 00032 AxStandardControlsVoiceAdaptationHandler() {} 00033 00035 virtual bool CanHandleWindow(wxWindow* win); 00036 00038 virtual AxAdapter* CreateEventHandler(wxWindow* win); 00039 00042 virtual bool Adapt(wxWindow* window, AxSpeech* speech, wxShortcutManager* shortcuts, wxArrayInt& ids); 00043 00045 virtual bool Unadapt(wxWindow* window, wxArrayInt& ids); 00046 00048 virtual bool CanRecursivelyAdapt(wxWindow* window) const; 00049 }; 00050 00060 class wxDialog; 00061 00062 class AxDialogAdapter: public AxAdapter 00063 { 00064 DECLARE_DYNAMIC_CLASS( AxDialogAdapter ) 00065 DECLARE_EVENT_TABLE() 00066 00067 public: 00068 // Constructors 00069 00070 AxDialogAdapter() {} 00071 00072 // Overrides 00073 00075 virtual wxString GetName(); 00076 00079 virtual wxString GetStateText(AxContentLevel level); 00080 00082 virtual wxString GetLabel(); 00083 00085 virtual wxString GetContent(AxContentLevel level); 00086 00088 virtual bool ApplyWindowColours(); 00089 00090 // New functions 00091 00092 void OnInitDialog(wxInitDialogEvent& event); 00093 00094 wxDialog* GetDialog() const; 00095 00096 protected: 00097 }; 00098 00109 class AxPanelAdapter: public AxAdapter 00110 { 00111 DECLARE_DYNAMIC_CLASS( AxPanelAdapter ) 00112 DECLARE_EVENT_TABLE() 00113 00114 public: 00115 // Constructors 00116 00117 AxPanelAdapter() {} 00118 00119 // Overrides 00120 00122 virtual bool PostUpdateAppearance(int hints); 00123 00125 virtual wxString GetName() { return _("panel"); } 00126 00129 virtual wxString GetStateText(AxContentLevel WXUNUSED(level)) { return wxEmptyString; } 00130 00132 virtual wxString GetLabel() { return wxEmptyString; } 00133 00135 virtual wxString GetContent(AxContentLevel WXUNUSED(level)) { return wxEmptyString; } 00136 00139 virtual bool IsVoiced() const { return false; } 00140 00142 virtual bool ApplyWindowColours(); 00143 00144 // New functions 00145 00146 wxPanel* GetPanel() const; 00147 00148 protected: 00149 }; 00150 00160 class wxFrame; 00161 00162 class AxFrameAdapter: public AxAdapter 00163 { 00164 DECLARE_DYNAMIC_CLASS( AxFrameAdapter ) 00165 DECLARE_EVENT_TABLE() 00166 00167 public: 00168 // Constructors 00169 00170 AxFrameAdapter() { Init(); } 00171 ~AxFrameAdapter(); 00172 00173 void Init(); 00174 00175 // Overrides 00176 00178 virtual wxString GetName(); 00179 00182 virtual wxString GetStateText(AxContentLevel level); 00183 00185 virtual wxString GetLabel(); 00186 00188 virtual wxString GetContent(AxContentLevel level); 00189 00191 virtual bool ApplyWindowColours(); 00192 00193 // New functions 00194 00195 void OnMenuOpen(wxMenuEvent& event); 00196 void OnMenuClose(wxMenuEvent& event); 00197 void OnMenuHighlight(wxMenuEvent& event); 00198 void OnMenuSelect(wxCommandEvent& event); 00199 00200 void OnTimeOut(wxTimerEvent& event); 00201 00202 wxFrame* GetFrame() const; 00203 00204 protected: 00205 // A menu open speech event is pending if not -1. Value is menu position. 00206 int m_openMenuPending; 00207 00208 // For scheduling menu open speech event 00209 wxTimer m_timer; 00210 }; 00211 00222 class AxStaticTextAdapter: public AxAdapter 00223 { 00224 DECLARE_DYNAMIC_CLASS( AxStaticTextAdapter ) 00225 DECLARE_EVENT_TABLE() 00226 00227 public: 00228 // Constructors 00229 00230 AxStaticTextAdapter() {} 00231 00232 // Overrides 00233 00235 virtual wxString GetName() { return _("static text"); } 00236 00239 virtual wxString GetStateText(AxContentLevel WXUNUSED(level)) { return wxEmptyString; } 00240 00242 virtual wxString GetLabel() { return GetMainControl()->GetLabel(); } 00243 00245 virtual wxString GetContent(AxContentLevel WXUNUSED(level)) { return wxEmptyString; } 00246 00249 virtual bool IsVoiced() const { return false; } 00250 00252 virtual bool ApplyWindowColours(); 00253 00254 // New functions 00255 00256 wxStaticText* GetStaticText() const; 00257 00258 protected: 00259 }; 00260 00271 class AxStaticBoxAdapter: public AxStaticTextAdapter 00272 { 00273 DECLARE_DYNAMIC_CLASS( AxStaticBoxAdapter ) 00274 00275 public: 00276 // Constructors 00277 00278 AxStaticBoxAdapter() {} 00279 00280 // Overrides 00281 00283 virtual wxString GetName() { return _("static box"); } 00284 00285 protected: 00286 }; 00287 00297 class wxButton; 00298 class wxBitmapButton; 00299 00300 class AxButtonAdapter: public AxAdapter 00301 { 00302 DECLARE_DYNAMIC_CLASS( AxButtonAdapter ) 00303 DECLARE_EVENT_TABLE() 00304 00305 public: 00306 // Constructors 00307 00308 AxButtonAdapter(const wxString& alternateLabel = wxEmptyString) { SetAlternateLabel(alternateLabel); } 00309 00310 // Overrides 00311 00313 virtual wxString GetName(); 00314 00317 virtual wxString GetStateText(AxContentLevel level); 00318 00320 virtual wxString GetLabel() { return GetControlLabel(); } 00321 00323 virtual wxString GetContent(AxContentLevel level); 00324 00326 virtual bool UpdateAppearance(int hints); 00327 00328 // New functions 00329 00330 void OnCommand(wxCommandEvent& event); 00331 00332 wxButton* GetButton() const; 00333 wxBitmapButton* GetBitmapButton() const; 00334 00335 protected: 00336 }; 00337 00347 class wxToggleButton; 00348 00349 class AxToggleButtonAdapter: public AxAdapter 00350 { 00351 DECLARE_DYNAMIC_CLASS( AxToggleButtonAdapter ) 00352 DECLARE_EVENT_TABLE() 00353 00354 public: 00355 // Constructors 00356 00357 AxToggleButtonAdapter(const wxString& alternateLabel = wxEmptyString) { SetAlternateLabel(alternateLabel); } 00358 00359 // Overrides 00360 00362 virtual wxString GetName(); 00363 00366 virtual wxString GetStateText(AxContentLevel level); 00367 00369 virtual wxString GetLabel() { return GetControlLabel(); } 00370 00372 virtual wxString GetContent(AxContentLevel level); 00373 00374 // New functions 00375 00376 void OnCommand(wxCommandEvent& event); 00377 00378 wxToggleButton* GetToggleButton() const; 00379 00380 protected: 00381 }; 00382 00392 class wxCheckBox; 00393 class AxCheckBoxAdapter: public AxAdapter 00394 { 00395 DECLARE_DYNAMIC_CLASS( AxCheckBoxAdapter ) 00396 DECLARE_EVENT_TABLE() 00397 00398 public: 00399 // Constructors 00400 00401 AxCheckBoxAdapter() {} 00402 00403 // Overrides 00404 00406 virtual wxString GetName(); 00407 00410 virtual wxString GetStateText(AxContentLevel level); 00411 00413 virtual wxString GetLabel() { return GetControlLabel(); } 00414 00416 virtual wxString GetContent(AxContentLevel level); 00417 00419 virtual bool ApplyWindowColours(); 00420 00421 // New functions 00422 00423 void OnCommand(wxCommandEvent& event); 00424 00425 wxCheckBox* GetCheckBox() const; 00426 00427 protected: 00428 }; 00429 00439 class wxRadioButton; 00440 00441 class AxRadioButtonAdapter: public AxAdapter 00442 { 00443 DECLARE_DYNAMIC_CLASS( AxRadioButtonAdapter ) 00444 DECLARE_EVENT_TABLE() 00445 00446 public: 00447 // Constructors 00448 00449 AxRadioButtonAdapter() {} 00450 00451 // Overrides 00452 00454 virtual wxString GetName(); 00455 00458 virtual wxString GetStateText(AxContentLevel level); 00459 00461 virtual wxString GetLabel() { return GetControlLabel(); } 00462 00464 virtual wxString GetContent(AxContentLevel level); 00465 00467 virtual bool ApplyWindowColours(); 00468 00469 // New functions 00470 00471 void OnCommand(wxCommandEvent& event); 00472 00473 wxRadioButton* GetRadioButton() const; 00474 00475 protected: 00476 }; 00477 00487 class wxListBox; 00488 class wxCheckListBox; 00489 00490 class AxListBoxAdapter: public AxAdapter 00491 { 00492 DECLARE_DYNAMIC_CLASS( AxListBoxAdapter ) 00493 DECLARE_EVENT_TABLE() 00494 00495 public: 00496 // Constructors 00497 00498 AxListBoxAdapter() {} 00499 00500 // Overrides 00501 00503 virtual wxString GetName(); 00504 00507 virtual wxString GetStateText(AxContentLevel level); 00508 00510 virtual wxString GetContent(AxContentLevel level); 00511 00512 // New functions 00513 00514 void OnCommand(wxCommandEvent& event); 00515 00516 wxListBox* GetListBox() const; 00517 wxCheckListBox* GetCheckListBox() const; 00518 00519 protected: 00520 }; 00521 00531 class wxListCtrl; 00532 class wxListEvent; 00533 00534 class AxListCtrlAdapter: public AxAdapter 00535 { 00536 DECLARE_DYNAMIC_CLASS( AxListCtrlAdapter ) 00537 DECLARE_EVENT_TABLE() 00538 00539 public: 00540 // Constructors 00541 00542 AxListCtrlAdapter() {} 00543 00544 // Overrides 00545 00547 virtual wxString GetName(); 00548 00551 virtual wxString GetStateText(AxContentLevel level); 00552 00554 virtual wxString GetContent(AxContentLevel level); 00555 00556 // New functions 00557 00558 void OnSelection(wxListEvent& event); 00559 00560 wxListCtrl* GetListCtrl() const; 00561 00562 protected: 00563 }; 00564 00574 class wxTreeCtrl; 00575 class wxTreeEvent; 00576 00577 class AxTreeCtrlAdapter: public AxAdapter 00578 { 00579 DECLARE_DYNAMIC_CLASS( AxTreeCtrlAdapter ) 00580 DECLARE_EVENT_TABLE() 00581 00582 public: 00583 // Constructors 00584 00585 AxTreeCtrlAdapter() {} 00586 00587 // Overrides 00588 00590 virtual wxString GetName(); 00591 00594 virtual wxString GetStateText(AxContentLevel level); 00595 00597 virtual wxString GetContent(AxContentLevel level); 00598 00599 // New functions 00600 00601 void OnSelection(wxTreeEvent& event); 00602 00603 wxTreeCtrl* GetTreeCtrl() const; 00604 00605 protected: 00606 }; 00607 00617 class wxComboBox; 00618 00619 class AxComboBoxAdapter: public AxAdapter 00620 { 00621 DECLARE_DYNAMIC_CLASS( AxComboBoxAdapter ) 00622 DECLARE_EVENT_TABLE() 00623 00624 public: 00625 // Constructors 00626 00627 AxComboBoxAdapter() {} 00628 00629 // Overrides 00630 00632 virtual wxString GetName(); 00633 00636 virtual wxString GetStateText(AxContentLevel level); 00637 00639 virtual wxString GetContent(AxContentLevel level); 00640 00641 // New functions 00642 00643 void OnCommand(wxCommandEvent& event); 00644 void OnText(wxCommandEvent& event); 00645 00646 wxComboBox* GetComboBox() const; 00647 00648 protected: 00649 }; 00650 00660 class wxChoice; 00661 00662 class AxChoiceAdapter: public AxAdapter 00663 { 00664 DECLARE_DYNAMIC_CLASS( AxChoiceAdapter ) 00665 DECLARE_EVENT_TABLE() 00666 00667 public: 00668 // Constructors 00669 00670 AxChoiceAdapter() {} 00671 00672 // Overrides 00673 00675 virtual wxString GetName(); 00676 00679 virtual wxString GetStateText(AxContentLevel level); 00680 00682 virtual wxString GetContent(AxContentLevel level); 00683 00684 // New functions 00685 00686 void OnCommand(wxCommandEvent& event); 00687 00688 wxChoice* GetChoice() const; 00689 00690 protected: 00691 }; 00692 00702 class wxSpinCtrl; 00703 class wxSpinEvent; 00704 00705 class AxSpinCtrlAdapter: public AxAdapter 00706 { 00707 DECLARE_DYNAMIC_CLASS( AxSpinCtrlAdapter ) 00708 DECLARE_EVENT_TABLE() 00709 00710 public: 00711 // Constructors 00712 00713 AxSpinCtrlAdapter() {} 00714 00715 // Overrides 00716 00718 virtual wxString GetName(); 00719 00722 virtual wxString GetStateText(AxContentLevel level); 00723 00725 virtual wxString GetContent(AxContentLevel level); 00726 00727 // New functions 00728 00729 void OnCommand(wxSpinEvent& event); 00730 00731 wxSpinCtrl* GetSpinCtrl() const; 00732 00733 protected: 00734 }; 00735 00745 class wxSlider; 00746 00747 class AxSliderAdapter: public AxAdapter 00748 { 00749 DECLARE_DYNAMIC_CLASS( AxSliderAdapter ) 00750 DECLARE_EVENT_TABLE() 00751 00752 public: 00753 // Constructors 00754 00755 AxSliderAdapter() {} 00756 00757 // Overrides 00758 00760 virtual wxString GetName(); 00761 00764 virtual wxString GetStateText(AxContentLevel level); 00765 00767 virtual wxString GetContent(AxContentLevel level); 00768 00769 // New functions 00770 00771 void OnCommand(wxCommandEvent& event); 00772 00773 wxSlider* GetSlider() const; 00774 00775 protected: 00776 }; 00777 00787 class wxHtmlWindow; 00788 00789 class AxHtmlWindowAdapter: public AxAdapter 00790 { 00791 DECLARE_DYNAMIC_CLASS( AxHtmlWindowAdapter ) 00792 DECLARE_EVENT_TABLE() 00793 00794 public: 00795 // Constructors 00796 00797 AxHtmlWindowAdapter() {} 00798 00799 // Overrides 00800 00802 virtual wxString GetName(); 00803 00806 virtual wxString GetStateText(AxContentLevel level); 00807 00809 virtual wxString GetContent(AxContentLevel level); 00810 00811 // New functions 00812 00813 wxHtmlWindow* GetHtmlWindow() const; 00814 00815 protected: 00816 }; 00817 00827 class wxNotebook; 00828 class wxNotebookEvent; 00829 class wxChoicebook; 00830 class wxChoicebookEvent; 00831 class wxListbook; 00832 class wxListbookEvent; 00833 class wxTreebook; 00834 class wxTreebookEvent; 00835 class wxBookCtrlBase; 00836 00837 class AxNotebookAdapter: public AxAdapter 00838 { 00839 DECLARE_DYNAMIC_CLASS( AxNotebookAdapter ) 00840 DECLARE_EVENT_TABLE() 00841 00842 public: 00843 // Constructors 00844 00845 AxNotebookAdapter() {} 00846 00847 // Overrides 00848 00850 virtual wxString GetName(); 00851 00854 virtual wxString GetStateText(AxContentLevel level); 00855 00857 virtual wxString GetContent(AxContentLevel level); 00858 00860 virtual bool ApplyWindowColours(); 00861 00862 // New functions 00863 00864 void OnNotebookPageChanged(wxNotebookEvent& event); 00865 void OnChoicebookPageChanged(wxChoicebookEvent& event); 00866 void OnListbookPageChanged(wxListbookEvent& event); 00867 void OnTreebookPageChanged(wxTreebookEvent& event); 00868 00869 void OnPageChanged(int sel); 00870 00871 wxBookCtrlBase* GetBookCtrl() const; 00872 wxNotebook* GetNotebook() const; 00873 wxChoicebook* GetChoicebook() const; 00874 wxListbook* GetListbook() const; 00875 wxTreebook* GetTreebook() const; 00876 00877 protected: 00878 }; 00879 00889 class wxHyperlinkCtrl; 00890 class wxHyperlinkEvent; 00891 00892 class AxHyperlinkCtrlAdapter: public AxAdapter 00893 { 00894 DECLARE_DYNAMIC_CLASS( AxHyperlinkCtrlAdapter ) 00895 DECLARE_EVENT_TABLE() 00896 00897 public: 00898 // Constructors 00899 00900 AxHyperlinkCtrlAdapter() {} 00901 00902 // Overrides 00903 00905 virtual wxString GetName(); 00906 00909 virtual wxString GetStateText(AxContentLevel level); 00910 00912 virtual wxString GetContent(AxContentLevel level); 00913 00915 virtual bool ApplyWindowColours(); 00916 00917 // New functions 00918 00919 void OnCommand(wxHyperlinkEvent& event); 00920 00921 wxHyperlinkCtrl* GetHyperlinkCtrl() const; 00922 00923 protected: 00924 }; 00925 00926 00927 #endif 00928 // _AX_UI_ADAPTATION_STANDARD_H_