Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

248 lines
8.8 KiB

  1. #ifndef _PROPPAGE_H
  2. #define _PROPPAGE_H
  3. #include "Sapilayr.h"
  4. #ifdef USE_IPROPERTYPAGE
  5. #include "atlctl.h"
  6. #endif // USE_IPROPERTYPAGE
  7. #include "sptiphlp.h"
  8. extern CComModule _Module;
  9. #include "atlwin.h"
  10. typedef struct _ControlID_PropID_Mapping
  11. {
  12. WORD idCtrl;
  13. PROP_ITEM_ID idPropItem;
  14. BOOL fEdit; // TRUE means this is a edit control
  15. // FALS means this is a check control
  16. } CONTROL_PROP_MAP;
  17. typedef struct _KeyName_VK_Map
  18. {
  19. LPCTSTR pKeyName;
  20. WORD wVKey;
  21. } KEYNAME_VK_MAP;
  22. class CSpAdvanceSetting;
  23. class CSpModeButtonSetting;
  24. #ifdef USE_IPROPERTYPAGE
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CSpPropertyPage
  27. class CSpPropertyPage :// public IPropertyPage,
  28. public CComObjectRoot,
  29. public CComCoClass<CSpPropertyPage, &CLSID_SpPropertyPage>,
  30. public IPropertyPageImpl<CSpPropertyPage>,
  31. public CDialogImpl<CSpPropertyPage>
  32. {
  33. public:
  34. CSpPropertyPage();
  35. ~CSpPropertyPage();
  36. enum {IDD = IDD_PROPERTY_PAGE};
  37. typedef IPropertyPageImpl<CSpPropertyPage> PPBaseClass;
  38. DECLARE_PROTECT_FINAL_CONSTRUCT()
  39. BEGIN_COM_MAP(CSpPropertyPage)
  40. COM_INTERFACE_ENTRY(IPropertyPage)
  41. END_COM_MAP()
  42. IMMX_DECLARE_REGISTRY_RESOURCE(IDR_PROPERTY_PAGE)
  43. BEGIN_MSG_MAP(CSpPropertyPage)
  44. COMMAND_ID_HANDLER(IDC_PP_SELECTION_CMD, OnCheckButtonSetting)
  45. COMMAND_ID_HANDLER(IDC_PP_NAVIGATION_CMD, OnCheckButtonSetting)
  46. COMMAND_ID_HANDLER(IDC_PP_CASING_CMD, OnCheckButtonSetting)
  47. COMMAND_ID_HANDLER(IDC_PP_EDITING_CMD, OnCheckButtonSetting)
  48. COMMAND_ID_HANDLER(IDC_PP_KEYBOARD_CMD, OnCheckButtonSetting)
  49. COMMAND_ID_HANDLER(IDC_PP_LANGBAR_CMD, OnCheckButtonSetting)
  50. COMMAND_ID_HANDLER(IDC_PP_TTS_CMD, OnCheckButtonSetting)
  51. COMMAND_ID_HANDLER(IDC_PP_DISABLE_DICTCMD, OnCheckButtonSetting)
  52. COMMAND_ID_HANDLER(IDC_PP_ASSIGN_BUTTON, OnCheckButtonSetting)
  53. COMMAND_ID_HANDLER(IDC_PP_BUTTON_MB_SETTING, OnPushButtonClicked)
  54. COMMAND_ID_HANDLER(IDC_PP_BUTTON_ADVANCE, OnPushButtonClicked)
  55. COMMAND_ID_HANDLER(IDC_PP_BUTTON_LANGBAR, OnPushButtonClicked)
  56. CHAIN_MSG_MAP(IPropertyPageImpl<CSpPropertyPage>)
  57. END_MSG_MAP()
  58. //-- Methods
  59. STDMETHOD(Activate)(HWND hWndParent, LPCRECT prc,BOOL bModal);
  60. STDMETHOD(Apply)(void);
  61. LRESULT OnCheckButtonSetting(WORD wNotifyCode, WORD wID, HWND hWndCtl,BOOL& bHandled);
  62. LRESULT OnPushButtonClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl,BOOL& bHandled);
  63. private:
  64. //-- Methods
  65. HRESULT InitPropertyPage();
  66. //-- Members
  67. // GUI stuff
  68. HWND m_hWndParent;
  69. CSpPropItemsServer *m_SpPropItemsServer;
  70. DWORD m_dwNumCtrls;
  71. CONTROL_PROP_MAP *m_IdCtrlPropMap;
  72. CSpAdvanceSetting *m_SpAdvanceSet;
  73. };
  74. #endif // USE_IPROPERTYPAGE
  75. static TCHAR c_szHelpFile[] = TEXT("input.hlp");
  76. // Class for the Advanced setting dialog
  77. class CSpAdvanceSetting : public CDialogImpl<CSpAdvanceSetting>
  78. {
  79. public:
  80. CSpAdvanceSetting( );
  81. ~CSpAdvanceSetting( );
  82. enum {IDD = IDD_PP_DIALOG_ADVANCE};
  83. BEGIN_MSG_MAP(CSpAdvanceSetting)
  84. MESSAGE_HANDLER(WM_INITDIALOG, OnInitAdvanceDialog)
  85. MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextHelp)
  86. MESSAGE_HANDLER(WM_HELP, OnContextHelp)
  87. COMMAND_ID_HANDLER(IDC_PP_SELECTION_CMD, OnCheckButtonSetting)
  88. COMMAND_ID_HANDLER(IDC_PP_NAVIGATION_CMD, OnCheckButtonSetting)
  89. COMMAND_ID_HANDLER(IDC_PP_CASING_CMD, OnCheckButtonSetting)
  90. COMMAND_ID_HANDLER(IDC_PP_EDITING_CMD, OnCheckButtonSetting)
  91. COMMAND_ID_HANDLER(IDC_PP_KEYBOARD_CMD, OnCheckButtonSetting)
  92. COMMAND_ID_HANDLER(IDC_PP_LANGBAR_CMD, OnCheckButtonSetting)
  93. // COMMAND_ID_HANDLER(IDC_PP_TTS_CMD, OnCheckButtonSetting)
  94. /*
  95. COMMAND_ID_HANDLER(IDC_PP_MAXCHARS_ALTERNATE, OnEditControlSetting)
  96. COMMAND_ID_HANDLER(IDC_PP_MAXNUM_ALTERNATES, OnEditControlSetting)
  97. */
  98. COMMAND_ID_HANDLER(IDOK, OnPushButtonClicked)
  99. COMMAND_ID_HANDLER(IDCANCEL, OnPushButtonClicked)
  100. END_MSG_MAP()
  101. INT_PTR DoModalW(HWND hWndParent = ::GetActiveWindow(), LPARAM dwInitParam = NULL)
  102. {
  103. ATLASSERT(m_hWnd == NULL);
  104. _Module.AddCreateWndData(&m_thunk.cd, (CDialogImpl<CSpAdvanceSetting> *)this);
  105. return ::DialogBoxParamW(GetCicResInstance(g_hInst, CSpAdvanceSetting::IDD),
  106. MAKEINTRESOURCEW(CSpAdvanceSetting::IDD),
  107. hWndParent, CSpAdvanceSetting::StartDialogProc, dwInitParam);
  108. }
  109. LRESULT OnCheckButtonSetting(WORD wNotifyCode, WORD wID, HWND hWndCtl,BOOL& bHandled);
  110. // LRESULT OnEditControlSetting(WORD wNotifyCode, WORD wID, HWND hWndCtl,BOOL& bHandled);
  111. LRESULT OnPushButtonClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl,BOOL& bHandled);
  112. LRESULT OnInitAdvanceDialog(UINT uMsg, WPARAM wParam, LPARAM lParam,BOOL& bHandled );
  113. LRESULT OnContextHelp(UINT uMsg, WPARAM wParam, LPARAM lParam,BOOL& bHandled );
  114. BOOL IsItemStatusChanged( );
  115. private:
  116. CSpPropItemsServer *m_SpPropBaseServer;
  117. CSpPropItemsServer *m_SpPropItemsServer;
  118. DWORD m_dwNumCtrls;
  119. CONTROL_PROP_MAP *m_IdCtrlPropMap;
  120. };
  121. // Class for the Mode Button Setting dialog
  122. class CSpModeButtonSetting : public CDialogImpl<CSpModeButtonSetting>
  123. {
  124. public:
  125. CSpModeButtonSetting( );
  126. ~CSpModeButtonSetting( );
  127. enum {IDD = IDD_PP_DIALOG_BUTTON_SET};
  128. BEGIN_MSG_MAP(CSpModeButtonSetting)
  129. MESSAGE_HANDLER(WM_INITDIALOG, OnInitModeButtonDialog)
  130. MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextHelp)
  131. MESSAGE_HANDLER(WM_HELP, OnContextHelp)
  132. COMMAND_ID_HANDLER(IDC_PP_DICTATION_CMB, OnCombBoxSetting)
  133. COMMAND_ID_HANDLER(IDC_PP_COMMAND_CMB, OnCombBoxSetting)
  134. COMMAND_ID_HANDLER(IDOK, OnPushButtonClicked)
  135. COMMAND_ID_HANDLER(IDCANCEL, OnPushButtonClicked)
  136. END_MSG_MAP()
  137. INT_PTR DoModalW(HWND hWndParent = ::GetActiveWindow(), LPARAM dwInitParam = NULL)
  138. {
  139. ATLASSERT(m_hWnd == NULL);
  140. _Module.AddCreateWndData(&m_thunk.cd, (CDialogImpl<CSpModeButtonSetting> *)this);
  141. return ::DialogBoxParamW(GetCicResInstance(g_hInst, CSpModeButtonSetting::IDD),
  142. MAKEINTRESOURCEW(CSpModeButtonSetting::IDD),
  143. hWndParent, CSpModeButtonSetting::StartDialogProc, dwInitParam);
  144. }
  145. LRESULT OnCombBoxSetting(WORD wNotifyCode, WORD wID, HWND hWndCtl,BOOL& bHandled);
  146. LRESULT OnPushButtonClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl,BOOL& bHandled);
  147. LRESULT OnInitModeButtonDialog(UINT uMsg, WPARAM wParam, LPARAM lParam,BOOL& bHandled );
  148. LRESULT OnContextHelp(UINT uMsg, WPARAM wParam, LPARAM lParam,BOOL& bHandled );
  149. private:
  150. CSpPropItemsServer *m_SpPropBaseServer;
  151. CSpPropItemsServer *m_SpPropItemsServer;
  152. DWORD m_dwNumCtrls;
  153. CONTROL_PROP_MAP *m_IdCtrlPropMap;
  154. };
  155. class CSptipPropertyPage
  156. {
  157. public:
  158. CSptipPropertyPage ( WORD wDlgId, BOOL fLaunchFromInputCpl );
  159. ~CSptipPropertyPage ( );
  160. static INT_PTR CALLBACK SpPropertyPageProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  161. LRESULT OnCheckButtonSetting(WORD wNotifyCode, WORD wID, HWND hWndCtl);
  162. LRESULT OnPushButtonClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl);
  163. LRESULT OnApply( );
  164. LRESULT OnInitSptipPropPageDialog( HWND hDlg );
  165. WORD GetDlgResId( ) { return m_wDlgId; }
  166. DLGPROC GetDlgProc( ) { return SpPropertyPageProc; }
  167. BOOL IsPageDirty( ) { return m_fIsDirty; }
  168. void SetDirty( BOOL fDirty );
  169. private:
  170. //-- Members
  171. WORD m_wDlgId;
  172. HWND m_hDlg;
  173. CSpPropItemsServer *m_SpPropItemsServer;
  174. DWORD m_dwNumCtrls;
  175. CONTROL_PROP_MAP *m_IdCtrlPropMap;
  176. CSpAdvanceSetting *m_SpAdvanceSet;
  177. CSpModeButtonSetting *m_SpModeBtnSet;
  178. BOOL m_fIsDirty;
  179. BOOL m_fLaunchFromInputCpl; // indicates if the property page is launched from input cpl.
  180. };
  181. #endif // _PROPPAGE_H