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.

112 lines
2.8 KiB

  1. /**************************************************************************\
  2. * Module Name: nui.cpp
  3. *
  4. * Copyright (c) 1985 - 2000, Microsoft Corporation
  5. *
  6. * Lang Bar Items for Soft Keyboard TIP.
  7. *
  8. * History:
  9. * 28-March-2000 weibz Created
  10. \**************************************************************************/
  11. #include "private.h"
  12. #include "slbarid.h"
  13. #include "globals.h"
  14. #include "softkbdimx.h"
  15. #include "nui.h"
  16. #include "xstring.h"
  17. #include "immxutil.h"
  18. #include "helpers.h"
  19. #include "mui.h"
  20. #include "computil.h"
  21. //+---------------------------------------------------------------------------
  22. //
  23. // ctor
  24. //
  25. //----------------------------------------------------------------------------
  26. CLBarItem::CLBarItem(CSoftkbdIMX *pimx)
  27. {
  28. WCHAR wszToolTipText[MAX_PATH];
  29. Dbg_MemSetThisName(TEXT("CLBarItem"));
  30. LoadStringWrapW(g_hInst, IDS_SFTKBD_TIP_TEXT, wszToolTipText, MAX_PATH);
  31. InitNuiInfo(CLSID_SoftkbdIMX,
  32. GUID_LBI_SOFTKBDIMX_MODE,
  33. TF_LBI_STYLE_BTN_TOGGLE | TF_LBI_STYLE_SHOWNINTRAY,
  34. 0,
  35. wszToolTipText);
  36. _pimx = pimx;
  37. SetToolTip(wszToolTipText);
  38. SetText(wszToolTipText);
  39. UpdateToggle();
  40. }
  41. //+---------------------------------------------------------------------------
  42. //
  43. // dtor
  44. //
  45. //----------------------------------------------------------------------------
  46. CLBarItem::~CLBarItem()
  47. {
  48. }
  49. //+---------------------------------------------------------------------------
  50. //
  51. // GetIcon
  52. //
  53. //----------------------------------------------------------------------------
  54. STDAPI CLBarItem::GetIcon(HICON *phIcon)
  55. {
  56. BOOL fOn = FALSE;
  57. fOn = _pimx->GetSoftKBDOnOff( );
  58. *phIcon = LoadSmIcon(g_hInst, MAKEINTRESOURCE(ID_ICON_STANDARD));
  59. return S_OK;
  60. }
  61. //+---------------------------------------------------------------------------
  62. //
  63. // OnLButtonUp
  64. //
  65. //----------------------------------------------------------------------------
  66. HRESULT CLBarItem::OnLButtonUp(const POINT pt, const RECT *prcArea)
  67. {
  68. return ToggleCompartmentDWORD(_pimx->_GetId(),
  69. _pimx->_tim,
  70. GUID_COMPARTMENT_HANDWRITING_OPENCLOSE,
  71. FALSE);
  72. }
  73. //+---------------------------------------------------------------------------
  74. //
  75. // UpdateToggle
  76. //
  77. //----------------------------------------------------------------------------
  78. void CLBarItem::UpdateToggle()
  79. {
  80. DWORD dwHWState = 0;
  81. GetCompartmentDWORD(_pimx->_tim,
  82. GUID_COMPARTMENT_HANDWRITING_OPENCLOSE,
  83. &dwHWState,
  84. FALSE);
  85. SetOrClearStatus(TF_LBI_STATUS_BTN_TOGGLED, dwHWState);
  86. if (_plbiSink)
  87. _plbiSink->OnUpdate(TF_LBI_STATUS);
  88. }