yaze 0.2.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
style.h
Go to the documentation of this file.
1#ifndef YAZE_APP_CORE_STYLE_H
2#define YAZE_APP_CORE_STYLE_H
3
4#include <string>
5#include <vector>
6
7#include "absl/strings/string_view.h"
8#include "app/gfx/bitmap.h"
9#include "app/gui/color.h"
11#include "imgui/imgui.h"
12
13namespace yaze {
14namespace gui {
15
37
38absl::StatusOr<Theme> LoadTheme(const std::string &filename);
39absl::Status SaveTheme(const Theme &theme);
40void ApplyTheme(const Theme &theme);
41
42void ColorsYaze();
43
45
46void DrawBitmapViewer(const std::vector<gfx::Bitmap> &bitmaps, float scale,
47 int &current_bitmap);
48
49void BeginWindowWithDisplaySettings(const char *id, bool *active,
50 const ImVec2 &size = ImVec2(0, 0),
51 ImGuiWindowFlags flags = 0);
52
54
55void BeginPadding(int i);
56void EndPadding();
57
58void BeginNoPadding();
59void EndNoPadding();
60
61void BeginChildWithScrollbar(const char *str_id);
62
63void BeginChildBothScrollbars(int id);
64
65void DrawDisplaySettings(ImGuiStyle *ref = nullptr);
66
67void TextWithSeparators(const absl::string_view &text);
68
69void DrawFontManager();
70
71static const char *ExampleNames[] = {
72 "Artichoke", "Arugula", "Asparagus", "Avocado",
73 "Bamboo Shoots", "Bean Sprouts", "Beans", "Beet",
74 "Belgian Endive", "Bell Pepper", "Bitter Gourd", "Bok Choy",
75 "Broccoli", "Brussels Sprouts", "Burdock Root", "Cabbage",
76 "Calabash", "Capers", "Carrot", "Cassava",
77 "Cauliflower", "Celery", "Celery Root", "Celcuce",
78 "Chayote", "Chinese Broccoli", "Corn", "Cucumber"};
79
81 const int ITEMS_COUNT = 10000;
82 void Update() {
83 // Use default selection.Adapter: Pass index to
84 // SetNextItemSelectionUserData(), store index in Selection
85 static ImGuiSelectionBasicStorage selection;
86
87 ImGui::Text("Selection: %d/%d", selection.Size, ITEMS_COUNT);
88 if (ImGui::BeginChild(
89 "##Basket", ImVec2(-FLT_MIN, ImGui::GetFontSize() * 20),
90 ImGuiChildFlags_FrameStyle | ImGuiChildFlags_ResizeY)) {
91 ImGuiMultiSelectFlags flags = ImGuiMultiSelectFlags_ClearOnEscape |
92 ImGuiMultiSelectFlags_BoxSelect1d;
93 ImGuiMultiSelectIO *ms_io =
94 ImGui::BeginMultiSelect(flags, selection.Size, ITEMS_COUNT);
95 selection.ApplyRequests(ms_io);
96
97 ImGuiListClipper clipper;
98 clipper.Begin(ITEMS_COUNT);
99 if (ms_io->RangeSrcItem != -1)
100 clipper.IncludeItemByIndex(
101 (int)ms_io->RangeSrcItem); // Ensure RangeSrc item is not clipped.
102 while (clipper.Step()) {
103 for (int n = clipper.DisplayStart; n < clipper.DisplayEnd; n++) {
104 char label[64];
105 // sprintf(label, "Object %05d: %s", n,
106 // ExampleNames[n % IM_ARRAYSIZE(ExampleNames)]);
107 bool item_is_selected = selection.Contains((ImGuiID)n);
108 ImGui::SetNextItemSelectionUserData(n);
109 ImGui::Selectable(label, item_is_selected);
110 }
111 }
112
113 ms_io = ImGui::EndMultiSelect();
114 selection.ApplyRequests(ms_io);
115 }
116 ImGui::EndChild();
117 ImGui::TreePop();
118 }
119};
120
121} // namespace gui
122} // namespace yaze
123
124#endif
Graphical User Interface (GUI) components for the application.
Definition canvas.cc:15
void DrawBitmapViewer(const std::vector< gfx::Bitmap > &bitmaps, float scale, int &current_bitmap_id)
Definition style.cc:216
void DrawFontManager()
Definition style.cc:752
absl::StatusOr< Theme > LoadTheme(const std::string &filename)
Definition style.cc:48
void BeginPadding(int i)
Definition style.cc:358
void BeginChildBothScrollbars(int id)
Definition style.cc:375
void EndNoPadding()
Definition style.cc:368
TextEditor::LanguageDefinition GetAssemblyLanguageDef()
Definition style.cc:277
void DrawDisplaySettings(ImGuiStyle *ref)
Definition style.cc:382
void EndPadding()
Definition style.cc:362
absl::Status SaveTheme(const Theme &theme)
Definition style.cc:75
void BeginNoPadding()
Definition style.cc:364
void EndWindowWithDisplaySettings()
Definition style.cc:353
void ColorsYaze()
Definition style.cc:117
void BeginWindowWithDisplaySettings(const char *id, bool *active, const ImVec2 &size, ImGuiWindowFlags flags)
Definition style.cc:333
void TextWithSeparators(const absl::string_view &text)
Definition style.cc:746
void BeginChildWithScrollbar(const char *str_id)
Definition style.cc:370
void ApplyTheme(const Theme &theme)
Definition style.cc:98
Main namespace for the application.
Definition controller.cc:18
Color button_active
Definition style.h:35
Color tab_hovered
Definition style.h:30
Color title_bar_bg
Definition style.h:20
Color header
Definition style.h:22
Color menu_bar_bg
Definition style.h:19
std::string name
Definition style.h:17
Color title_bg_collapsed
Definition style.h:27
Color header_active
Definition style.h:24
Color header_hovered
Definition style.h:23
Color title_bg_active
Definition style.h:26
Color tab_active
Definition style.h:31
Color button
Definition style.h:33
Color button_hovered
Definition style.h:34