diff --git a/files.cmake b/files.cmake
index c95bd904bd..798805a7c4 100644
--- a/files.cmake
+++ b/files.cmake
@@ -1485,12 +1485,12 @@ set(DUSK_FILES
src/dusk/ui/settings.hpp
src/dusk/ui/string_button.cpp
src/dusk/ui/string_button.hpp
- src/dusk/ui/tab_button.cpp
- src/dusk/ui/tab_button.hpp
- src/dusk/ui/ui.hpp
+ src/dusk/ui/tab_bar.cpp
+ src/dusk/ui/tab_bar.hpp
src/dusk/ui/ui.cpp
- src/dusk/ui/window.hpp
+ src/dusk/ui/ui.hpp
src/dusk/ui/window.cpp
+ src/dusk/ui/window.hpp
src/dusk/achievements.cpp
src/dusk/iso_validate.cpp
src/dusk/livesplit.cpp
diff --git a/res/rml/popup.rml b/res/rml/popup.rml
index 967c5d9fb3..0a9f4824e8 100644
--- a/res/rml/popup.rml
+++ b/res/rml/popup.rml
@@ -4,8 +4,6 @@
-
+
diff --git a/res/rml/window.rml b/res/rml/window.rml
index a77728d00d..4947c281c7 100644
--- a/res/rml/window.rml
+++ b/res/rml/window.rml
@@ -4,9 +4,6 @@
-
+
diff --git a/src/dusk/ui/popup.cpp b/src/dusk/ui/popup.cpp
index e78c615117..e2f5815e50 100644
--- a/src/dusk/ui/popup.cpp
+++ b/src/dusk/ui/popup.cpp
@@ -5,60 +5,36 @@
#include "aurora/rmlui.hpp"
#include "editor.hpp"
#include "settings.hpp"
-#include "tab_button.hpp"
#include "ui.hpp"
#include "window.hpp"
-#include
-#include
#include
namespace dusk::ui {
-Popup::Popup() : Document("res/rml/popup.rml") {
- auto* tabBar = mDocument->GetElementById("tab-bar");
- if (tabBar == nullptr) {
- return;
- }
-
- const std::array tabLabels = {
- "Settings",
- "Warp",
- "Editor",
- "Reset",
- "Exit",
- };
-
- // TODO: Make warp, reset, and exit buttons work
- mTabActions = {
- [this] {
- hide();
- // TODO: make this better
- auto& settingsWindow = add_document(std::make_unique());
- settingsWindow.show();
- set_selected_tab(0);
- },
- [this] { set_selected_tab(1); },
- [this] {
- hide();
- // TODO: make this better
- auto& editorWindow = add_document(std::make_unique());
- editorWindow.show();
- set_selected_tab(2);
- },
- [this] { set_selected_tab(3); },
- [this] { set_selected_tab(4); },
- };
-
- mTabs.reserve(tabLabels.size());
- for (int i = 0; i < static_cast(tabLabels.size()); ++i) {
- mTabs.push_back(
- create_tab_button(tabBar, tabLabels[i], i == mSelectedTabIndex, [this, i](Rml::Event&) {
- if (i >= 0 && i < static_cast(mTabActions.size())) {
- mTabActions[i]();
- }
- }));
- }
+Popup::Popup() : Document("res/rml/popup.rml"), mRoot(mDocument->GetElementById("popup")) {
+ mTabBar = std::make_unique(mRoot, TabBar::Props{.autoSelect = false});
+ mTabBar->add_tab("Settings", [this] {
+ hide();
+ // TODO: make this better
+ auto& settingsWindow = add_document(std::make_unique());
+ settingsWindow.show();
+ });
+ mTabBar->add_tab("Warp", [] {
+ // TODO
+ });
+ mTabBar->add_tab("Editor", [this] {
+ hide();
+ // TODO: make this better
+ auto& editorWindow = add_document(std::make_unique());
+ editorWindow.show();
+ });
+ mTabBar->add_tab("Reset", [] {
+ // TODO
+ });
+ mTabBar->add_tab("Exit", [] {
+ // TODO
+ });
}
void Popup::show() {
@@ -101,20 +77,6 @@ bool Popup::is_visible() const {
}
bool Popup::handle_nav_command(Rml::Event& event, NavCommand cmd) {
- if (cmd == NavCommand::Left || cmd == NavCommand::Previous) {
- focus_tab(std::max(0, mSelectedTabIndex - 1));
- return true;
- }
- if (cmd == NavCommand::Right || cmd == NavCommand::Next) {
- focus_tab(std::min(static_cast(mTabs.size()) - 1, mSelectedTabIndex + 1));
- return true;
- }
- if (cmd == NavCommand::Confirm && mSelectedTabIndex >= 0 &&
- mSelectedTabIndex < static_cast(mTabActions.size()))
- {
- mTabActions[mSelectedTabIndex]();
- return true;
- }
if (cmd == NavCommand::Cancel) {
hide();
return true;
@@ -130,36 +92,11 @@ void Popup::update() {
mDocument->Hide();
mHideDeadline.reset();
}
- if (mTabs.empty()) {
- return;
- }
- std::vector