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.

130 lines
3.8 KiB

  1. /****************************************************************************
  2. SKBDMODE.CPP : CSoftKbdMode class implementation which manage Soft Keyboard
  3. button on the Cicero Toolbar
  4. History:
  5. 19-SEP-2000 CSLim Created
  6. ****************************************************************************/
  7. #include "private.h"
  8. #include "globals.h"
  9. #include "common.h"
  10. #include "korimx.h"
  11. #include "skbdmode.h"
  12. #include "userex.h"
  13. #include "immxutil.h"
  14. #include "resource.h"
  15. // {C7BAA1A7-5403-4596-8fe6-DC50C96B2FDD}
  16. const GUID GUID_LBI_KORIMX_SKBDMODE =
  17. {
  18. 0xC7BAA1A7,
  19. 0x5403,
  20. 0x4596,
  21. { 0x8f, 0xe6, 0xdc, 0x50, 0xc9, 0x6b, 0x2f, 0xdd }
  22. };
  23. /*---------------------------------------------------------------------------
  24. CSoftKbdMode::CSoftKbdMode
  25. ---------------------------------------------------------------------------*/
  26. CSoftKbdMode::CSoftKbdMode(CToolBar *ptb)
  27. {
  28. WCHAR szText[256];
  29. m_pTb = ptb;
  30. // Set Add/Remove and tootip text
  31. LoadStringExW(g_hInst, IDS_BUTTON_SOFTKBD, szText, sizeof(szText)/sizeof(WCHAR));
  32. InitInfo(CLSID_KorIMX,
  33. GUID_LBI_KORIMX_SKBDMODE,
  34. TF_LBI_STYLE_BTN_TOGGLE | TF_LBI_STYLE_HIDDENBYDEFAULT,
  35. 130,
  36. szText);
  37. SetToolTip(szText);
  38. SetText(szText);
  39. }
  40. /*---------------------------------------------------------------------------
  41. CSoftKbdMode::Release
  42. ---------------------------------------------------------------------------*/
  43. STDAPI_(ULONG) CSoftKbdMode::Release()
  44. {
  45. long cr;
  46. cr = --m_cRef;
  47. Assert(cr >= 0);
  48. if (cr == 0)
  49. {
  50. delete this;
  51. }
  52. return cr;
  53. }
  54. /*---------------------------------------------------------------------------
  55. CSoftKbdMode::GetIcon
  56. Get Button face Icon
  57. ---------------------------------------------------------------------------*/
  58. STDAPI CSoftKbdMode::GetIcon(HICON *phIcon)
  59. {
  60. *phIcon = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_SOFTKBD), IMAGE_ICON, 16, 16, LR_LOADMAP3DCOLORS);;
  61. return S_OK;
  62. }
  63. /*---------------------------------------------------------------------------
  64. CSoftKbdMode::InitMenu
  65. No need, this is just toggle button
  66. ---------------------------------------------------------------------------*/
  67. STDAPI CSoftKbdMode::InitMenu(ITfMenu *pMenu)
  68. {
  69. return E_NOTIMPL;
  70. }
  71. /*---------------------------------------------------------------------------
  72. CSoftKbdMode::OnMenuSelect
  73. No need, this is just toggle button
  74. ---------------------------------------------------------------------------*/
  75. STDAPI CSoftKbdMode::OnMenuSelect(UINT wID)
  76. {
  77. return E_NOTIMPL;
  78. }
  79. /*---------------------------------------------------------------------------
  80. CSoftKbdMode::OnLButtonUp
  81. ---------------------------------------------------------------------------*/
  82. HRESULT CSoftKbdMode::OnLButtonUp(const POINT pt, const RECT* prcArea)
  83. {
  84. return ToggleCompartmentDWORD(m_pTb->m_pimx->GetTID(),
  85. m_pTb->m_pimx->GetTIM(),
  86. GUID_COMPARTMENT_KOR_SOFTKBD_OPENCLOSE,
  87. FALSE);
  88. }
  89. /*---------------------------------------------------------------------------
  90. CSoftKbdMode::UpdateToggle
  91. No need, this is just toggle button
  92. ---------------------------------------------------------------------------*/
  93. void CSoftKbdMode::UpdateToggle()
  94. {
  95. DWORD dwState = 0;
  96. GetCompartmentDWORD(m_pTb->m_pimx->GetTIM(),
  97. GUID_COMPARTMENT_KOR_SOFTKBD_OPENCLOSE,
  98. &dwState,
  99. FALSE);
  100. SetOrClearStatus(TF_LBI_STATUS_BTN_TOGGLED, dwState);
  101. if (m_plbiSink)
  102. m_plbiSink->OnUpdate(TF_LBI_STATUS);
  103. }