refactoring
Co-authored-by: n.fedorov <mail@nfedorov.dev> Co-committed-by: n.fedorov <mail@nfedorov.dev>
This commit was merged in pull request #1.
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include <pu/Plutonium>
|
||||
|
||||
#include <nxst/domain/account.hpp>
|
||||
#include <nxst/domain/title.hpp>
|
||||
#include <nxst/ui/header_bar.hpp>
|
||||
#include <nxst/ui/hint_bar.hpp>
|
||||
|
||||
namespace ui {
|
||||
|
||||
enum class TitlesFocus { List, Actions };
|
||||
enum class TitlesAction { Transfer, Receive };
|
||||
|
||||
class TitlesLayout : public pu::ui::Layout {
|
||||
private:
|
||||
pu::ui::elm::Menu::Ref titlesMenu;
|
||||
std::unordered_map<AccountUid, std::vector<pu::ui::elm::MenuItem::Ref>> menuCache;
|
||||
bool m_inputLocked = false;
|
||||
std::unique_ptr<HeaderBar> header;
|
||||
std::unique_ptr<HintBar> hints;
|
||||
|
||||
pu::ui::elm::Rectangle::Ref panelBg;
|
||||
pu::ui::elm::TextBlock::Ref panelTitle;
|
||||
pu::ui::elm::TextBlock::Ref panelHint;
|
||||
pu::ui::elm::Rectangle::Ref btnTransferBg;
|
||||
pu::ui::elm::TextBlock::Ref btnTransferText;
|
||||
pu::ui::elm::Rectangle::Ref btnReceiveBg;
|
||||
pu::ui::elm::TextBlock::Ref btnReceiveText;
|
||||
pu::ui::elm::TextBlock::Ref panelFooter;
|
||||
pu::ui::elm::TextBlock::Ref emptyText;
|
||||
pu::ui::elm::TextBlock::Ref emptySub;
|
||||
|
||||
AccountUid current_uid{};
|
||||
TitlesFocus focus = TitlesFocus::List;
|
||||
TitlesAction action = TitlesAction::Transfer;
|
||||
int lockedListIndex = 0;
|
||||
|
||||
void refreshPanel();
|
||||
void refreshButtons();
|
||||
void updateHints();
|
||||
void runTransfer(int index, Title& title);
|
||||
void runReceive(int index, Title& title);
|
||||
|
||||
public:
|
||||
TitlesLayout();
|
||||
void InitTitles(AccountUid uid);
|
||||
void LockInput() {
|
||||
m_inputLocked = true;
|
||||
}
|
||||
void UnlockInput() {
|
||||
m_inputLocked = false;
|
||||
}
|
||||
|
||||
void onInput(u64 Down, u64 Up, u64 Held, pu::ui::TouchPoint Pos);
|
||||
|
||||
PU_SMART_CTOR(TitlesLayout)
|
||||
};
|
||||
} // namespace ui
|
||||
Reference in New Issue
Block a user