2020-09-17 20:00:07 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-06-28 16:39:18 +00:00
|
|
|
//
|
2020-09-17 20:00:07 +00:00
|
|
|
// EmulationStation Desktop Edition
|
2020-06-28 16:39:18 +00:00
|
|
|
// ScrollableContainer.h
|
|
|
|
//
|
|
|
|
// Area containing scrollable information, for example the game description
|
|
|
|
// text container in the detailed, video and grid views.
|
|
|
|
//
|
|
|
|
|
2017-10-31 17:12:50 +00:00
|
|
|
#ifndef ES_CORE_COMPONENTS_SCROLLABLE_CONTAINER_H
|
|
|
|
#define ES_CORE_COMPONENTS_SCROLLABLE_CONTAINER_H
|
2013-07-03 01:01:58 +00:00
|
|
|
|
2014-06-20 01:30:09 +00:00
|
|
|
#include "GuiComponent.h"
|
2013-07-03 01:01:58 +00:00
|
|
|
|
|
|
|
class ScrollableContainer : public GuiComponent
|
|
|
|
{
|
|
|
|
public:
|
2020-06-28 16:39:18 +00:00
|
|
|
ScrollableContainer(Window* window);
|
2013-07-03 01:01:58 +00:00
|
|
|
|
2020-06-28 16:39:18 +00:00
|
|
|
Vector2f getScrollPos() const;
|
|
|
|
void setScrollPos(const Vector2f& pos);
|
|
|
|
void setAutoScroll(bool autoScroll);
|
|
|
|
void reset();
|
2013-07-03 01:01:58 +00:00
|
|
|
|
2020-06-28 16:39:18 +00:00
|
|
|
void update(int deltaTime) override;
|
|
|
|
void render(const Transform4x4f& parentTrans) override;
|
2013-07-03 01:01:58 +00:00
|
|
|
|
|
|
|
private:
|
2020-06-28 16:39:18 +00:00
|
|
|
Vector2f getContentSize();
|
|
|
|
|
|
|
|
Vector2f mScrollPos;
|
|
|
|
Vector2f mScrollDir;
|
|
|
|
int mAutoScrollDelay; // ms to wait before starting to autoscroll.
|
|
|
|
int mAutoScrollSpeed; // ms to wait before scrolling down by mScrollDir.
|
|
|
|
int mAutoScrollAccumulator;
|
|
|
|
bool mAtEnd;
|
|
|
|
int mAutoScrollResetAccumulator;
|
2013-07-03 01:01:58 +00:00
|
|
|
};
|
2017-10-31 17:12:50 +00:00
|
|
|
|
|
|
|
#endif // ES_CORE_COMPONENTS_SCROLLABLE_CONTAINER_H
|