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.

404 lines
10 KiB

  1. //
  2. // cuiobj.h
  3. // UI object library - define UI objects
  4. //
  5. // CUIFObject
  6. // +- CUIFBorder border object
  7. // +- CUIFStatic static object
  8. // +- CUIFButton button object
  9. // | +- CUIFScrollButton scrollbar button object (used in CUIFScroll)
  10. // +- CUIFScrollButton scrollbar thumb object (used in CUIFScroll)
  11. // +- CUIFScroll scrollbar object
  12. // +- CUIFList listbox object
  13. // +- CUIFWindow window frame object (need to be at top of parent)
  14. //
  15. #ifndef CUICAND_H
  16. #define CUICAND_H
  17. #include "private.h"
  18. #include "cuilib.h"
  19. #include "candmgr.h"
  20. #include "candacc.h"
  21. #define CANDLISTACCITEM_MAX 9
  22. class CUIFCandListBase;
  23. //
  24. // CUIFSmartScrollButton
  25. //
  26. class CUIFSmartScrollButton : public CUIFScrollButton
  27. {
  28. public:
  29. CUIFSmartScrollButton( CUIFScroll *pUIScroll, const RECT *prc, DWORD dwStyle );
  30. ~CUIFSmartScrollButton( void );
  31. protected:
  32. void OnPaintNoTheme( HDC hDC );
  33. BOOL OnPaintTheme( HDC hDC );
  34. };
  35. //
  36. // CUIFScrollThumb
  37. //
  38. #define UISMARTSCROLLTHUMB_VERT 0x00000000
  39. #define UISMARTSCROLLTHUMB_HORZ 0x00010000
  40. class CUIFSmartScrollThumb : public CUIFScrollThumb
  41. {
  42. public:
  43. CUIFSmartScrollThumb( CUIFScroll *pUIScroll, const RECT *prc, DWORD dwStyle );
  44. virtual ~CUIFSmartScrollThumb( void );
  45. virtual void OnMouseIn( POINT pt );
  46. virtual void OnMouseOut( POINT pt );
  47. virtual void OnPaint( HDC hDC );
  48. protected:
  49. void OnPaintNoTheme( HDC hDC );
  50. BOOL OnPaintTheme( HDC hDC );
  51. BOOL m_fMouseIn;
  52. };
  53. //
  54. // CUIFSmartScroll
  55. //
  56. class CUIFSmartScroll : public CUIFScroll
  57. {
  58. public:
  59. CUIFSmartScroll( CUIFObject *pParent, DWORD dwID, const RECT *prc, DWORD dwStyle );
  60. virtual ~CUIFSmartScroll( void );
  61. virtual void SetStyle( DWORD dwStyle );
  62. virtual CUIFObject *Initialize( void );
  63. protected:
  64. void OnPaintNoTheme( HDC hDC );
  65. BOOL OnPaintTheme( HDC hDC );
  66. };
  67. //
  68. // CCandListItem
  69. // = candidate list item object =
  70. //
  71. class CCandListItem : public CListItemBase
  72. {
  73. public:
  74. CCandListItem( int iListItem, int iCandItem, CCandidateItem *pCandItem )
  75. {
  76. Assert( pCandItem != NULL );
  77. m_iListItem = iListItem;
  78. m_iCandItem = iCandItem;
  79. m_pCandItem = pCandItem;
  80. }
  81. virtual ~CCandListItem( void )
  82. {
  83. }
  84. int GetIListItem( void )
  85. {
  86. return m_iListItem;
  87. }
  88. int GetICandItem( void )
  89. {
  90. return m_iCandItem;
  91. }
  92. CCandidateItem *GetCandidateItem( void )
  93. {
  94. return m_pCandItem;
  95. }
  96. protected:
  97. int m_iListItem;
  98. int m_iCandItem;
  99. CCandidateItem *m_pCandItem;
  100. };
  101. //
  102. // CCandListAccItem
  103. // = candidate list accessible item =
  104. //
  105. class CCandListAccItem : public CCandAccItem
  106. {
  107. public:
  108. CCandListAccItem( CUIFCandListBase *pListUIObj, int iLine );
  109. virtual ~CCandListAccItem( void );
  110. //
  111. // CandAccItem method
  112. //
  113. virtual BSTR GetAccName( void );
  114. virtual BSTR GetAccValue( void );
  115. virtual LONG GetAccRole( void );
  116. virtual LONG GetAccState( void );
  117. virtual void GetAccLocation( RECT *prc );
  118. void OnSelect( void );
  119. protected:
  120. CUIFCandListBase *m_pListUIObj;
  121. CUIFCandListBase *m_pOptionsListUIObj;
  122. int m_iLine;
  123. };
  124. //
  125. // CUIFCandListBase
  126. // = candidate list UI object base class =
  127. //
  128. class CUIFCandListBase
  129. {
  130. public:
  131. CUIFCandListBase( void );
  132. virtual ~CUIFCandListBase( void );
  133. //
  134. //
  135. //
  136. virtual int AddCandItem( CCandListItem *pCandListItem ) = 0; /* PURE */
  137. virtual int GetItemCount( void ) = 0; /* PURE */
  138. virtual BOOL IsItemSelectable( int iListItem ) = 0; /* PURE */
  139. virtual CCandListItem *GetCandItem( int iItem ) = 0; /* PURE */
  140. virtual void DelAllCandItem( void ) = 0; /* PURE */
  141. virtual void SetCurSel( int iSelection ) = 0; /* PURE */
  142. virtual int GetCurSel( void ) = 0; /* PURE */
  143. virtual int GetTopItem( void ) = 0; /* PURE */
  144. virtual int GetBottomItem( void ) = 0; /* PURE */
  145. virtual BOOL IsVisible( void ) = 0; /* PURE */
  146. virtual void GetRect( RECT *prc ) = 0; /* PURE */
  147. virtual void GetItemRect( int iItem, RECT *prc ) = 0; /* PURE */
  148. virtual void SetInlineCommentPos( int cx ) = 0; /* PURE */
  149. virtual void SetInlineCommentFont( HFONT hFont ) = 0; /* PURE */
  150. virtual void SetIndexFont( HFONT hFont ) = 0; /* PURE */
  151. virtual void SetCandList( CCandidateList *pCandList ) = 0; /* PURE */
  152. // accessibility functions
  153. virtual BSTR GetAccNameProc( int iItem ) = 0; /* PURE */
  154. virtual BSTR GetAccValueProc( int iItem ) = 0; /* PURE */
  155. virtual LONG GetAccRoleProc( int iItem ) = 0; /* PURE */
  156. virtual LONG GetAccStateProc( int iItem ) = 0; /* PURE */
  157. virtual void GetAccLocationProc( int iItem, RECT *prc ) = 0; /* PURE */
  158. void InitAccItems( CCandAccessible *pCandAcc );
  159. CCandListAccItem *GetListAccItem( int i );
  160. CCandidateItem *GetCandidateItem( int iItem );
  161. void SetIconPopupComment( HICON hIconOn, HICON hIconOff );
  162. protected:
  163. CCandListAccItem *m_rgListAccItem[ CANDLISTACCITEM_MAX ];
  164. HFONT m_hFontInlineComment;
  165. HFONT m_hFontIndex;
  166. HICON m_hIconPopupOn;
  167. HICON m_hIconPopupOff;
  168. };
  169. //
  170. // CUIFCandList
  171. // = candidate list UI object =
  172. //
  173. // notification code
  174. #define UICANDLIST_HOVERITEM 0x00010000
  175. class CUIFCandList : public CUIFListBase,
  176. public CUIFCandListBase
  177. {
  178. public:
  179. CUIFCandList( CUIFObject *pParent, DWORD dwID, const RECT *prc, DWORD dwStyle );
  180. virtual ~CUIFCandList( void );
  181. //
  182. // CUIFCandListBase methods
  183. //
  184. virtual int AddCandItem( CCandListItem *pCandListItem );
  185. virtual int GetItemCount( void );
  186. virtual BOOL IsItemSelectable( int iListItem );
  187. virtual CCandListItem *GetCandItem( int iItem );
  188. virtual void DelAllCandItem( void );
  189. virtual void SetCurSel( int iSelection );
  190. virtual int GetCurSel( void );
  191. virtual int GetTopItem( void );
  192. virtual int GetBottomItem( void );
  193. virtual BOOL IsVisible( void );
  194. virtual void GetRect( RECT *prc );
  195. virtual void GetItemRect( int iItem, RECT *prc );
  196. virtual void SetInlineCommentPos( int cx );
  197. virtual void SetInlineCommentFont( HFONT hFont );
  198. virtual void SetIndexFont( HFONT hFont );
  199. virtual void SetCandList( CCandidateList *pCandList );
  200. virtual BSTR GetAccNameProc( int iItem );
  201. virtual BSTR GetAccValueProc( int iItem );
  202. virtual LONG GetAccRoleProc( int iItem );
  203. virtual LONG GetAccStateProc( int iItem );
  204. virtual void GetAccLocationProc( int iItem, RECT *prc );
  205. //
  206. // CUIFObject methods
  207. //
  208. virtual void OnLButtonDown( POINT pt );
  209. virtual void OnLButtonUp( POINT pt );
  210. virtual void OnMouseMove( POINT pt );
  211. virtual void OnMouseIn( POINT pt );
  212. virtual void OnMouseOut( POINT pt );
  213. virtual void OnPaint( HDC hDC );
  214. void SetStartIndex( int iIndexStart );
  215. void SetExtraTopSpace( int nSize );
  216. void SetExtraBottomSpace( int nSize );
  217. int GetExtraTopSpace( void );
  218. int GetExtraBottomSpace( void );
  219. protected:
  220. //
  221. // CUIFListBase methods
  222. //
  223. virtual void GetLineRect( int iLine, RECT *prc );
  224. virtual void GetScrollBarRect( RECT *prc );
  225. virtual DWORD GetScrollBarStyle( void );
  226. virtual CUIFScroll *CreateScrollBarObj( CUIFObject *pParent, DWORD dwID, RECT *prc, DWORD dwStyle );
  227. void PaintItemProc( HDC hDC, RECT *prc, int iIndex, CCandListItem *pItem, BOOL fSelected );
  228. void PaintItemText( HDC hDC, RECT *prcText, RECT *prcClip, RECT *prcIndex, CCandidateItem *pCandItem, BOOL fSelected );
  229. void SetItemHover( int iItem );
  230. int m_iIndexStart;
  231. int m_nExtTopSpace;
  232. int m_nExtBottomSpace;
  233. int m_cxInlineCommentPos;
  234. int m_iItemHover;
  235. };
  236. //
  237. //
  238. //
  239. class CUIFExtCandList : public CUIFCandList
  240. {
  241. public:
  242. CUIFExtCandList( CUIFObject *pParent, DWORD dwID, const RECT *prc, DWORD dwStyle );
  243. virtual ~CUIFExtCandList( void );
  244. //
  245. // CUIFObject methods
  246. //
  247. virtual void OnTimer( void );
  248. virtual void OnLButtonUp( POINT pt );
  249. virtual void OnMouseMove( POINT pt );
  250. virtual void OnMouseOut( POINT pt );
  251. };
  252. //
  253. // CUIFCandRawData
  254. // = candidate raw data UI object =
  255. //
  256. #define UICANDRAWDATA_HORZTB 0x00000000
  257. #define UICANDRAWDATA_HORZBT 0x00000001
  258. #define UICANDRAWDATA_VERTLR 0x00000002
  259. #define UICANDRAWDATA_VERTRL 0x00000003
  260. #define UICANDRAWDATA_CLICKED 0x00000001
  261. class CUIFCandRawData : public CUIFObject
  262. {
  263. public:
  264. CUIFCandRawData( CUIFObject *pParent, DWORD dwID, const RECT *prc, DWORD dwStyle );
  265. virtual ~CUIFCandRawData( void );
  266. void ClearData( void );
  267. void SetText( LPCWSTR pwchText );
  268. void SetBitmap( HBITMAP hBitmap );
  269. void SetMetaFile( HENHMETAFILE hEnhMetaFile );
  270. int GetText( LPWSTR pwchBuf, int cwchBuf );
  271. HBITMAP GetBitmap( void );
  272. HENHMETAFILE GetMetaFile( void );
  273. virtual void SetFont( HFONT hFont );
  274. virtual void SetStyle( DWORD dwStyle );
  275. virtual void OnPaint( HDC hDC );
  276. virtual void OnLButtonDown( POINT pt );
  277. virtual void OnLButtonUp( POINT pt );
  278. protected:
  279. LPWSTR m_pwchText;
  280. HBITMAP m_hBitmap;
  281. HENHMETAFILE m_hEnhMetaFile;
  282. HBITMAP m_hBmpCache;
  283. void ClearCache( void );
  284. void DrawTextProc( HDC hDC, const RECT *prc );
  285. void DrawBitmapProc( HDC hDC, const RECT *prc );
  286. void DrawMetaFileProc( HDC hDC, const RECT *prc );
  287. };
  288. //
  289. // CUIFCandBorder
  290. // = border object in candidate UI =
  291. //
  292. class CUIFCandBorder : public CUIFBorder
  293. {
  294. public:
  295. CUIFCandBorder( CUIFObject *pParent, DWORD dwID, const RECT *prc, DWORD dwStyle );
  296. virtual ~CUIFCandBorder( void );
  297. void OnPaint( HDC hDC );
  298. };
  299. //
  300. // CUIFCandMenuButton
  301. // = candidate menu button =
  302. //
  303. class CUIFCandMenuButton : public CUIFButton2, public CCandAccItem
  304. {
  305. public:
  306. CUIFCandMenuButton( CUIFObject *pParent, DWORD dwID, const RECT *prc, DWORD dwStyle );
  307. virtual ~CUIFCandMenuButton( void );
  308. //
  309. // CandAccItem method
  310. //
  311. virtual BSTR GetAccName( void );
  312. virtual BSTR GetAccValue( void );
  313. virtual LONG GetAccRole( void );
  314. virtual LONG GetAccState( void );
  315. virtual void GetAccLocation( RECT *prc );
  316. protected:
  317. virtual void SetStatus( DWORD dwStatus );
  318. };
  319. #endif /* CUIOBJ_H */