ltguionoffctrl.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // LTGUIOnOffCtrl.h: interface for the CLTGUIOnOffCtrl class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_LTGUIONOFFCTRL_H__B4C56631_617A_11D2_BDA7_0060971BDC6D__INCLUDED_)
  5. #define AFX_LTGUIONOFFCTRL_H__B4C56631_617A_11D2_BDA7_0060971BDC6D__INCLUDED_
  6. #if _MSC_VER >= 1000
  7. #pragma once
  8. #endif // _MSC_VER >= 1000
  9. #include "ltguicyclectrl.h"
  10. class CLTGUIOnOffCtrl : public CLTGUICycleCtrl
  11. {
  12. public:
  13. CLTGUIOnOffCtrl();
  14. virtual ~CLTGUIOnOffCtrl();
  15. // Create the control
  16. // pClientDE - Pointer to the client interface.
  17. // hString - Handle of a string to copy the text from for the control.
  18. // pFont - The font to use for rendering the strings.
  19. // nRightColumnOffset - The number of pixels from the left edge that the on/off text is
  20. // pbValue - Value to store the on/off status in when UpdateData is called
  21. LTBOOL Create ( ILTClient *pClientDE, HSTRING hString, CLTGUIFont *pFont,
  22. int nRightColumnOffset, LTBOOL *pbValue=LTNULL, int alignment = LTF_JUSTIFY_CENTER);
  23. void SetOnString(HSTRING hStrOn);
  24. void SetOffString(HSTRING hStrOff);
  25. void SetOnString(int nStrOnID);
  26. void SetOffString(int nStrOffID);
  27. // Update data
  28. void UpdateData(LTBOOL bSaveAndValidate=LTTRUE);
  29. // Sets/gets the on/off status
  30. LTBOOL IsOn() { return m_bOn; }
  31. virtual void SetOn(LTBOOL bOn);
  32. // Left and Right key presses
  33. virtual LTBOOL OnLeft() { SetOn(!IsOn()); return LTTRUE;}
  34. virtual LTBOOL OnRight() { SetOn(!IsOn()); return LTTRUE;}
  35. protected:
  36. LTBOOL m_bOn;
  37. LTBOOL *m_pbValue; // Value to store the on/off status in when UpdateData is called.
  38. HSTRING m_hStrOn;
  39. HSTRING m_hStrOff;
  40. };
  41. #endif // !defined(AFX_LTGUIONOFFCTRL_H__B4C56631_617A_11D2_BDA7_0060971BDC6D__INCLUDED_)