Add Theme struct and theme management functions for improved GUI styling

This commit is contained in:
scawful
2024-12-29 16:03:59 -05:00
parent 3fc3e2af43
commit ed36d53600
2 changed files with 358 additions and 232 deletions

View File

@@ -1,16 +1,51 @@
#ifndef YAZE_APP_CORE_STYLE_H
#define YAZE_APP_CORE_STYLE_H
#include <string>
#include <vector>
#include "ImGuiColorTextEdit/TextEditor.h"
#include "absl/strings/string_view.h"
#include "app/gfx/bitmap.h"
#include "app/gui/color.h"
#include "imgui/imgui.h"
namespace yaze {
namespace gui {
struct Theme {
std::string name;
Color menu_bar_bg;
Color title_bar_bg;
Color header;
Color header_hovered;
Color header_active;
Color title_bg_active;
Color title_bg_collapsed;
Color tab;
Color tab_hovered;
Color tab_active;
Color button;
Color button_hovered;
Color button_active;
};
absl::StatusOr<Theme> LoadTheme(const std::string &filename);
absl::Status SaveTheme(const Theme &theme);
void ApplyTheme(const Theme &theme);
void ColorsYaze();
TextEditor::LanguageDefinition GetAssemblyLanguageDef();
void DrawBitmapViewer(const std::vector<gfx::Bitmap> &bitmaps, float scale,
int &current_bitmap);
void BeginWindowWithDisplaySettings(const char *id, bool *active,
const ImVec2 &size = ImVec2(0, 0),
ImGuiWindowFlags flags = 0);
@@ -31,15 +66,6 @@ void DrawDisplaySettings(ImGuiStyle *ref = nullptr);
void TextWithSeparators(const absl::string_view &text);
void ColorsYaze();
TextEditor::LanguageDefinition GetAssemblyLanguageDef();
void DrawBitmapViewer(const std::vector<gfx::Bitmap> &bitmaps, float scale,
int &current_bitmap);
// ============================================================================
static const char *ExampleNames[] = {
"Artichoke", "Arugula", "Asparagus", "Avocado",
"Bamboo Shoots", "Bean Sprouts", "Beans", "Beet",
@@ -91,7 +117,6 @@ struct MultiSelectWithClipper {
};
} // namespace gui
} // namespace yaze
#endif