BsGUIWindowFrameWidget.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include "BsGUIWindowFrameWidget.h"
  2. #include "BsGUIArea.h"
  3. #include "BsGUILayout.h"
  4. #include "BsGUITexture.h"
  5. #include "BsGUIWindowFrame.h"
  6. #include "BsEngineGUI.h"
  7. #include "BsGUIMouseEvent.h"
  8. #include "CmRenderWindow.h"
  9. #include "CmMath.h"
  10. using namespace CamelotFramework;
  11. using namespace BansheeEngine;
  12. namespace BansheeEditor
  13. {
  14. WindowFrameWidget::WindowFrameWidget(const HSceneObject& parent)
  15. :GUIWidget(parent), mWindowFrameArea(nullptr)
  16. {
  17. }
  18. WindowFrameWidget::~WindowFrameWidget()
  19. {
  20. }
  21. void WindowFrameWidget::initialize(CM::Viewport* target, CM::RenderWindow* ownerWindow)
  22. {
  23. GUIWidget::initialize(target, ownerWindow);
  24. GUIArea* backgroundArea = GUIArea::createStretchedXY(*this, 0, 0, 0, 0, 500);
  25. backgroundArea->getLayout().addElement(GUITexture::create(*this, GUILayoutOptions::expandableXY(), GUIImageScaleMode::RepeatToFit, getSkin()->getStyle("WindowBackground")));
  26. mWindowFrameArea = GUIArea::createStretchedXY(*this, 0, 0, 0, 0, 499);
  27. mWindowFrame = GUIWindowFrame::create(*this, getSkin()->getStyle("WindowFrame"));
  28. mWindowFrameArea->getLayout().addElement(mWindowFrame);
  29. }
  30. void WindowFrameWidget::update()
  31. {
  32. }
  33. bool WindowFrameWidget::_mouseEvent(GUIElement* element, const GUIMouseEvent& ev)
  34. {
  35. return GUIWidget::_mouseEvent(element, ev);
  36. }
  37. void WindowFrameWidget::ownerWindowFocusChanged()
  38. {
  39. mWindowFrame->setFocused(getOwnerWindow()->hasFocus());
  40. }
  41. }