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.

173 lines
3.8 KiB

  1. //
  2. // wpopup.h
  3. //
  4. #ifndef WPOPUP_H
  5. #define WPOPUP_H
  6. #include "private.h"
  7. #include "mscandui.h"
  8. #include "cuilib.h"
  9. #include "cuicand.h"
  10. #include "cuicand2.h"
  11. #include "candmgr.h"
  12. #include "candprop.h"
  13. class CCandidateUI;
  14. class CCandWindow;
  15. //
  16. // CCommentListItem
  17. // = comment list item object =
  18. //
  19. class CCommentListItem : public CListItemBase
  20. {
  21. public:
  22. CCommentListItem( int iCandItem, CCandidateItem *pCandItem )
  23. {
  24. Assert( pCandItem != NULL );
  25. m_iCandItem = iCandItem;
  26. m_pCandItem = pCandItem;
  27. m_nHeight = 0;
  28. }
  29. virtual ~CCommentListItem( void )
  30. {
  31. }
  32. int GetICandItem( void )
  33. {
  34. return m_iCandItem;
  35. }
  36. CCandidateItem *GetCandidateItem( void )
  37. {
  38. return m_pCandItem;
  39. }
  40. void SetHeight( int nHeight )
  41. {
  42. m_nHeight = nHeight;
  43. }
  44. int GetHeight( void )
  45. {
  46. return m_nHeight;
  47. }
  48. protected:
  49. int m_iCandItem;
  50. CCandidateItem *m_pCandItem;
  51. int m_nHeight;
  52. };
  53. //
  54. // CUIFCommentList
  55. // = popup comment list obeject =
  56. //
  57. class CUIFCommentList : public CUIFListBase
  58. {
  59. public:
  60. CUIFCommentList( CUIFObject *pParent, DWORD dwID, const RECT *prc, DWORD dwStyle );
  61. virtual ~CUIFCommentList( void );
  62. void AddCommentItem( CCommentListItem *pListItem );
  63. CCommentListItem *GetCommentItem( int iListItem );
  64. virtual void SetRect( const RECT *prc );
  65. void InitItemHeight( void );
  66. int GetTotalHeight( void );
  67. int GetMinimumWidth( void );
  68. void SetTitleFont( HFONT hFont );
  69. void SetTextFont( HFONT hFont );
  70. protected:
  71. int m_cyTitle;
  72. int m_cyTitleMargin;
  73. int m_cxCommentMargin;
  74. int m_cyCommentMargin;
  75. HFONT m_hFontTitle;
  76. HFONT m_hFontText;
  77. //
  78. // CUIFListBase methods
  79. //
  80. virtual int GetItemHeight( int iItem );
  81. virtual void PaintItemProc( HDC hDC, RECT *prc, CListItemBase *pItem, BOOL fSelected );
  82. int PaintCommentProc( HDC hDC, const RECT *prc, LPCWSTR pwch, BOOL fCalcOnly );
  83. int CalcMinimumWidth( void );
  84. void CalcTitleHeight( void );
  85. void CalcItemHeight( void );
  86. void CalcItemHeightProc( HDC hDC, CCommentListItem *pListItem );
  87. };
  88. //
  89. // CPopupCommentWindow
  90. // = candidate window base class =
  91. //
  92. class CPopupCommentWindow : public CUIFWindow,
  93. public CCandListEventSink,
  94. public CCandUIPropertyEventSink
  95. {
  96. public:
  97. CPopupCommentWindow( CCandWindow *pCandWnd, CCandidateUI *pCandUI );
  98. virtual ~CPopupCommentWindow( void );
  99. //
  100. // CUIFWindow methods
  101. //
  102. virtual LPCTSTR GetClassName( void );
  103. virtual LPCTSTR GetWndTitle( void );
  104. virtual CUIFObject *Initialize( void );
  105. virtual void Move( int x, int y, int nWidth, int nHeight );
  106. virtual LRESULT OnWindowPosChanged( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
  107. virtual LRESULT OnObjectNotify( CUIFObject *pUIObj, DWORD dwCommand, LPARAM lParam );
  108. virtual void OnCreate( HWND hWnd );
  109. virtual void OnNCDestroy( HWND hWnd );
  110. //
  111. // CCandListEventSink methods
  112. //
  113. virtual void OnSetCandidateList( void );
  114. virtual void OnClearCandidateList( void );
  115. virtual void OnCandItemUpdate( void );
  116. virtual void OnSelectionChanged( void );
  117. //
  118. // CCandUIPropertyEventSink methods
  119. //
  120. virtual void OnPropertyUpdated( CANDUIPROPERTY prop, CANDUIPROPERTYEVENT event );
  121. void DestroyWnd( void );
  122. void LayoutWindow( BOOL fResize = FALSE );
  123. int LayoutWindowProc( RECT *prcWnd );
  124. void OnCandWindowMove( BOOL fResetAnyway );
  125. protected:
  126. CCandidateUI *m_pCandUI;
  127. CCandWindow *m_pCandWnd;
  128. CUIFWndFrame *m_pWndFrame;
  129. CUIFWndCaption *m_pCaption;
  130. CUIFCaptionButton *m_pCloseBtn;
  131. CUIFCommentList *m_pCommentList;
  132. HICON m_hIconClose;
  133. BOOL m_fUserMoved;
  134. void SetCommentListProc( void );
  135. void ClearCommentListProc( void );
  136. int CandItemFromListItem( int iListItem );
  137. void CalcPos( POINT *ppt, int nWidth, int nHeight );
  138. };
  139. #endif // WPOPUP_H