1#ifndef YAZE_APP_CORE_STYLE_H
2#define YAZE_APP_CORE_STYLE_H
8#include "absl/strings/string_view.h"
12#include "imgui/imgui.h"
42absl::StatusOr<Theme>
LoadTheme(
const std::string &filename);
54 const ImVec2 &size = ImVec2(0, 0),
55 ImGuiWindowFlags flags = 0);
93 void Copy() { ImGui::SetClipboardText(
text.c_str()); }
104 std::string str = ImGui::GetClipboardText();
136 std::function<void(
int index,
const T &item,
bool is_selected)>;
140 const char *title =
"Selection",
141 ImGuiMultiSelectFlags flags = ImGuiMultiSelectFlags_ClearOnEscape |
142 ImGuiMultiSelectFlags_BoxSelect1d)
163 if (ImGui::BeginChild(
164 "##MultiSelectChild",
167 ImGuiMultiSelectIO *ms_io =
171 ImGuiListClipper clipper;
172 clipper.Begin(
items_.size());
173 if (ms_io->RangeSrcItem != -1)
174 clipper.IncludeItemByIndex((
int)ms_io->RangeSrcItem);
176 while (clipper.Step()) {
177 for (
int n = clipper.DisplayStart; n < clipper.DisplayEnd; n++) {
178 bool item_is_selected =
selection_.Contains((ImGuiID)n);
179 ImGui::SetNextItemSelectionUserData(n);
186 snprintf(label,
sizeof(label),
"Item %d", n);
187 ImGui::Selectable(label, item_is_selected);
192 ms_io = ImGui::EndMultiSelect();
200 std::vector<int> indices;
201 for (
int i = 0; i <
items_.size(); i++) {
203 indices.push_back(i);
220 ImGuiChildFlags_FrameStyle | ImGuiChildFlags_ResizeY;
void SetItemRenderer(ItemRenderer renderer)
void SetItems(const std::vector< T > &items)
ItemRenderer item_renderer_
void SetHeight(float height_in_font_units=20.0f)
ImGuiMultiSelectFlags flags_
MultiSelect(const char *title="Selection", ImGuiMultiSelectFlags flags=ImGuiMultiSelectFlags_ClearOnEscape|ImGuiMultiSelectFlags_BoxSelect1d)
std::function< void(int index, const T &item, bool is_selected)> ItemRenderer
void SetChildFlags(ImGuiChildFlags flags)
ImGuiChildFlags child_flags_
ImGuiSelectionBasicStorage selection_
std::vector< int > GetSelectedIndices() const
float height_in_font_units_
Graphical User Interface (GUI) components for the application.
void DrawBitmapViewer(const std::vector< gfx::Bitmap > &bitmaps, float scale, int ¤t_bitmap_id)
absl::StatusOr< Theme > LoadTheme(const std::string &filename)
void BeginChildBothScrollbars(int id)
TextEditor::LanguageDefinition GetAssemblyLanguageDef()
void DrawDisplaySettings(ImGuiStyle *ref)
absl::Status SaveTheme(const Theme &theme)
void EndWindowWithDisplaySettings()
void BeginWindowWithDisplaySettings(const char *id, bool *active, const ImVec2 &size, ImGuiWindowFlags flags)
void TextWithSeparators(const absl::string_view &text)
void BeginChildWithScrollbar(const char *str_id)
void ApplyTheme(const Theme &theme)
Main namespace for the application.
Color clickable_text_hovered