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.

74 lines
1.9 KiB

  1. //-----------------------------------------------------------------------------
  2. // File: cdeviceviewtext.h
  3. //
  4. // Desc: CDeviceViewText is a class representing a text string in the view
  5. // window. It is used when the view type is a list view. CDeviceViewText
  6. // will print the text of the control name, while CDeviceControl will
  7. // print the text of the action assigned to that control.
  8. //
  9. // Copyright (C) 1999-2000 Microsoft Corporation. All Rights Reserved.
  10. //-----------------------------------------------------------------------------
  11. #ifdef FORWARD_DECLS
  12. class CDeviceViewText;
  13. #else // FORWARD_DECLS
  14. #ifndef __CDEVICEVIEWTEXT_H__
  15. #define __CDEVICEVIEWTEXT_H__
  16. class CDeviceViewText
  17. {
  18. private:
  19. friend class CDeviceView; // CDeviceView has exclusive right to create/destroy views
  20. CDeviceViewText(CDeviceUI &ui, CDeviceView &view);
  21. ~CDeviceViewText();
  22. CDeviceView &m_view;
  23. CDeviceUI &m_ui;
  24. public:
  25. // set look/position/text
  26. void SetLook(HFONT, COLORREF, COLORREF);
  27. void SetRect(const RECT &r);
  28. void SetPosition(int, int);
  29. void SetPosition(POINT p) {SetPosition(p.x, p.y);}
  30. void SetText(LPCTSTR);
  31. void SetTextAndResizeTo(LPCTSTR);
  32. void SetTextAndResizeToWrapped(LPCTSTR);
  33. void SetWrap(BOOL bWrap = FALSE);
  34. LPCTSTR GetText() { return m_ptszText; }
  35. // get dimensions
  36. RECT GetRect() {return m_rect;}
  37. int GetHeight() {return m_rect.bottom - m_rect.top;}
  38. int GetMinY() {return m_rect.top;}
  39. int GetMaxY() {return m_rect.bottom;}
  40. // hit testing (in coord's relative to view's origin)
  41. DEVCTRLHITRESULT HitTest(POINT test);
  42. void OnPaint(HDC);
  43. void OnMouseOver(POINT point);
  44. private:
  45. void _SetText(LPCTSTR t);
  46. void CheckClipped();
  47. void Invalidate(BOOL bForce = FALSE);
  48. HFONT m_hFont;
  49. COLORREF m_rgbText, m_rgbBk;
  50. RECT m_rect;
  51. BOOL m_bWrap;
  52. BOOL m_bClipped;
  53. LPTSTR m_ptszText;
  54. };
  55. #endif //__CDEVICEVIEWTEXT_H__
  56. #endif // FORWARD_DECLS