BsGUITextField.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include "BsGUITextField.h"
  2. #include "BsGUIArea.h"
  3. #include "BsGUILayout.h"
  4. #include "BsGUILabel.h"
  5. #include "BsGUIInputBox.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. GUITextField::GUITextField(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, CM::UINT32 labelWidth,
  15. GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
  16. :TGUIField(dummy, parent, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mInputBox(nullptr)
  17. {
  18. const GUIElementStyle* curInputBoxStyle = inputBoxStyle;
  19. if(curInputBoxStyle == nullptr)
  20. curInputBoxStyle = parent.getSkin().getStyle("InputBox");
  21. mInputBox = GUIInputBox::create(parent, false, inputBoxStyle);
  22. mLayout->addElement(mInputBox);
  23. }
  24. GUITextField::~GUITextField()
  25. {
  26. }
  27. WString GUITextField::getValue() const
  28. {
  29. return mInputBox->getText();
  30. }
  31. void GUITextField::setValue(const WString& value)
  32. {
  33. mInputBox->setText(value);
  34. }
  35. const String& GUITextField::getGUITypeName()
  36. {
  37. static String typeName = "GUITextField";
  38. return typeName;
  39. }
  40. }