BsGUIToggleField.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include "BsGUIToggleField.h"
  2. #include "BsGUIArea.h"
  3. #include "BsGUILayout.h"
  4. #include "BsGUILabel.h"
  5. #include "BsGUIToggle.h"
  6. #include "BsBuiltinResources.h"
  7. #include "BsGUIWidget.h"
  8. #include "BsGUIMouseEvent.h"
  9. #include "BsGUIWidget.h"
  10. using namespace CamelotFramework;
  11. using namespace BansheeEngine;
  12. namespace BansheeEditor
  13. {
  14. GUIToggleField::GUIToggleField(const PrivatelyConstruct& dummy, const GUIContent& labelContent,
  15. UINT32 labelWidth, const CM::String& labelStyle, const CM::String& toggleStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
  16. :TGUIField(dummy, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mToggle(nullptr)
  17. {
  18. mToggle = GUIToggle::create(HString(L""), toggleStyle);
  19. mLayout->addElement(mToggle);
  20. }
  21. bool GUIToggleField::getValue() const
  22. {
  23. return mToggle->isToggled();
  24. }
  25. void GUIToggleField::setValue(bool value)
  26. {
  27. if(value)
  28. mToggle->toggleOn();
  29. else
  30. mToggle->toggleOff();
  31. }
  32. const String& GUIToggleField::getGUITypeName()
  33. {
  34. static String typeName = "GUIToggleField";
  35. return typeName;
  36. }
  37. }