BaseUIElementFactory.cpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // Urho3D Engine
  3. // Copyright (c) 2008-2011 Lasse Öörni
  4. //
  5. // Permission is hereby granted, free of charge, to any person obtaining a copy
  6. // of this software and associated documentation files (the "Software"), to deal
  7. // in the Software without restriction, including without limitation the rights
  8. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. // copies of the Software, and to permit persons to whom the Software is
  10. // furnished to do so, subject to the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be included in
  13. // all copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. // THE SOFTWARE.
  22. //
  23. #include "Precompiled.h"
  24. #include "BaseUIElementFactory.h"
  25. #include "CheckBox.h"
  26. #include "Cursor.h"
  27. #include "DropDownList.h"
  28. #include "LineEdit.h"
  29. #include "ListView.h"
  30. #include "ScrollBar.h"
  31. #include "Slider.h"
  32. #include "Text.h"
  33. #include "Window.h"
  34. UIElement* BaseUIElementFactory::createElement(ShortStringHash type, const std::string& name)
  35. {
  36. if (type == BorderImage::getTypeStatic())
  37. return new BorderImage(name);
  38. if (type == Button::getTypeStatic())
  39. return new Button(name);
  40. if (type == CheckBox::getTypeStatic())
  41. return new CheckBox(name);
  42. if (type == Cursor::getTypeStatic())
  43. return new Cursor(name);
  44. if (type == DropDownList::getTypeStatic())
  45. return new DropDownList(name);
  46. if (type == LineEdit::getTypeStatic())
  47. return new LineEdit(name);
  48. if (type == ListView::getTypeStatic())
  49. return new ListView(name);
  50. if (type == Menu::getTypeStatic())
  51. return new Menu(name);
  52. if (type == ScrollBar::getTypeStatic())
  53. return new ScrollBar(name);
  54. if (type == ScrollView::getTypeStatic())
  55. return new ScrollView(name);
  56. if (type == Slider::getTypeStatic())
  57. return new Slider(name);
  58. if (type == Text::getTypeStatic())
  59. return new Text(name);
  60. if (type == UIElement::getTypeStatic())
  61. return new UIElement(name);
  62. if (type == Window::getTypeStatic())
  63. return new Window(name);
  64. return 0;
  65. }