Files
ts-qt/component.hh

43 lines
1.3 KiB
C++

#pragma once
#include <creeper-qt/utility/theme/theme.hh>
#include <creeper-qt/utility/wrapper/mutable-value.hh>
#include <functional>
#include <memory>
#include <qwidget.h>
#include <string_view>
#include <tuple>
#include <vector>
template <typename T>
using raw_pointer = T*;
struct NavComponentState {
creeper::ThemeManager& manager;
std::function<void(int, const std::string_view&)> switch_callback;
std::vector<std::tuple<std::string_view, std::string_view>> buttons_context;
std::function<void(int)> stacked_callback;
std::shared_ptr<creeper::MutableValue<bool>> heatmap_show_numbers;
};
auto NavComponent(NavComponentState&) noexcept -> raw_pointer<QWidget>;
struct ViewComponentState {
creeper::ThemeManager& manager;
};
auto ViewComponent(ViewComponentState&) noexcept -> raw_pointer<QWidget>;
struct SettingComponentState {
creeper::ThemeManager& manager;
};
auto SettingComponent(SettingComponentState&) noexcept -> raw_pointer<QWidget>;
struct HandViewComponentState {
creeper::ThemeManager& manager;
};
auto HandViewComponent(HandViewComponentState&) noexcept -> raw_pointer<QWidget>;
// 让其他模块可触发视图层的串口/配置刷新
void RefreshProfilesForView();
std::shared_ptr<creeper::MutableValue<bool>> HeatmapNumberVisibilityContext();