home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / DirectShow / DMO / GargleDMO / ControlBase / controlhelp.h < prev   
Encoding:
C/C++ Source or Header  |  2001-10-08  |  2.0 KB  |  72 lines

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