1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-22 18:26:39 +00:00

GameCardTab: use extended brls::Table class.

Allows focusing on our table without highlighting it.
This commit is contained in:
Pablo Curiel 2021-06-14 01:55:31 -04:00
parent d7081bbc1c
commit 296115f886
2 changed files with 33 additions and 4 deletions

View file

@ -29,6 +29,17 @@
namespace nxdt::views
{
class GameCardTable: public brls::Table
{
protected:
brls::View* getDefaultFocus(void) override;
void onFocusGained(void) override;
public:
GameCardTable(void);
~GameCardTable(void);
};
class GameCardTab: public brls::LayerView
{
private:
@ -40,7 +51,7 @@ namespace nxdt::views
brls::List *list = nullptr;
brls::Table *properties_table = nullptr;
GameCardTable *properties_table = nullptr;
brls::TableRow *capacity = nullptr;
brls::TableRow *total_size = nullptr;
brls::TableRow *trimmed_size = nullptr;

View file

@ -41,6 +41,24 @@ namespace nxdt::views
[GameCardFwVersion_Since1200NUP] = "12.0.0+"
};
GameCardTable::GameCardTable(void) : brls::Table() { }
GameCardTable::~GameCardTable(void) { }
brls::View* GameCardTable::getDefaultFocus(void)
{
return this;
}
void GameCardTable::onFocusGained(void)
{
this->focused = true;
this->focusEvent.fire(this);
if (this->hasParent()) this->getParent()->onChildFocusGained(this);
}
GameCardTab::GameCardTab(nxdt::tasks::GameCardTask *gc_status_task) : brls::LayerView(), gc_status_task(gc_status_task)
{
/* Error frame. */
@ -55,7 +73,7 @@ namespace nxdt::views
/* Gamecard properties table. */
this->list->addView(new brls::Header("gamecard_tab/list/properties_table/header"_i18n));
this->properties_table = new brls::Table();
this->properties_table = new GameCardTable();
this->capacity = this->properties_table->addRow(brls::TableRowType::BODY, "gamecard_tab/list/properties_table/capacity"_i18n);
this->total_size = this->properties_table->addRow(brls::TableRowType::BODY, "gamecard_tab/list/properties_table/total_size"_i18n);
this->trimmed_size = this->properties_table->addRow(brls::TableRowType::BODY, "gamecard_tab/list/properties_table/trimmed_size"_i18n);
@ -189,8 +207,8 @@ namespace nxdt::views
if (index == -1) return;
/* Focus the sidebar if we're currently focusing a ListItem element. */
if (current_focus && (current_focus == this->dump_card_image || current_focus == this->dump_certificate || current_focus == this->dump_header || \
/* Focus the sidebar if we're currently focusing an element from our List. */
if (current_focus && (current_focus == this->properties_table || current_focus == this->dump_card_image || current_focus == this->dump_certificate || current_focus == this->dump_header || \
current_focus == this->dump_decrypted_cardinfo || current_focus == this->dump_initial_data || current_focus == this->dump_hfs_partitions))
{
brls::Application::onGamepadButtonPressed(GLFW_GAMEPAD_BUTTON_DPAD_LEFT, false);