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.

66 lines
1.7 KiB

  1. // Copyright (c) 2000 Microsoft Corporation. All rights reserved.
  2. //
  3. // Declaration of CSliderValue.
  4. //
  5. #pragma once
  6. class Handler
  7. {
  8. public:
  9. virtual LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) = 0;
  10. };
  11. class CSliderValue
  12. : public Handler
  13. {
  14. public:
  15. CSliderValue();
  16. void Init(HWND hwndSlider, HWND hwndEdit, float fMin, float fMax, bool fDiscrete);
  17. void SetValue(float fPos);
  18. float GetValue();
  19. LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  20. private:
  21. bool m_fInit;
  22. HWND m_hwndSlider;
  23. HWND m_hwndEdit;
  24. float m_fMin;
  25. float m_fMax;
  26. bool m_fDiscrete;
  27. private:
  28. float GetSliderValue();
  29. void UpdateEditBox(float fPos);
  30. void UpdateSlider();
  31. };
  32. class CRadioChoice
  33. : public Handler
  34. {
  35. public:
  36. struct ButtonEntry
  37. {
  38. int nIDDlgItem;
  39. LONG lValue;
  40. };
  41. // Create passing a ButtonEntry array terminated by an entry with nIDDlgItem of 0.
  42. CRadioChoice(const ButtonEntry *pButtonInfo);
  43. void SetChoice(HWND hDlg, LONG lValue);
  44. LONG GetChoice(HWND hDlg);
  45. LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  46. private:
  47. const ButtonEntry *m_pButtonInfo;
  48. };
  49. // MessageHandlerChain is a helper for implementing the property page message handler.
  50. // It takes a NULL-terminated array of Message pointers (could be CSliderValue or CRadioChoice)
  51. // and calls them in order until one of them sets bHandled.
  52. LRESULT MessageHandlerChain(Handler **ppHandlers, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);