Files
dusklight/src/dusk/ui/tab_bar.hpp
T
qwertyquerty e49be12297 RmlUi improvements (#663)
* rmlui audio

* fix menu select sound

* Fixes #662

* fix reset logic and fix popup getting stuck closed

* fix X button on menu popup

* rmlui achievements, and fix open/close bug

* presets, achievements css, and menu sounds toggle

* forgor

* fix b button causing audio when menu not visible
2026-05-04 10:25:13 -06:00

47 lines
1.0 KiB
C++

#pragma once
#include "button.hpp"
#include "component.hpp"
#include "select_button.hpp"
namespace dusk::ui {
using TabCallback = std::function<void()>;
struct Tab {
Rml::String title;
Button& button;
TabCallback callback;
};
class TabBar : public FluentComponent<TabBar> {
public:
struct Props {
std::function<void()> onClose;
int selectedTabIndex = -1;
bool autoSelect = true;
};
explicit TabBar(Rml::Element* parent, Props props);
bool focus() override;
void add_tab(const Rml::String& title, TabCallback callback);
bool set_active_tab(int index);
void refresh_active_tab();
bool focus_tab(int index);
int focused_tab_index() const;
bool handle_nav_command(Rml::Event& event, NavCommand cmd);
private:
int tab_containing(Rml::Element* element) const;
Props mProps;
std::vector<Tab> mTabs;
Rml::Element* mEndSpacer = nullptr;
bool mRedirectingScroll = false;
int mLastFocusedTabIndex = -1;
};
} // namespace dusk::ui