Small refactoring of CarouselComponent and TextListComponent.

This commit is contained in:
Leon Styhre 2022-11-06 21:28:15 +01:00
parent bbc996f66e
commit 5bedb7a8fa
2 changed files with 9 additions and 9 deletions

View file

@ -66,14 +66,14 @@ public:
return mLetterCaseGroupedCollections; return mLetterCaseGroupedCollections;
} }
void setCursorChangedCallback(const std::function<void(CursorState state)>& func) override
{
mCursorChangedCallback = func;
}
void setCancelTransitionsCallback(const std::function<void()>& func) override void setCancelTransitionsCallback(const std::function<void()>& func) override
{ {
mCancelTransitionsCallback = func; mCancelTransitionsCallback = func;
} }
void setCursorChangedCallback(const std::function<void(CursorState state)>& func) override
{
mCursorChangedCallback = func;
}
bool input(InputConfig* config, Input input) override; bool input(InputConfig* config, Input input) override;
void update(int deltaTime) override; void update(int deltaTime) override;

View file

@ -57,14 +57,14 @@ public:
void setAlignment(PrimaryAlignment align) override { mAlignment = align; } void setAlignment(PrimaryAlignment align) override { mAlignment = align; }
void setCursorChangedCallback(const std::function<void(CursorState state)>& func) override
{
mCursorChangedCallback = func;
}
void setCancelTransitionsCallback(const std::function<void()>& func) override void setCancelTransitionsCallback(const std::function<void()>& func) override
{ {
mCancelTransitionsCallback = func; mCancelTransitionsCallback = func;
} }
void setCursorChangedCallback(const std::function<void(CursorState state)>& func) override
{
mCursorChangedCallback = func;
}
void setFont(const std::shared_ptr<Font>& font) void setFont(const std::shared_ptr<Font>& font)
{ {
@ -111,6 +111,7 @@ private:
Renderer* mRenderer; Renderer* mRenderer;
std::function<void()> mCancelTransitionsCallback; std::function<void()> mCancelTransitionsCallback;
std::function<void(CursorState state)> mCursorChangedCallback;
float mCamOffset; float mCamOffset;
int mPreviousScrollVelocity; int mPreviousScrollVelocity;
@ -122,7 +123,6 @@ private:
PrimaryAlignment mAlignment; PrimaryAlignment mAlignment;
float mHorizontalMargin; float mHorizontalMargin;
std::function<void(CursorState state)> mCursorChangedCallback;
ImageComponent mSelectorImage; ImageComponent mSelectorImage;
std::shared_ptr<Font> mFont; std::shared_ptr<Font> mFont;