* initial work on touch support * add touch support to all objects * add touch scrolling, fix scrollbar, fix appstore search - when fireing an action, the action array may change. so the loop should break early as soon as an action is handled. this fixes the appstore search when pressing B. - scrollbar no longer goes oob. fixes #76 currently, scrolling has no acceleration.
52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include "ui/widget.hpp"
|
|
#include "ui/menus/homebrew.hpp"
|
|
#include "ui/menus/filebrowser.hpp"
|
|
#include "ui/menus/appstore.hpp"
|
|
|
|
namespace sphaira::ui::menu::main {
|
|
|
|
enum class UpdateState {
|
|
// still downloading json from github
|
|
Pending,
|
|
// no update available.
|
|
None,
|
|
// update available!
|
|
Update,
|
|
// there was an error whilst checking for updates.
|
|
Error,
|
|
};
|
|
|
|
// this holds 2 menus and allows for switching between them
|
|
struct MainMenu final : Widget {
|
|
MainMenu();
|
|
~MainMenu();
|
|
|
|
void Update(Controller* controller, TouchInfo* touch) override;
|
|
void Draw(NVGcontext* vg, Theme* theme) override;
|
|
void OnFocusGained() override;
|
|
void OnFocusLost() override;
|
|
|
|
auto IsMenu() const -> bool override {
|
|
return true;
|
|
}
|
|
|
|
private:
|
|
void OnLRPress(std::shared_ptr<MenuBase> menu, Button b);
|
|
void AddOnLRPress();
|
|
|
|
private:
|
|
std::shared_ptr<homebrew::Menu> m_homebrew_menu{};
|
|
std::shared_ptr<filebrowser::Menu> m_filebrowser_menu{};
|
|
std::shared_ptr<appstore::Menu> m_app_store_menu{};
|
|
std::shared_ptr<MenuBase> m_current_menu{};
|
|
|
|
std::string m_update_url{};
|
|
std::string m_update_version{};
|
|
std::string m_update_description{};
|
|
UpdateState m_update_state{UpdateState::Pending};
|
|
};
|
|
|
|
} // namespace sphaira::ui::menu::main
|