Old fashion design for PC-104
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.

44 lines
1.2 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 23/04/2001
  5. // Last modification: 08/10/2003
  6. // Project Intruder Position Indicator
  7. // SUBSYSTEM: Spinner
  8. // FILE: Spinner.cpp
  9. // AUTHOR: Belkovsky Joseph
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file for implemenation of class Spinner
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "..\LgLib\Version.h"
  16. #include "Spinner.h"
  17. Spinner::Spinner(HWND hwnd, WORD resID)
  18. : hwnd_(hwnd)
  19. {
  20. m_bStudyMode = TRUE;
  21. HINSTANCE hthisInst = (HINSTANCE)GetWindowLong(hwnd_, GWL_HINSTANCE);
  22. for(WORD idx = resID; idx < (resID + STEPS * 2 + 1); idx++)
  23. hicons_[idx - resID] = (HICON)LoadImage(hthisInst, (LPCTSTR)idx,
  24. IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
  25. step( STEPS );
  26. }
  27. Spinner::~Spinner()
  28. {
  29. for(__int8 idx = 0; idx < STEPS * 2 + 1; idx++)
  30. DestroyIcon(hicons_[idx]);
  31. }
  32. HICON Spinner::step(__int8 step) const
  33. {
  34. return (HICON)SendMessage(hwnd_, STM_SETICON,
  35. (WPARAM)hicons_[ m_bStudyMode ? step + STEPS : step ], (LPARAM)0L);
  36. }