home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / C++-7 / DISK11 / MFC / SAMPLES / CTRLTEST / SPIN.H$ / spin
Encoding:
Text File  |  1992-03-16  |  2.3 KB  |  74 lines

  1. // spin.h: C++ interface to spin control
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and Microsoft
  9. // QuickHelp documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #ifndef __AFXWIN_H__
  14. #include <afxwin.h>
  15. #endif
  16.  
  17. #include "muscroll.h"       // message based API
  18.  
  19. /////////////////////////////////////////////////////////////////////////////
  20.  
  21. class CSpinControl : public CWnd
  22. {
  23.     DECLARE_DYNAMIC(CSpinControl)
  24.  
  25. // Constructors
  26. public:
  27.     CSpinControl();
  28.     BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
  29.  
  30. // Attributes
  31.     CWnd* GetAssociate();
  32.     void SetAssociate(CWnd* pNew);
  33.     void GetRange(UINT& iMin, UINT& iMax);
  34.     void SetRange(UINT iMin, UINT iMax);
  35.     UINT GetCurrentPos();
  36.     void SetCurrentPos(UINT iPos);
  37.     // there are more APIs in 'muscroll.h' not wrapped here
  38.  
  39. // Implementation
  40. protected:
  41.     virtual WNDPROC* GetSuperWndProcAddr();
  42. };
  43.  
  44. /////////////////////////////////////////////////////////////////////////////
  45. // new notification routines
  46.  
  47. #ifdef LATER
  48. #define MSN_ASSOCIATEGAIN   1
  49. #define MSN_ASSOCIATELOSS   2
  50. #define MSN_RANGECHANGE     3
  51. #endif
  52.  
  53. /////////////////////////////////////////////////////////////////////////////
  54. // inlines
  55. inline CSpinControl::CSpinControl()
  56.     { }
  57.  
  58. inline CWnd* CSpinControl::GetAssociate()
  59.     { return CWnd::FromHandle((HWND)SendMessage(MSM_HWNDASSOCIATEGET)); }
  60. inline void CSpinControl::SetAssociate(CWnd* pNew)
  61.     { SendMessage(MSM_HWNDASSOCIATESET, (UINT)pNew->GetSafeHwnd()); }
  62. inline void CSpinControl::GetRange(UINT& iMin, UINT& iMax)
  63.     { DWORD dw = SendMessage(MSM_DWRANGEGET);
  64.         iMin = LOWORD(dw); iMax = HIWORD(dw);
  65.     }
  66. inline void CSpinControl::SetRange(UINT iMin, UINT iMax)
  67.     { SendMessage(MSM_DWRANGESET, 0, MAKELONG(iMin, iMax)); }
  68. inline UINT CSpinControl::GetCurrentPos()
  69.     { return (UINT)SendMessage(MSM_WCURRENTPOSGET); }
  70. inline void CSpinControl::SetCurrentPos(UINT iPos)
  71.     { SendMessage(MSM_WCURRENTPOSSET, iPos); }
  72.  
  73. /////////////////////////////////////////////////////////////////////////////
  74.