Scrollable.cpp 493 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include "Scrollable.hpp"
  2. #include "ScrollBar.hpp"
  3. namespace FreeShop {
  4. Scrollable::Scrollable()
  5. : m_scrollBar(nullptr)
  6. , m_scrollVal(0.f)
  7. {
  8. }
  9. Scrollable::~Scrollable()
  10. {
  11. if (m_scrollBar)
  12. m_scrollBar->detachObject(this);
  13. }
  14. void Scrollable::attachScrollbar(ScrollBar *scrollbar)
  15. {
  16. m_scrollBar = scrollbar;
  17. }
  18. void Scrollable::detachScrollbar()
  19. {
  20. m_scrollBar = nullptr;
  21. }
  22. void Scrollable::updateScrollSize()
  23. {
  24. if (m_scrollBar)
  25. m_scrollBar->markDirty();
  26. }
  27. } // namespace FreeShop