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.

853 lines
23 KiB

  1. //
  2. // cuiobj.h
  3. // = UI object library - define UI objects =
  4. //
  5. //
  6. // CUIFObject
  7. // +- CUIFBorder border object
  8. // +- CUIFStatic static object
  9. // +- CUIFButton button object
  10. // | +- CUIFScrollButton scrollbar button object (used in CUIFScroll)
  11. // +- CUIFScrollButton scrollbar thumb object (used in CUIFScroll)
  12. // +- CUIFScroll scrollbar object
  13. // +- CUIFList listbox object
  14. // +- CUIFGripper gripper object
  15. // +- CUIFWindow window frame object (need to be at top of parent)
  16. //
  17. #ifndef CUIOBJ_H
  18. #define CUIOBJ_H
  19. #include "cuischem.h"
  20. #include "cuiarray.h"
  21. #include "cuitheme.h"
  22. #include "cuiicon.h"
  23. class CUIFWindow;
  24. //
  25. // CUIFObject
  26. //-----------------------------------------------------------------------------
  27. //
  28. // CUIFObject
  29. // = base class of UI object =
  30. //
  31. class CUIFObject: public CUIFTheme
  32. {
  33. public:
  34. CUIFObject( CUIFObject *pParent, DWORD dwID, const RECT *prc, DWORD dwStyle );
  35. virtual ~CUIFObject( void );
  36. virtual CUIFObject *Initialize( void );
  37. virtual void OnPaint( HDC hDC );
  38. virtual void OnTimer( void ) { return; }
  39. virtual void OnLButtonDown( POINT pt ) { return; }
  40. virtual void OnMButtonDown( POINT pt ) { return; }
  41. virtual void OnRButtonDown( POINT pt ) { return; }
  42. virtual void OnLButtonUp( POINT pt ) { return; }
  43. virtual void OnMButtonUp( POINT pt ) { return; }
  44. virtual void OnRButtonUp( POINT pt ) { return; }
  45. virtual void OnMouseMove( POINT pt ) { return; }
  46. virtual void OnMouseIn( POINT pt ) { return; }
  47. virtual void OnMouseOut( POINT pt ) { return; }
  48. virtual BOOL OnSetCursor( UINT uMsg, POINT pt ) { return FALSE; }
  49. virtual void GetRect( RECT *prc );
  50. virtual void SetRect( const RECT *prc );
  51. virtual BOOL PtInObject( POINT pt );
  52. virtual void PaintObject( HDC hDC, const RECT *prcUpdate );
  53. virtual void CallOnPaint(void);
  54. virtual void Enable( BOOL fEnable );
  55. __inline BOOL IsEnabled( void )
  56. {
  57. return m_fEnabled;
  58. }
  59. virtual void Show( BOOL fShow );
  60. __inline BOOL IsVisible( void )
  61. {
  62. return m_fVisible;
  63. }
  64. virtual void SetFontToThis( HFONT hFont );
  65. virtual void SetFont( HFONT hFont );
  66. __inline HFONT GetFont( void )
  67. {
  68. return m_hFont;
  69. }
  70. virtual void SetStyle( DWORD dwStyle );
  71. __inline DWORD GetStyle( void )
  72. {
  73. return m_dwStyle;
  74. }
  75. __inline DWORD GetID( void )
  76. {
  77. return m_dwID;
  78. }
  79. virtual void AddUIObj( CUIFObject *pUIObj );
  80. virtual void RemoveUIObj( CUIFObject *pUIObj );
  81. CUIFObject *ObjectFromPoint( POINT pt );
  82. __inline CUIFWindow *GetUIWnd( void )
  83. {
  84. return m_pUIWnd;
  85. }
  86. void SetScheme(CUIFScheme *pCUIFScheme);
  87. __inline CUIFScheme *GetUIFScheme( void )
  88. {
  89. return m_pUIFScheme;
  90. }
  91. virtual LRESULT OnObjectNotify( CUIFObject *pUIObj, DWORD dwCode, LPARAM lParam );
  92. virtual void SetToolTip( LPCWSTR pwchToolTip );
  93. virtual LPCWSTR GetToolTip( void );
  94. //
  95. // Start ToolTip notification. If this return TRUE, the default tooltip
  96. // won't be shown.
  97. //
  98. virtual BOOL OnShowToolTip( void ) {return FALSE;}
  99. virtual void OnHideToolTip( void ) {return;}
  100. virtual void DetachWndObj( void );
  101. virtual void ClearWndObj( void );
  102. #if defined(_DEBUG) || defined(DEBUG)
  103. __inline BOOL FInitialized( void )
  104. {
  105. return m_fInitialized;
  106. }
  107. #endif /* DEBUG */
  108. protected:
  109. CUIFObject *m_pParent;
  110. CUIFWindow *m_pUIWnd;
  111. CUIFScheme *m_pUIFScheme;
  112. CUIFObjectArray<CUIFObject> m_ChildList;
  113. DWORD m_dwID;
  114. DWORD m_dwStyle;
  115. RECT m_rc;
  116. BOOL m_fEnabled;
  117. BOOL m_fVisible;
  118. HFONT m_hFont;
  119. BOOL m_fUseCustomFont;
  120. LPWSTR m_pwchToolTip;
  121. //
  122. // Theme support
  123. //
  124. virtual BOOL OnPaintTheme( HDC hDC ) {return FALSE;}
  125. virtual void OnPaintNoTheme( HDC hDC ) {return;}
  126. virtual void ClearTheme();
  127. void StartCapture( void );
  128. void EndCapture( void );
  129. void StartTimer( UINT uElapse );
  130. void EndTimer( void );
  131. BOOL IsCapture( void );
  132. BOOL IsTimer( void );
  133. LRESULT NotifyCommand( DWORD dwCode, LPARAM lParam );
  134. int GetFontHeight( void );
  135. //
  136. // uischeme functions
  137. //
  138. COLORREF GetUIFColor( UIFCOLOR iCol );
  139. HBRUSH GetUIFBrush( UIFCOLOR iCol );
  140. //
  141. //
  142. //
  143. __inline const RECT &GetRectRef( void ) const
  144. {
  145. return this->m_rc;
  146. }
  147. __inline DWORD GetStyleBits( DWORD dwMaskBits )
  148. {
  149. return (m_dwStyle & dwMaskBits);
  150. }
  151. __inline BOOL FHasStyle( DWORD dwStyleBit )
  152. {
  153. return ((m_dwStyle & dwStyleBit ) != 0);
  154. }
  155. BOOL IsRTL();
  156. public:
  157. POINT m_pointPreferredSize;
  158. private:
  159. #if defined(_DEBUG) || defined(DEBUG)
  160. BOOL m_fInitialized;
  161. #endif /* DEBUG */
  162. };
  163. //
  164. // CUIFBorder
  165. //-----------------------------------------------------------------------------
  166. // UIFBorder style
  167. #define UIBORDER_HORZ 0x00000000 // horizontal border
  168. #define UIBORDER_VERT 0x00000001 // vertial border
  169. #define UIBORDER_DIRMASK 0x00000001 // (mask bits) border direction
  170. //
  171. // CUIFBorder
  172. // = border UI object =
  173. //
  174. class CUIFBorder : public CUIFObject
  175. {
  176. public:
  177. CUIFBorder( CUIFObject *pParent, DWORD dwID, const RECT *prc, DWORD dwStyle );
  178. ~CUIFBorder( void );
  179. void OnPaint( HDC hDC );
  180. };
  181. //
  182. // CUIFStatic
  183. //-----------------------------------------------------------------------------
  184. // UIStatic style
  185. #define UISTATIC_LEFT 0x00000000 // left alignment
  186. #define UISTATIC_CENTER 0x00000001 // center alignment (horizontal)
  187. #define UISTATIC_RIGHT 0x00000002 // right alignment
  188. #define UISTATIC_TOP 0x00000000 // top alignment
  189. #define UISTATIC_VCENTER 0x00000010 // center alignment (vertical)
  190. #define UISTATIC_BOTTOM 0x00000020 // bottom alignment
  191. #define UISTATIC_HALIGNMASK 0x00000003 // (mask bits) horizontal alignment mask bits
  192. #define UISTATIC_VALIGNMASK 0x00000030 // (mask bits) vertiacal alignment mask bits
  193. //
  194. // CUIFStatic
  195. // = static UI object =
  196. //
  197. class CUIFStatic : public CUIFObject
  198. {
  199. public:
  200. CUIFStatic( CUIFObject *pParent, DWORD dwID, const RECT *prc, DWORD dwStyle );
  201. virtual ~CUIFStatic( void );
  202. virtual void OnPaint( HDC hDC );
  203. virtual void SetText( LPCWSTR pwchText);
  204. virtual int GetText( LPWSTR pwchBuf, int cwchBuf );
  205. protected:
  206. LPWSTR m_pwchText;
  207. };
  208. //
  209. // CUIFButton
  210. //-----------------------------------------------------------------------------
  211. // UIFButton style
  212. #define UIBUTTON_LEFT 0x00000000 // horizontal alignment - left align
  213. #define UIBUTTON_CENTER 0x00000001 // horizontal alignment - center align
  214. #define UIBUTTON_RIGHT 0x00000002 // horizontal alignment - right align
  215. #define UIBUTTON_TOP 0x00000000 // vertical alignment - top align
  216. #define UIBUTTON_VCENTER 0x00000004 // vertical alignment - center
  217. #define UIBUTTON_BOTTOM 0x00000008 // vertical alignment - bottom
  218. #define UIBUTTON_PUSH 0x00000000 // button type - push button
  219. #define UIBUTTON_TOGGLE 0x00000010 // button type - toggle button
  220. #define UIBUTTON_PUSHDOWN 0x00000020 // button type - pushdown button
  221. #define UIBUTTON_FITIMAGE 0x00000100 // button style - fit image to the client area
  222. #define UIBUTTON_SUNKENONMOUSEDOWN 0x00000200 // button style - sunken on mouse down
  223. #define UIBUTTON_VERTICAL 0x00000400 // button style - vertical text drawing
  224. #define UIBUTTON_HALIGNMASK 0x00000003 // (mask bits) horizontal alignment
  225. #define UIBUTTON_VALIGNMASK 0x0000000c // (mask bits) vertiacal alignment
  226. #define UIBUTTON_TYPEMASK 0x00000030 // (mask bits) button type (push/toggle/pushdown)
  227. // UIFButton notification code
  228. #define UIBUTTON_PRESSED 0x00000001
  229. // UIFButton status
  230. #define UIBUTTON_NORMAL 0x00000000
  231. #define UIBUTTON_DOWN 0x00000001
  232. #define UIBUTTON_HOVER 0x00000002
  233. #define UIBUTTON_DOWNOUT 0x00000003
  234. //
  235. // CUIFButton
  236. // = button UI object =
  237. //
  238. class CUIFButton : public CUIFObject
  239. {
  240. public:
  241. CUIFButton( CUIFObject *pParent, DWORD dwID, const RECT *prc, DWORD dwStyle );
  242. virtual ~CUIFButton( void );
  243. virtual void OnPaintNoTheme( HDC hDC );
  244. virtual void OnLButtonDown( POINT pt );
  245. virtual void OnLButtonUp( POINT pt );
  246. virtual void OnMouseIn( POINT pt );
  247. virtual void OnMouseOut( POINT pt );
  248. virtual void Enable( BOOL fEnable );
  249. void SetText( LPCWSTR pwch );
  250. void SetIcon( HICON hIcon );
  251. void SetIcon( LPCTSTR lpszResName );
  252. void SetBitmap( HBITMAP hBmp );
  253. void SetBitmap( LPCTSTR lpszResName );
  254. void SetBitmapMask( HBITMAP hBmp );
  255. void SetBitmapMask( LPCTSTR lpszResName );
  256. __inline LPCWSTR GetText( void ) { return m_pwchText; }
  257. __inline HICON GetIcon( void ) { return m_hIcon; }
  258. __inline HBITMAP GetBitmap( void ) { return m_hBmp; }
  259. __inline HBITMAP GetBitmapMask( void ) { return m_hBmpMask; }
  260. BOOL GetToggleState( void );
  261. void SetToggleState( BOOL fToggle );
  262. DWORD GetDCF()
  263. {
  264. return (GetStyle() & UIBUTTON_SUNKENONMOUSEDOWN) ? UIFDCF_BUTTONSUNKEN : UIFDCF_BUTTON;
  265. }
  266. BOOL IsVertical()
  267. {
  268. return (GetStyle() & UIBUTTON_VERTICAL) ? TRUE : FALSE;
  269. }
  270. protected:
  271. DWORD m_dwStatus;
  272. LPWSTR m_pwchText;
  273. CUIFIcon m_hIcon;
  274. HBITMAP m_hBmp;
  275. HBITMAP m_hBmpMask;
  276. BOOL m_fToggled;
  277. SIZE m_sizeIcon;
  278. SIZE m_sizeText;
  279. SIZE m_sizeBmp;
  280. virtual void SetStatus( DWORD dwStatus );
  281. void DrawEdgeProc( HDC hDC, const RECT *prc, BOOL fDown );
  282. void DrawTextProc( HDC hDC, const RECT *prc, BOOL fDown );
  283. void DrawIconProc( HDC hDC, const RECT *prc, BOOL fDown );
  284. void DrawBitmapProc( HDC hDC, const RECT *prc, BOOL fDown );
  285. void GetTextSize( LPCWSTR pwch, SIZE *psize );
  286. void GetIconSize( HICON hIcon, SIZE *psize );
  287. void GetBitmapSize( HBITMAP hBmp, SIZE *psize );
  288. };
  289. //
  290. // CUIFButton2
  291. // = button UI object =
  292. //
  293. class CUIFButton2 : public CUIFButton
  294. {
  295. public:
  296. CUIFButton2( CUIFObject *pParent, DWORD dwID, const RECT *prc, DWORD dwStyle );
  297. virtual ~CUIFButton2( void );
  298. protected:
  299. virtual BOOL OnPaintTheme( HDC hDC );
  300. virtual void OnPaintNoTheme( HDC hDC );
  301. private:
  302. DWORD MakeDrawFlag();
  303. };
  304. //
  305. // CUIFScroll
  306. //-----------------------------------------------------------------------------
  307. class CUIFScroll;
  308. //
  309. // CUIFScrollButton
  310. // = scrollbar button UI object =
  311. //
  312. // UIFScrollButton style
  313. #define UISCROLLBUTTON_LEFT 0x00000000
  314. #define UISCROLLBUTTON_UP 0x00010000
  315. #define UISCROLLBUTTON_RIGHT 0x00020000
  316. #define UISCROLLBUTTON_DOWN 0x00030000
  317. #define UISCROLLBUTTON_DIRMASK 0x00030000 /* mask bits */
  318. // UIFScrollButton notification code
  319. #define UISCROLLBUTTON_PRESSED 0x00010000
  320. //
  321. class CUIFScrollButton : public CUIFButton
  322. {
  323. public:
  324. CUIFScrollButton( CUIFScroll *pUIScroll, const RECT *prc, DWORD dwStyle );
  325. ~CUIFScrollButton( void );
  326. virtual void OnLButtonDown( POINT pt );
  327. virtual void OnLButtonUp( POINT pt );
  328. virtual void OnMouseIn( POINT pt );
  329. virtual void OnMouseOut( POINT pt );
  330. virtual void OnPaint( HDC hDC );
  331. virtual void OnTimer( void );
  332. };
  333. //
  334. // CUIFScrollThumb
  335. // = scrollbar thumb UI object =
  336. //
  337. // UIFScrollThumb notifucation code
  338. #define UISCROLLTHUMB_MOVING 0x00000001
  339. #define UISCROLLTHUMB_MOVED 0x00000002
  340. //
  341. class CUIFScrollThumb : public CUIFObject
  342. {
  343. public:
  344. CUIFScrollThumb( CUIFScroll *pUIScroll, const RECT *prc, DWORD dwStyle );
  345. virtual ~CUIFScrollThumb( void );
  346. virtual void OnPaint(HDC hDC);
  347. virtual void OnLButtonDown( POINT pt );
  348. virtual void OnLButtonUp( POINT pt );
  349. virtual void OnMouseMove( POINT pt );
  350. void SetScrollArea( RECT *prc );
  351. protected:
  352. void DragProc( POINT pt, BOOL fEndDrag );
  353. RECT m_rcScrollArea;
  354. POINT m_ptDrag;
  355. POINT m_ptDragOrg;
  356. };
  357. //
  358. // CUIFScroll
  359. // = scrollbar UI object =
  360. //
  361. // UIFScroll style
  362. #define UISCROLL_VERTTB 0x00000000
  363. #define UISCROLL_VERTBT 0x00000001
  364. #define UISCROLL_HORZLR 0x00000002
  365. #define UISCROLL_HORZRL 0x00000003
  366. #define UISCROLL_DIRMASK 0x00000003 /* mask bits */
  367. // UIFScroll scroll page direction
  368. #define UISCROLL_NONE 0x00000000
  369. #define UISCROLL_PAGEDOWN 0x00000001 // page left
  370. #define UISCROLL_PAGEUP 0x00000002 // page right
  371. // UIFScroll notify codes
  372. #define UISCROLLNOTIFY_SCROLLED 0x00000001 // scrollbar has been moved
  373. #define UISCROLLNOTIFY_SCROLLLN 0x00000002 // scroll up/down line
  374. // UIFScroll info
  375. typedef struct _UIFSCROLLINFO
  376. {
  377. int nMax;
  378. int nPage;
  379. int nPos;
  380. } UIFSCROLLINFO;
  381. //
  382. class CUIFScroll : public CUIFObject
  383. {
  384. public:
  385. CUIFScroll( CUIFObject *pParent, DWORD dwID, const RECT *prc, DWORD dwStyle );
  386. virtual ~CUIFScroll( void );
  387. virtual CUIFObject *Initialize( void );
  388. virtual void OnPaint(HDC hDC);
  389. virtual void OnLButtonDown( POINT pt );
  390. virtual void OnLButtonUp( POINT pt );
  391. virtual void OnMouseIn( POINT pt );
  392. virtual void OnMouseOut( POINT pt );
  393. virtual void SetRect( const RECT *prc );
  394. virtual void SetStyle( DWORD dwStyle );
  395. virtual void Show( BOOL fShow );
  396. virtual void OnTimer( void );
  397. virtual LRESULT OnObjectNotify( CUIFObject *pUIObj, DWORD dwCommand, LPARAM lParam );
  398. void SetScrollInfo( UIFSCROLLINFO *pScrollInfo );
  399. void GetScrollInfo( UIFSCROLLINFO *pScrollInfo );
  400. protected:
  401. virtual void GetMetrics( void );
  402. void SetCurPos( int nPos, BOOL fAdjustThumb = TRUE );
  403. BOOL GetThumbRect( RECT *prc );
  404. BOOL GetBtnUpRect( RECT *prc );
  405. BOOL GetBtnDnRect( RECT *prc );
  406. DWORD GetScrollThumbStyle( void );
  407. DWORD GetScrollUpBtnStyle( void );
  408. DWORD GetScrollDnBtnStyle( void );
  409. void GetScrollArea( RECT *prc );
  410. void GetPageUpArea( RECT *prc );
  411. void GetPageDnArea( RECT *prc );
  412. __inline void ShiftLine( int nLine )
  413. {
  414. SetCurPos( m_ScrollInfo.nPos + nLine );
  415. }
  416. __inline void ShiftPage( int nPage )
  417. {
  418. SetCurPos( m_ScrollInfo.nPos + m_ScrollInfo.nPage * nPage );
  419. }
  420. __inline BOOL PtInPageUpArea( POINT pt )
  421. {
  422. RECT rc;
  423. GetPageUpArea( &rc );
  424. return PtInRect( &rc, pt );
  425. }
  426. __inline BOOL PtInPageDnArea( POINT pt )
  427. {
  428. RECT rc;
  429. GetPageDnArea( &rc );
  430. return PtInRect( &rc, pt );
  431. }
  432. CUIFScrollButton *m_pBtnUp;
  433. CUIFScrollButton *m_pBtnDn;
  434. CUIFScrollThumb *m_pThumb;
  435. UIFSCROLLINFO m_ScrollInfo;
  436. SIZE m_sizeScrollBtn;
  437. BOOL m_fScrollPage;
  438. DWORD m_dwScrollDir;
  439. };
  440. //
  441. // CUIFListBase
  442. //-----------------------------------------------------------------------------
  443. // UIFList style
  444. #define UILIST_HORZTB 0x00000000
  445. #define UILIST_HORZBT 0x00000001
  446. #define UILIST_VERTLR 0x00000002
  447. #define UILIST_VERTRL 0x00000003
  448. #define UILIST_DISABLENOSCROLL 0x00000010
  449. #define UILIST_HORZ UILIST_HORZTB /* for compatibility */
  450. #define UILIST_VERT UILIST_VERTRL /* for compatibility */
  451. #define UILIST_FIXEDHEIGHT 0x00000000
  452. #define UILIST_VARIABLEHEIGHT 0x00000020
  453. #define UILIST_ICONSNOTNUMBERS 0x00000040
  454. #define UILIST_DIRMASK 0x00000003 /* mask bits */
  455. // UIFList notification code
  456. #define UILIST_SELECTED 0x00000001
  457. #define UILIST_SELCHANGED 0x00000002
  458. //
  459. // CListItemBase
  460. // = list item data object base class =
  461. //
  462. class CListItemBase
  463. {
  464. public:
  465. CListItemBase( void )
  466. {
  467. }
  468. virtual ~CListItemBase( void )
  469. {
  470. }
  471. };
  472. //
  473. // CUIFListBase
  474. // = list UI object base class =
  475. //
  476. class CUIFListBase : public CUIFObject
  477. {
  478. public:
  479. CUIFListBase( CUIFObject *pParent, DWORD dwID, const RECT *prc, DWORD dwStyle );
  480. virtual ~CUIFListBase( void );
  481. //
  482. // CUIFObject method
  483. //
  484. virtual CUIFObject *Initialize( void );
  485. virtual void OnPaint( HDC hDC );
  486. virtual void OnLButtonDown( POINT pt );
  487. virtual void OnLButtonUp( POINT pt );
  488. virtual void OnMouseMove( POINT pt );
  489. virtual void OnTimer( void );
  490. virtual void SetRect( const RECT *prc );
  491. virtual void SetStyle( DWORD dwStyle );
  492. virtual LRESULT OnObjectNotify( CUIFObject *pUIObj, DWORD dwCommand, LPARAM lParam );
  493. int AddItem( CListItemBase *pItem );
  494. int GetCount( void );
  495. CListItemBase *GetItem( int iItem );
  496. void DelItem( int iItem );
  497. void DelAllItem( void );
  498. void SetSelection( int iSelection, BOOL fRedraw );
  499. void ClearSelection( BOOL fRedraw );
  500. void SetLineHeight( int nLineHeight );
  501. void SetTop( int nStart, BOOL fSetScrollPos );
  502. int GetSelection( void );
  503. int GetLineHeight( void );
  504. int GetTop( void );
  505. int GetBottom( void );
  506. int GetVisibleCount( void );
  507. protected:
  508. CUIFObjectArray<CListItemBase> m_listItem;
  509. int m_nItem;
  510. int m_nItemVisible;
  511. int m_iItemTop;
  512. int m_iItemSelect;
  513. int m_nLineHeight;
  514. CUIFScroll *m_pUIScroll;
  515. virtual int GetItemHeight( int iItem );
  516. virtual int GetListHeight( void );
  517. virtual void GetLineRect( int iLine, RECT *prc );
  518. virtual void GetScrollBarRect( RECT *prc );
  519. virtual DWORD GetScrollBarStyle( void );
  520. virtual CUIFScroll *CreateScrollBarObj( CUIFObject *pParent, DWORD dwID, RECT *prc, DWORD dwStyle );
  521. virtual void PaintItemProc( HDC hDC, RECT *prc, CListItemBase *pItem, BOOL fSelected );
  522. int ListItemFromPoint( POINT pt );
  523. void CalcVisibleCount( void );
  524. void UpdateScrollBar( void );
  525. };
  526. //
  527. // CUIFList
  528. //-----------------------------------------------------------------------------
  529. //
  530. // CUIFList
  531. // = list UI object =
  532. //
  533. class CUIFList : public CUIFListBase
  534. {
  535. public:
  536. CUIFList( CUIFObject *pParent, DWORD dwID, const RECT *prc, DWORD dwStyle );
  537. virtual ~CUIFList( void );
  538. int AddString( WCHAR *psz );
  539. LPCWSTR GetString( int iID );
  540. void DeleteString( int iID );
  541. void DeleteAllString( void );
  542. void SetPrivateData( int iID, DWORD dw );
  543. DWORD GetPrivateData( int iID );
  544. protected:
  545. virtual void PaintItemProc( HDC hDC, RECT *prc, CListItemBase *pItem, BOOL fSelected );
  546. int ItemFromID( int iID );
  547. };
  548. //
  549. // CUIFGripper
  550. //-----------------------------------------------------------------------------
  551. //
  552. // CUIFGripper
  553. // = gripper UI object =
  554. //
  555. #define UIGRIPPER_VERTICAL 0x00000001
  556. //
  557. // Gripper Theme Margin
  558. //
  559. #define CUI_GRIPPER_THEME_MARGIN 2
  560. class CUIFGripper : public CUIFObject
  561. {
  562. public:
  563. CUIFGripper( CUIFObject *pParent, const RECT *prc, DWORD dwStyle = 0);
  564. virtual ~CUIFGripper( void );
  565. virtual void SetStyle( DWORD dwStyle );
  566. virtual void OnLButtonDown( POINT pt );
  567. virtual void OnLButtonUp( POINT pt );
  568. virtual void OnMouseMove( POINT pt );
  569. virtual BOOL OnSetCursor( UINT uMsg, POINT pt );
  570. protected:
  571. virtual BOOL OnPaintTheme( HDC hDC );
  572. virtual void OnPaintNoTheme( HDC hDC );
  573. private:
  574. BOOL IsVertical()
  575. {
  576. return (GetStyle() & UIGRIPPER_VERTICAL) ? TRUE : FALSE;
  577. }
  578. POINT _ptCur;
  579. };
  580. //
  581. // CUIFWndFrame
  582. //-----------------------------------------------------------------------------
  583. //
  584. // CUIFWndFrame
  585. // = window frame obeject =
  586. //
  587. // CUIFWndFrame styles
  588. #define UIWNDFRAME_THIN 0x00000000 // frame style: thin
  589. #define UIWNDFRAME_THICK 0x00000001 // frame style: thick
  590. #define UIWNDFRAME_ROUNDTHICK 0x00000002 // frame style: thick with rounded top corners
  591. #define UIWNDFRAME_RESIZELEFT 0x00000010 // resize flag: resizable at left border
  592. #define UIWNDFRAME_RESIZETOP 0x00000020 // resize flag: resizable at top border
  593. #define UIWNDFRAME_RESIZERIGHT 0x00000040 // resize flag: resizable at right border
  594. #define UIWNDFRAME_RESIZEBOTTOM 0x00000080 // resize flag: resizable at bottom border
  595. #define UIWNDFRAME_NORESIZE 0x00000000 // resize flag: no resizable
  596. #define UIWNDFRAME_RESIZEALL (UIWNDFRAME_RESIZELEFT | UIWNDFRAME_RESIZETOP | UIWNDFRAME_RESIZERIGHT | UIWNDFRAME_RESIZEBOTTOM)
  597. #define UIWNDFRAME_STYLEMASK 0x0000000f // (mask bit)
  598. class CUIFWndFrame : public CUIFObject
  599. {
  600. public:
  601. CUIFWndFrame( CUIFObject *pParent, const RECT *prc, DWORD dwStyle );
  602. virtual ~CUIFWndFrame( void );
  603. virtual BOOL OnPaintTheme( HDC hDC );
  604. virtual void OnPaintNoTheme( HDC hDC );
  605. virtual void OnLButtonDown( POINT pt );
  606. virtual void OnLButtonUp( POINT pt );
  607. virtual void OnMouseMove( POINT pt );
  608. virtual BOOL OnSetCursor( UINT uMsg, POINT pt );
  609. void GetInternalRect( RECT *prc );
  610. void GetFrameSize( SIZE *psize );
  611. void SetFrameSize( SIZE *psize );
  612. void GetMinimumSize( SIZE *psize );
  613. void SetMinimumSize( SIZE *psize );
  614. protected:
  615. DWORD m_dwHTResizing;
  616. POINT m_ptDrag;
  617. RECT m_rcOrg;
  618. int m_cxFrame;
  619. int m_cyFrame;
  620. int m_cxMin;
  621. int m_cyMin;
  622. DWORD HitTest( POINT pt );
  623. };
  624. //
  625. // CUIFWndCaption
  626. //-----------------------------------------------------------------------------
  627. //
  628. // CUIFWndCaption
  629. // = window caption object =
  630. //
  631. #define UIWNDCAPTION_INACTIVE 0x00000000
  632. #define UIWNDCAPTION_ACTIVE 0x00000001
  633. #define UIWNDCAPTION_MOVABLE 0x00000002
  634. class CUIFWndCaption : public CUIFStatic
  635. {
  636. public:
  637. CUIFWndCaption( CUIFObject *pParent, DWORD dwID, const RECT *prc, DWORD dwStyle );
  638. virtual ~CUIFWndCaption( void );
  639. virtual void OnPaint( HDC hDC );
  640. virtual void OnLButtonDown( POINT pt );
  641. virtual void OnLButtonUp( POINT pt );
  642. virtual void OnMouseMove( POINT pt );
  643. virtual BOOL OnSetCursor( UINT uMsg, POINT pt );
  644. private:
  645. POINT m_ptDrag;
  646. };
  647. //
  648. // CUIFCaptionButton
  649. //-----------------------------------------------------------------------------
  650. //
  651. // CUIFCaptionButton
  652. // = caption control object =
  653. //
  654. #define UICAPTIONBUTTON_INACTIVE 0x00000000
  655. #define UICAPTIONBUTTON_ACTIVE 0x00010000
  656. class CUIFCaptionButton : public CUIFButton2
  657. {
  658. public:
  659. CUIFCaptionButton( CUIFObject *pParent, DWORD dwID, const RECT *prc, DWORD dwStyle );
  660. virtual ~CUIFCaptionButton( void );
  661. virtual void OnPaint( HDC hDC );
  662. };
  663. #endif /* CUIOBJ_H */