BsGUITreeViewEditBox.cpp 1.5 KB

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