BsGUITreeViewEditBox.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "BsGUITreeViewEditBox.h"
  2. #include "BsGUICommandEvent.h"
  3. #include "BsGUIWidget.h"
  4. #include "BsGUISkin.h"
  5. using namespace CamelotFramework;
  6. using namespace BansheeEngine;
  7. namespace BansheeEditor
  8. {
  9. const CM::String& GUITreeViewEditBox::getGUITypeName()
  10. {
  11. static String name = "TreeViewEditBox";
  12. return name;
  13. }
  14. GUITreeViewEditBox* GUITreeViewEditBox::create(const CM::String& styleName)
  15. {
  16. return new (cm_alloc<GUITreeViewEditBox, PoolAlloc>()) GUITreeViewEditBox(getStyleName<GUITreeViewEditBox>(styleName), GUILayoutOptions::create());
  17. }
  18. GUITreeViewEditBox* GUITreeViewEditBox::create(const BS::GUIOptions& layoutOptions, const CM::String& styleName)
  19. {
  20. return new (cm_alloc<GUITreeViewEditBox, PoolAlloc>()) GUITreeViewEditBox(getStyleName<GUITreeViewEditBox>(styleName), GUILayoutOptions::create(layoutOptions));
  21. }
  22. GUITreeViewEditBox::GUITreeViewEditBox(const CM::String& styleName, const BS::GUILayoutOptions& layoutOptions)
  23. :GUIInputBox(styleName, layoutOptions, false)
  24. {
  25. }
  26. bool GUITreeViewEditBox::commandEvent(const BS::GUICommandEvent& ev)
  27. {
  28. bool processed = GUIInputBox::commandEvent(ev);
  29. if(ev.getType() == GUICommandEventType::Return)
  30. {
  31. if(!onInputConfirmed.empty())
  32. onInputConfirmed();
  33. return true;
  34. }
  35. else if(ev.getType() == GUICommandEventType::Escape)
  36. {
  37. if(!onInputCanceled.empty())
  38. onInputCanceled();
  39. return true;
  40. }
  41. else if(ev.getType() == GUICommandEventType::FocusLost)
  42. {
  43. if(!onInputCanceled.empty())
  44. onInputCanceled();
  45. return true;
  46. }
  47. return processed;
  48. }
  49. };