1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-12-28 18:36:02 +00:00

Fixed dialoguepage stuck on button1

This commit is contained in:
flb 2021-02-06 22:38:16 +01:00
parent afeff3488c
commit dad5639df2
3 changed files with 15 additions and 10 deletions

View file

@ -22,7 +22,7 @@ DATA := data
INCLUDES := include lib/zipper/include
APP_TITLE := All-in-One Switch Updater
APP_AUTHOR := HamletDuFromage
APP_VERSION := 2.0.0
APP_VERSION := 2.0.1
TARGET := $(notdir $(CURDIR))
ROMFS := resources

View file

@ -12,6 +12,7 @@ class DialoguePage : public brls::View
brls::Button* button1 = nullptr;
brls::Button* button2 = nullptr;
brls::Label* label = nullptr;
brls::NavigationMap navigationMap;
public:
DialoguePage(brls::StagedAppletFrame* frame, std::string text);
@ -19,5 +20,5 @@ class DialoguePage : public brls::View
void draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx) override;
void layout(NVGcontext* vg, brls::Style* style, brls::FontStash* stash) override;
brls::View* getDefaultFocus() override;
brls::View* getNextFocus(brls::FocusDirection direction, void* parentUserdata);
brls::View* getNextFocus(brls::FocusDirection direction, brls::View* currentView);
};

View file

@ -25,6 +25,16 @@ DialoguePage::DialoguePage(brls::StagedAppletFrame* frame, std::string text)
this->label = new brls::Label(brls::LabelStyle::DIALOG, "menus/hekate_dialogue"_i18n + "\n\n" + text, true);
this->label->setHorizontalAlign(NVG_ALIGN_CENTER);
this->label->setParent(this);
this->navigationMap.add(
this->button1,
brls::FocusDirection::RIGHT,
this->button2);
this->navigationMap.add(
this->button2,
brls::FocusDirection::LEFT,
this->button1);
}
void DialoguePage::draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx)
@ -63,12 +73,6 @@ brls::View* DialoguePage::getDefaultFocus()
return this->button1;
}
brls::View* DialoguePage::getNextFocus(brls::FocusDirection direction, void* parentUserdata){
if(direction == brls::FocusDirection::LEFT){
return this->button1;
}
if(direction == brls::FocusDirection::RIGHT){
return this->button2;
}
return nullptr;
brls::View* DialoguePage::getNextFocus(brls::FocusDirection direction, brls::View* currentView){
return this->navigationMap.getNextFocus(direction, currentView);
}