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
40
41absl::StatusOr<Theme> LoadTheme(const std::string &filename);
42absl::Status SaveTheme(const Theme &theme);
43void ApplyTheme(const Theme &theme);
44
45void ColorsYaze();
46
48
49void DrawBitmapViewer(const std::vector<gfx::Bitmap> &bitmaps, float scale,
50 int &current_bitmap);
51
52void BeginWindowWithDisplaySettings(const char *id, bool *active,
53 const ImVec2 &size = ImVec2(0, 0),
54 ImGuiWindowFlags flags = 0);
55
57
58void BeginPadding(int i);
59void EndPadding();
60
61void BeginNoPadding();
62void EndNoPadding();
63
64void BeginChildWithScrollbar(const char *str_id);
65
66void BeginChildBothScrollbars(int id);
67
68void DrawDisplaySettings(ImGuiStyle *ref = nullptr);
69
70void TextWithSeparators(const absl::string_view &text);
71
72void DrawFontManager();
73
74static const char *ExampleNames[] = {
75 "Artichoke", "Arugula", "Asparagus", "Avocado",
76 "Bamboo Shoots", "Bean Sprouts", "Beans", "Beet",
77 "Belgian Endive", "Bell Pepper", "Bitter Gourd", "Bok Choy",
78 "Broccoli", "Brussels Sprouts", "Burdock Root", "Cabbage",
79 "Calabash", "Capers", "Carrot", "Cassava",
80 "Cauliflower", "Celery", "Celery Root", "Celcuce",
81 "Chayote", "Chinese Broccoli", "Corn", "Cucumber"};
82
84 const int ITEMS_COUNT = 10000;
85 void Update() {
86 // Use default selection.Adapter: Pass index to
87 // SetNextItemSelectionUserData(), store index in Selection
88 static ImGuiSelectionBasicStorage selection;
89
90 ImGui::Text("Selection: %d/%d", selection.Size, ITEMS_COUNT);
91 if (ImGui::BeginChild(
92 "##Basket", ImVec2(-FLT_MIN, ImGui::GetFontSize() * 20),
93 ImGuiChildFlags_FrameStyle | ImGuiChildFlags_ResizeY)) {
94 ImGuiMultiSelectFlags flags = ImGuiMultiSelectFlags_ClearOnEscape |
95 ImGuiMultiSelectFlags_BoxSelect1d;
96 ImGuiMultiSelectIO *ms_io =
97 ImGui::BeginMultiSelect(flags, selection.Size, ITEMS_COUNT);
98 selection.ApplyRequests(ms_io);
99
100 ImGuiListClipper clipper;
101 clipper.Begin(ITEMS_COUNT);
102 if (ms_io->RangeSrcItem != -1)
103 clipper.IncludeItemByIndex(
104 (int)ms_io->RangeSrcItem); // Ensure RangeSrc item is not clipped.
105 while (clipper.Step()) {
106 for (int n = clipper.DisplayStart; n < clipper.DisplayEnd; n++) {
107 char label[64];
108 // sprintf(label, "Object %05d: %s", n,
109 // ExampleNames[n % IM_ARRAYSIZE(ExampleNames)]);
110 bool item_is_selected = selection.Contains((ImGuiID)n);
111 ImGui::SetNextItemSelectionUserData(n);
112 ImGui::Selectable(label, item_is_selected);
113 }
114 }
115
116 ms_io = ImGui::EndMultiSelect();
117 selection.ApplyRequests(ms_io);
118 }
119 ImGui::EndChild();
120 ImGui::TreePop();
121 }
122};
123
124} // namespace gui
125} // namespace yaze
126
127#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:231
void DrawFontManager()
Definition style.cc:759
absl::StatusOr< Theme > LoadTheme(const std::string &filename)
Definition style.cc:48
void BeginPadding(int i)
Definition style.cc:372
void BeginChildBothScrollbars(int id)
Definition style.cc:389
void EndNoPadding()
Definition style.cc:382
TextEditor::LanguageDefinition GetAssemblyLanguageDef()
Definition style.cc:292
void DrawDisplaySettings(ImGuiStyle *ref)
Definition style.cc:396
void EndPadding()
Definition style.cc:376
absl::Status SaveTheme(const Theme &theme)
Definition style.cc:75
void BeginNoPadding()
Definition style.cc:378
void EndWindowWithDisplaySettings()
Definition style.cc:367
void ColorsYaze()
Definition style.cc:132
void BeginWindowWithDisplaySettings(const char *id, bool *active, const ImVec2 &size, ImGuiWindowFlags flags)
Definition style.cc:347
void TextWithSeparators(const absl::string_view &text)
Definition style.cc:753
void BeginChildWithScrollbar(const char *str_id)
Definition style.cc:384
void ApplyTheme(const Theme &theme)
Definition style.cc:107
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 clickable_text_hovered
Definition style.h:38
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 clickable_text
Definition style.h:37
Color button
Definition style.h:33
Color button_hovered
Definition style.h:34