home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / DirectInput / DIConfig / cdeviceviewtext.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-08  |  1.9 KB  |  75 lines

  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-2001 Microsoft Corporation. All Rights Reserved.
  10. //-----------------------------------------------------------------------------
  11.  
  12. #ifdef FORWARD_DECLS
  13.  
  14.  
  15.     class CDeviceViewText;
  16.  
  17.  
  18. #else // FORWARD_DECLS
  19.  
  20. #ifndef __CDEVICEVIEWTEXT_H__
  21. #define __CDEVICEVIEWTEXT_H__
  22.  
  23.  
  24. class CDeviceViewText
  25. {
  26. private:
  27.     friend class CDeviceView;    // CDeviceView has exclusive right to create/destroy views
  28.     CDeviceViewText(CDeviceUI &ui, CDeviceView &view);
  29.     ~CDeviceViewText();
  30.     CDeviceView &m_view;
  31.     CDeviceUI &m_ui;
  32.  
  33. public:
  34.     // set look/position/text
  35.     void SetLook(HFONT, COLORREF, COLORREF);
  36.     void SetRect(const RECT &r);
  37.     void SetPosition(int, int);
  38.     void SetPosition(POINT p) {SetPosition(p.x, p.y);}
  39.     void SetText(LPCTSTR);
  40.     void SetTextAndResizeTo(LPCTSTR);
  41.     void SetTextAndResizeToWrapped(LPCTSTR);
  42.     void SetWrap(BOOL bWrap = FALSE);
  43.  
  44.     LPCTSTR GetText() { return m_ptszText; }
  45.  
  46.     // get dimensions
  47.     RECT GetRect() {return m_rect;}
  48.     int GetHeight() {return m_rect.bottom - m_rect.top;}
  49.     int GetMinY() {return m_rect.top;}
  50.     int GetMaxY() {return m_rect.bottom;}
  51.  
  52.     // hit testing (in coord's relative to view's origin)
  53.     DEVCTRLHITRESULT HitTest(POINT test);
  54.  
  55.     void OnPaint(HDC);
  56.     void OnMouseOver(POINT point);
  57.  
  58. private:
  59.     void _SetText(LPCTSTR t);
  60.     void CheckClipped();
  61.     void Invalidate(BOOL bForce = FALSE);
  62.  
  63.     HFONT m_hFont;
  64.     COLORREF m_rgbText, m_rgbBk;
  65.     RECT m_rect;
  66.     BOOL m_bWrap;
  67.     BOOL m_bClipped;
  68.     LPTSTR m_ptszText;
  69. };
  70.  
  71.  
  72. #endif //__CDEVICEVIEWTEXT_H__
  73.  
  74. #endif // FORWARD_DECLS
  75.