Source code of Windows XP (NT5)
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.

101 lines
3.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 2000
  6. //
  7. // File: cplnkele.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef __CONTROLPANEL_LINKELEM_H
  11. #define __CONTROLPANEL_LINKELEM_H
  12. #include "cpviewp.h"
  13. #include "cpuiele.h"
  14. #include "cputil.h"
  15. namespace CPL {
  16. class CLinkElement : public DUI::Button
  17. {
  18. public:
  19. virtual ~CLinkElement(void);
  20. void OnEvent(DUI::Event *pev);
  21. void OnInput(DUI::InputEvent *pev);
  22. void OnPropertyChanged(DUI::PropertyInfo *ppi, int iIndex, DUI::Value *pvOld, DUI::Value *pvNew);
  23. void OnDestroy(void);
  24. static HRESULT Create(DUI::Element **ppElement);
  25. HRESULT Initialize(IUICommand *pUiCommand, eCPIMGSIZE eIconSize);
  26. //
  27. // ClassInfo accessors (static and virtual instance-based)
  28. //
  29. static DUI::IClassInfo *Class;
  30. virtual DUI::IClassInfo *GetClassInfo(void)
  31. { return Class; }
  32. static HRESULT Register();
  33. private:
  34. //
  35. // These are the 3 states of a drag operation that we transition
  36. // through. See the OnInput() method for usage and description.
  37. //
  38. enum { DRAG_IDLE, DRAG_HITTESTING, DRAG_DRAGGING };
  39. IUICommand *m_pUiCommand; // Link command object associated with element.
  40. eCPIMGSIZE m_eIconSize;
  41. HWND m_hwndInfotip; // Infotip window.
  42. ATOM m_idTitle;
  43. ATOM m_idIcon;
  44. int m_iDragState;
  45. RECT m_rcDragBegin;
  46. //
  47. // Prevent copy.
  48. //
  49. CLinkElement(const CLinkElement& rhs); // not implemented.
  50. CLinkElement& operator = (const CLinkElement& rhs); // not implemented.
  51. public:
  52. CLinkElement(void);
  53. private:
  54. HRESULT _Initialize(void);
  55. HRESULT _InitializeAccessibility(void);
  56. HRESULT _CreateElementTitle(void);
  57. HRESULT _CreateElementIcon(void);
  58. HRESULT _GetElementIcon(HICON *phIcon);
  59. HRESULT _AddOrDeleteAtoms(bool bAdd);
  60. HRESULT _OnContextMenu(DUI::ButtonContextEvent *peButton);
  61. HRESULT _OnSelected(void);
  62. void _Destroy(void);
  63. void _OnElementResized(DUI::Value *pvNewExtent);
  64. void _OnElementMoved(DUI::Value *pvNewLocation);
  65. void _OnMouseOver(DUI::Value *pvNewMouseWithin);
  66. HRESULT _GetInfotipText(LPWSTR *ppszInfotip);
  67. HRESULT _GetTitleText(LPWSTR *ppszTitle);
  68. HRESULT _ShowInfotipWindow(bool bShow);
  69. HRESULT _GetDragDropData(IDataObject **ppdtobj);
  70. HRESULT _BeginDrag(int iClickPosX, int iClickPosY);
  71. HRESULT _SetPreferredDropEffect(IDataObject *pdtobj, DWORD dwEffect);
  72. HRESULT _GetDragImageBitmap(HBITMAP *phbm, LONG *plWidth, LONG *plHeight);
  73. HRESULT _SetDragImage(IDataObject *pdtobj, int iClickPosX, int iClickPosY);
  74. };
  75. } // namespace CPL
  76. #endif // __CONTROLPANEL_LINKELEM_H