Feature/scroll indication (#3)

Add scroll arrows when there are more items in the list than the list can show at a time.

These arrows can be shown in the main menu (although there aren't enough items in there to have them shown) or in the various DistributionEventPokemonListScene menus.

I also did provisions to support the same for the ScrollWidget in the about screen. Although I haven't implemented that (yet?)
This commit is contained in:
Philippe Symons
2024-08-22 21:45:31 +02:00
committed by GitHub
parent bc7733cc36
commit 90bb9ccceb
14 changed files with 361 additions and 54 deletions

View File

@@ -3,11 +3,13 @@
#include "scenes/SceneWithDialogWidget.h"
#include "widget/VerticalList.h"
#include "widget/ImageWidget.h"
#include "widget/DialogWidget.h"
#include "widget/CursorWidget.h"
#include "widget/MenuItemWidget.h"
#include "widget/ListItemFiller.h"
#include "widget/IFocusListener.h"
#include "widget/IScrollWindowListener.h"
typedef struct MenuSceneContext
{
@@ -20,7 +22,7 @@ typedef struct MenuSceneContext
* @brief A scene showing a menu
*
*/
class MenuScene : public SceneWithDialogWidget, public IFocusListener
class MenuScene : public SceneWithDialogWidget, public IFocusListener, public IScrollWindowListener
{
public:
MenuScene(SceneDependencies& deps, void* context);
@@ -36,6 +38,7 @@ public:
virtual void onDialogDone();
void focusChanged(const FocusChangeStatus& status) override;
void onScrollWindowChanged(const ScrollWindowUpdate& update) override;
SceneDependencies& getDependencies();
@@ -47,7 +50,11 @@ protected:
MenuSceneContext* context_;
sprite_t* menu9SliceSprite_;
sprite_t* cursorSprite_;
sprite_t* uiArrowUpSprite_;
sprite_t* uiArrowDownSprite_;
VerticalList menuList_;
ImageWidget scrollArrowUp_;
ImageWidget scrollArrowDown_;
CursorWidget cursorWidget_;
ListItemFiller<VerticalList, MenuItemData, MenuItemWidget, MenuItemStyle> menuListFiller_;
WidgetFocusChainSegment listFocusChainSegment_;