BsGUIWindowFrame.cpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #include "BsGUIWindowFrame.h"
  2. #include "BsImageSprite.h"
  3. #include "BsGUIWidget.h"
  4. #include "BsGUISkin.h"
  5. #include "BsSpriteTexture.h"
  6. #include "BsGUILayoutOptions.h"
  7. #include "BsGUIMouseEvent.h"
  8. #include "CmApplication.h"
  9. #include "CmPlatform.h"
  10. #include "CmTexture.h"
  11. #include "CmRenderWindow.h"
  12. using namespace CamelotFramework;
  13. using namespace BansheeEngine;
  14. namespace BansheeEditor
  15. {
  16. const String& GUIWindowFrame::getGUITypeName()
  17. {
  18. static String name = "WindowFrame";
  19. return name;
  20. }
  21. GUIWindowFrame::GUIWindowFrame(GUIWidget& parent, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
  22. :GUITexture(parent, style, HSpriteTexture(), GUIImageScaleMode::StretchToFit, layoutOptions)
  23. {
  24. }
  25. GUIWindowFrame::~GUIWindowFrame()
  26. { }
  27. GUIWindowFrame* GUIWindowFrame::create(GUIWidget& parent, const GUIElementStyle* style)
  28. {
  29. if(style == nullptr)
  30. {
  31. const GUISkin& skin = parent.getSkin();
  32. style = skin.getStyle(getGUITypeName());
  33. }
  34. return new (cm_alloc<GUIWindowFrame, PoolAlloc>()) GUIWindowFrame(parent, style, GUILayoutOptions::create(style));
  35. }
  36. GUIWindowFrame* GUIWindowFrame::create(GUIWidget& parent, const GUIOptions& layoutOptions, const GUIElementStyle* style)
  37. {
  38. if(style == nullptr)
  39. {
  40. const GUISkin& skin = parent.getSkin();
  41. style = skin.getStyle(getGUITypeName());
  42. }
  43. return new (cm_alloc<GUIWindowFrame, PoolAlloc>()) GUIWindowFrame(parent, style, GUILayoutOptions::create(layoutOptions, style));
  44. }
  45. void GUIWindowFrame::setFocused(bool focused)
  46. {
  47. if(focused)
  48. mActiveTexture = mStyle->focused.texture;
  49. else
  50. mActiveTexture = mStyle->normal.texture;
  51. markContentAsDirty();
  52. }
  53. }