UIScrollContainer.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #pragma once
  2. #include <TurboBadger/tb_scroll_container.h>
  3. #include "UIWidget.h"
  4. namespace Atomic
  5. {
  6. enum UI_SCROLL_MODE {
  7. ///< X and Y always scroll-mode: xy
  8. UI_SCROLL_MODE_X_Y = tb::SCROLL_MODE_X_Y,
  9. ///< Y always (X never) scroll-mode: y
  10. UI_SCROLL_MODE_Y = tb::SCROLL_MODE_Y,
  11. ///< Y auto (X never) scroll-mode: y-auto
  12. UI_SCROLL_MODE_Y_AUTO = tb::SCROLL_MODE_Y_AUTO,
  13. ///< X auto, Y auto scroll-mode: auto
  14. UI_SCROLL_MODE_X_AUTO_Y_AUTO = tb::SCROLL_MODE_X_AUTO_Y_AUTO,
  15. ///< X any Y never scroll-mode: off
  16. UI_SCROLL_MODE_OFF = tb::SCROLL_MODE_OFF
  17. };
  18. class UIScrollContainer : public UIWidget
  19. {
  20. OBJECT(UIScrollContainer)
  21. public:
  22. UIScrollContainer(Context* context, bool createWidget = true);
  23. virtual ~UIScrollContainer();
  24. void SetScrollMode(UI_SCROLL_MODE mode);
  25. UI_SCROLL_MODE GetScrollMode();
  26. /// Set to true if the preferred size of this container should adapt to the preferred size of the content. This is disabled by default.
  27. void SetAdaptToContentSize(bool adapt);
  28. bool GetAdaptToContentSize();
  29. /// Set to true if the content should adapt to the available size of this container when it's larger than the preferred size.
  30. void SetAdaptContentSize(bool adapt);
  31. bool GetAdaptContentSize();
  32. protected:
  33. virtual bool OnEvent(const tb::TBWidgetEvent &ev);
  34. private:
  35. };
  36. }