mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 05:15:47 -04:00
FullscreenUI: Various improvements
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -33,6 +33,8 @@ public:
|
||||
ProgressCallback(std::string name);
|
||||
~ProgressCallback() override;
|
||||
|
||||
ALWAYS_INLINE const std::string& GetName() const { return m_name; }
|
||||
|
||||
void PushState() override;
|
||||
void PopState() override;
|
||||
|
||||
|
@ -647,7 +647,7 @@ std::string GameList::GetCoverImagePath(const std::string& path, const std::stri
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string GameList::GetNewCoverImagePathForEntry(const Entry* entry, const char* new_filename)
|
||||
std::string GameList::GetNewCoverImagePathForEntry(const Entry* entry, const char* new_filename, bool use_serial)
|
||||
{
|
||||
const char* extension = std::strrchr(new_filename, '.');
|
||||
if (!extension)
|
||||
@ -665,12 +665,12 @@ std::string GameList::GetNewCoverImagePathForEntry(const Entry* entry, const cha
|
||||
const std::string sanitized_name(Path::SanitizeFileName(entry->title));
|
||||
|
||||
std::string name;
|
||||
if (sanitized_name != entry->title)
|
||||
if (sanitized_name != entry->title || use_serial)
|
||||
name = fmt::format("{}{}", entry->serial, extension);
|
||||
else
|
||||
name = fmt::format("{}{}", entry->title, extension);
|
||||
|
||||
return Path::Combine(EmuFolders::Covers, name);
|
||||
return Path::Combine(EmuFolders::Covers, Path::SanitizeFileName(name));
|
||||
}
|
||||
|
||||
size_t GameList::Entry::GetReleaseDateString(char* buffer, size_t buffer_size) const
|
||||
@ -690,7 +690,8 @@ size_t GameList::Entry::GetReleaseDateString(char* buffer, size_t buffer_size) c
|
||||
return std::strftime(buffer, buffer_size, "%d %B %Y", &date_tm);
|
||||
}
|
||||
|
||||
bool GameList::DownloadCovers(const std::vector<std::string>& url_templates, ProgressCallback* progress /*= nullptr*/)
|
||||
bool GameList::DownloadCovers(const std::vector<std::string>& url_templates, bool use_serial,
|
||||
ProgressCallback* progress, std::function<void(const Entry*, std::string)> save_callback)
|
||||
{
|
||||
if (!progress)
|
||||
progress = ProgressCallback::NullProgressCallback;
|
||||
@ -776,23 +777,25 @@ bool GameList::DownloadCovers(const std::vector<std::string>& url_templates, Pro
|
||||
|
||||
// we could actually do a few in parallel here...
|
||||
std::string filename(Common::HTTPDownloader::URLDecode(url));
|
||||
downloader->CreateRequest(std::move(url), [entry_path = std::move(entry_path), filename = std::move(filename)](
|
||||
s32 status_code, Common::HTTPDownloader::Request::Data data) {
|
||||
if (status_code != Common::HTTPDownloader::HTTP_OK || data.empty())
|
||||
return;
|
||||
downloader->CreateRequest(
|
||||
std::move(url), [use_serial, &save_callback, entry_path = std::move(entry_path),
|
||||
filename = std::move(filename)](s32 status_code, Common::HTTPDownloader::Request::Data data) {
|
||||
if (status_code != Common::HTTPDownloader::HTTP_OK || data.empty())
|
||||
return;
|
||||
|
||||
std::unique_lock lock(s_mutex);
|
||||
const GameList::Entry* entry = GetEntryForPath(entry_path.c_str());
|
||||
if (!entry || !GetCoverImagePathForEntry(entry).empty())
|
||||
return;
|
||||
std::unique_lock lock(s_mutex);
|
||||
const GameList::Entry* entry = GetEntryForPath(entry_path.c_str());
|
||||
if (!entry || !GetCoverImagePathForEntry(entry).empty())
|
||||
return;
|
||||
|
||||
std::string write_path(GetNewCoverImagePathForEntry(entry, filename.c_str()));
|
||||
if (write_path.empty())
|
||||
return;
|
||||
std::string write_path(GetNewCoverImagePathForEntry(entry, filename.c_str(), use_serial));
|
||||
if (write_path.empty())
|
||||
return;
|
||||
|
||||
FileSystem::WriteBinaryFile(write_path.c_str(), data.data(), data.size());
|
||||
Host::CoversChanged();
|
||||
});
|
||||
FileSystem::WriteBinaryFile(write_path.c_str(), data.data(), data.size());
|
||||
if (save_callback)
|
||||
save_callback(entry, std::move(write_path));
|
||||
});
|
||||
downloader->WaitForAllRequests();
|
||||
progress->IncrementProgressValue();
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "core/types.h"
|
||||
#include "util/cd_image.h"
|
||||
#include <ctime>
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
@ -74,9 +75,13 @@ void Refresh(bool invalidate_cache, bool only_cache = false, ProgressCallback* p
|
||||
|
||||
std::string GetCoverImagePathForEntry(const Entry* entry);
|
||||
std::string GetCoverImagePath(const std::string& path, const std::string& serial, const std::string& title);
|
||||
std::string GetNewCoverImagePathForEntry(const Entry* entry, const char* new_filename);
|
||||
std::string GetNewCoverImagePathForEntry(const Entry* entry, const char* new_filename, bool use_serial);
|
||||
|
||||
bool DownloadCovers(const std::vector<std::string>& url_templates, ProgressCallback* progress = nullptr);
|
||||
/// Downloads covers using the specified URL templates. By default, covers are saved by title, but this can be changed
|
||||
/// with the use_serial parameter. save_callback optionall takes the entry and the path the new cover is saved to.
|
||||
bool DownloadCovers(const std::vector<std::string>& url_templates, bool use_serial = false,
|
||||
ProgressCallback* progress = nullptr,
|
||||
std::function<void(const Entry*, std::string)> save_callback = {});
|
||||
}; // namespace GameList
|
||||
|
||||
namespace Host {
|
||||
@ -85,8 +90,4 @@ void RefreshGameListAsync(bool invalidate_cache);
|
||||
|
||||
/// Cancels game list refresh, if there is one in progress.
|
||||
void CancelGameListRefresh();
|
||||
|
||||
void DownloadCoversAsync(std::vector<std::string> url_templates);
|
||||
void CancelCoversDownload();
|
||||
void CoversChanged();
|
||||
} // namespace Host
|
||||
|
@ -106,6 +106,55 @@ std::vector<std::string> Host::GetStringListSetting(const char* section, const c
|
||||
return s_layered_settings_interface.GetStringList(section, key);
|
||||
}
|
||||
|
||||
void Host::SetBaseBoolSettingValue(const char* section, const char* key, bool value)
|
||||
{
|
||||
std::unique_lock lock(s_settings_mutex);
|
||||
s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->SetBoolValue(section, key, value);
|
||||
}
|
||||
|
||||
void Host::SetBaseIntSettingValue(const char* section, const char* key, int value)
|
||||
{
|
||||
std::unique_lock lock(s_settings_mutex);
|
||||
s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->SetIntValue(section, key, value);
|
||||
}
|
||||
|
||||
void Host::SetBaseFloatSettingValue(const char* section, const char* key, float value)
|
||||
{
|
||||
std::unique_lock lock(s_settings_mutex);
|
||||
s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->SetFloatValue(section, key, value);
|
||||
}
|
||||
|
||||
void Host::SetBaseStringSettingValue(const char* section, const char* key, const char* value)
|
||||
{
|
||||
std::unique_lock lock(s_settings_mutex);
|
||||
s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->SetStringValue(section, key, value);
|
||||
}
|
||||
|
||||
void Host::SetBaseStringListSettingValue(const char* section, const char* key, const std::vector<std::string>& values)
|
||||
{
|
||||
std::unique_lock lock(s_settings_mutex);
|
||||
s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->SetStringList(section, key, values);
|
||||
}
|
||||
|
||||
bool Host::AddValueToBaseStringListSetting(const char* section, const char* key, const char* value)
|
||||
{
|
||||
std::unique_lock lock(s_settings_mutex);
|
||||
return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->AddToStringList(section, key, value);
|
||||
}
|
||||
|
||||
bool Host::RemoveValueFromBaseStringListSetting(const char* section, const char* key, const char* value)
|
||||
{
|
||||
std::unique_lock lock(s_settings_mutex);
|
||||
return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)
|
||||
->RemoveFromStringList(section, key, value);
|
||||
}
|
||||
|
||||
void Host::DeleteBaseSettingValue(const char* section, const char* key)
|
||||
{
|
||||
std::unique_lock lock(s_settings_mutex);
|
||||
s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->DeleteValue(section, key);
|
||||
}
|
||||
|
||||
SettingsInterface* Host::Internal::GetBaseSettingsLayer()
|
||||
{
|
||||
return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE);
|
||||
|
@ -17,15 +17,20 @@
|
||||
#include "fmt/core.h"
|
||||
#include "imgui_internal.h"
|
||||
#include "imgui_stdlib.h"
|
||||
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <condition_variable>
|
||||
#include <deque>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include <variant>
|
||||
|
||||
Log_SetChannel(ImGuiFullscreen);
|
||||
|
||||
namespace ImGuiFullscreen {
|
||||
using MessageDialogCallbackVariant = std::variant<InfoMessageDialogCallback, ConfirmMessageDialogCallback>;
|
||||
|
||||
static std::optional<Common::RGBA8Image> LoadTextureImage(const char* path);
|
||||
static std::shared_ptr<HostDisplayTexture> UploadTexture(const char* path, const Common::RGBA8Image& image);
|
||||
static void TextureLoaderThread();
|
||||
@ -33,6 +38,7 @@ static void TextureLoaderThread();
|
||||
static void DrawFileSelector();
|
||||
static void DrawChoiceDialog();
|
||||
static void DrawInputDialog();
|
||||
static void DrawMessageDialog();
|
||||
static void DrawBackgroundProgressDialogs(ImVec2& position, float spacing);
|
||||
static void DrawNotifications(ImVec2& position, float spacing);
|
||||
static void DrawToast();
|
||||
@ -98,6 +104,12 @@ static std::string s_input_dialog_text;
|
||||
static std::string s_input_dialog_ok_text;
|
||||
static InputStringDialogCallback s_input_dialog_callback;
|
||||
|
||||
static bool s_message_dialog_open = false;
|
||||
static std::string s_message_dialog_title;
|
||||
static std::string s_message_dialog_message;
|
||||
static std::array<std::string, 3> s_message_dialog_buttons;
|
||||
static MessageDialogCallbackVariant s_message_dialog_callback;
|
||||
|
||||
struct FileSelectorItem
|
||||
{
|
||||
FileSelectorItem() = default;
|
||||
@ -201,6 +213,7 @@ void ImGuiFullscreen::Shutdown()
|
||||
s_notifications.clear();
|
||||
s_background_progress_dialogs.clear();
|
||||
CloseInputDialog();
|
||||
CloseMessageDialog();
|
||||
s_choice_dialog_open = false;
|
||||
s_choice_dialog_checkable = false;
|
||||
s_choice_dialog_title = {};
|
||||
@ -431,6 +444,16 @@ void ImGuiFullscreen::BeginLayout()
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, LayoutScale(8.0f, 8.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(4.0f, 3.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, LayoutScale(8.0f, 4.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, LayoutScale(4.0f, 4.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, LayoutScale(4.0f, 2.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, LayoutScale(21.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarSize, LayoutScale(14.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarRounding, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_GrabMinSize, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_TabRounding, LayoutScale(4.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, UISecondaryTextColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_TextDisabled, UIDisabledColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, UISecondaryColor);
|
||||
@ -448,6 +471,7 @@ void ImGuiFullscreen::EndLayout()
|
||||
DrawFileSelector();
|
||||
DrawChoiceDialog();
|
||||
DrawInputDialog();
|
||||
DrawMessageDialog();
|
||||
|
||||
const float notification_margin = LayoutScale(10.0f);
|
||||
const float spacing = LayoutScale(10.0f);
|
||||
@ -460,7 +484,7 @@ void ImGuiFullscreen::EndLayout()
|
||||
DrawToast();
|
||||
|
||||
ImGui::PopStyleColor(10);
|
||||
ImGui::PopStyleVar(2);
|
||||
ImGui::PopStyleVar(12);
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::QueueResetFocus()
|
||||
@ -536,10 +560,12 @@ void ImGuiFullscreen::PopSecondaryColor()
|
||||
ImGui::PopStyleColor(5);
|
||||
}
|
||||
|
||||
bool ImGuiFullscreen::BeginFullscreenColumns(const char* title)
|
||||
bool ImGuiFullscreen::BeginFullscreenColumns(const char* title, float pos_y, bool expand_to_screen_width)
|
||||
{
|
||||
ImGui::SetNextWindowPos(ImVec2(g_layout_padding_left, 0.0f));
|
||||
ImGui::SetNextWindowSize(ImVec2(LayoutScale(LAYOUT_SCREEN_WIDTH), ImGui::GetIO().DisplaySize.y));
|
||||
ImGui::SetNextWindowPos(ImVec2(expand_to_screen_width ? 0.0f : g_layout_padding_left, pos_y));
|
||||
ImGui::SetNextWindowSize(
|
||||
ImVec2(expand_to_screen_width ? ImGui::GetIO().DisplaySize.x : LayoutScale(LAYOUT_SCREEN_WIDTH),
|
||||
ImGui::GetIO().DisplaySize.y - pos_y));
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||
@ -569,8 +595,16 @@ void ImGuiFullscreen::EndFullscreenColumns()
|
||||
|
||||
bool ImGuiFullscreen::BeginFullscreenColumnWindow(float start, float end, const char* name, const ImVec4& background)
|
||||
{
|
||||
const ImVec2 pos(LayoutScale(start), 0.0f);
|
||||
const ImVec2 size(LayoutScale(end - start), ImGui::GetIO().DisplaySize.y);
|
||||
start = LayoutScale(start);
|
||||
end = LayoutScale(end);
|
||||
|
||||
if (start < 0.0f)
|
||||
start = ImGui::GetIO().DisplaySize.x + start;
|
||||
if (end <= 0.0f)
|
||||
end = ImGui::GetIO().DisplaySize.x + end;
|
||||
|
||||
const ImVec2 pos(start, 0.0f);
|
||||
const ImVec2 size(end - start, ImGui::GetCurrentWindow()->Size.y);
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, background);
|
||||
|
||||
@ -891,6 +925,33 @@ bool ImGuiFullscreen::MenuButton(const char* title, const char* summary, bool en
|
||||
return pressed;
|
||||
}
|
||||
|
||||
bool ImGuiFullscreen::MenuButtonWithoutSummary(const char* title, bool enabled, float height, ImFont* font,
|
||||
const ImVec2& text_align)
|
||||
{
|
||||
ImRect bb;
|
||||
bool visible, hovered;
|
||||
bool pressed = MenuButtonFrame(title, enabled, height, &visible, &hovered, &bb);
|
||||
if (!visible)
|
||||
return false;
|
||||
|
||||
const float midpoint = bb.Min.y + font->FontSize + LayoutScale(4.0f);
|
||||
const ImRect title_bb(bb.Min, ImVec2(bb.Max.x, midpoint));
|
||||
const ImRect summary_bb(ImVec2(bb.Min.x, midpoint), bb.Max);
|
||||
|
||||
if (!enabled)
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetColorU32(ImGuiCol_TextDisabled));
|
||||
|
||||
ImGui::PushFont(font);
|
||||
ImGui::RenderTextClipped(title_bb.Min, title_bb.Max, title, nullptr, nullptr, text_align, &title_bb);
|
||||
ImGui::PopFont();
|
||||
|
||||
if (!enabled)
|
||||
ImGui::PopStyleColor();
|
||||
|
||||
s_menu_button_index++;
|
||||
return pressed;
|
||||
}
|
||||
|
||||
bool ImGuiFullscreen::MenuImageButton(const char* title, const char* summary, ImTextureID user_texture_id,
|
||||
const ImVec2& image_size, bool enabled, float height, const ImVec2& uv0,
|
||||
const ImVec2& uv1, ImFont* title_font, ImFont* summary_font)
|
||||
@ -1215,6 +1276,7 @@ bool ImGuiFullscreen::RangeButton(const char* title, const char* summary, s32* v
|
||||
bool changed = false;
|
||||
|
||||
ImGui::SetNextWindowSize(LayoutScale(500.0f, 180.0f));
|
||||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
@ -1286,6 +1348,7 @@ bool ImGuiFullscreen::RangeButton(const char* title, const char* summary, float*
|
||||
bool changed = false;
|
||||
|
||||
ImGui::SetNextWindowSize(LayoutScale(500.0f, 180.0f));
|
||||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
@ -1531,7 +1594,7 @@ void ImGuiFullscreen::PopulateFileSelectorItems()
|
||||
{
|
||||
for (std::string& root_path : FileSystem::GetRootDirectoryList())
|
||||
{
|
||||
s_file_selector_items.emplace_back(StringUtil::StdStringFromFormat(ICON_FA_FOLDER " %s", root_path.c_str()),
|
||||
s_file_selector_items.emplace_back(StringUtil::StdStringFromFormat(ICON_FA_FOLDER " %s", root_path.c_str()),
|
||||
std::move(root_path), false);
|
||||
}
|
||||
}
|
||||
@ -1566,7 +1629,7 @@ void ImGuiFullscreen::PopulateFileSelectorItems()
|
||||
|
||||
if (fd.Attributes & FILESYSTEM_FILE_ATTRIBUTE_DIRECTORY)
|
||||
{
|
||||
std::string title(StringUtil::StdStringFromFormat(ICON_FA_FOLDER " %s", fd.FileName.c_str()));
|
||||
std::string title(StringUtil::StdStringFromFormat(ICON_FA_FOLDER " %s", fd.FileName.c_str()));
|
||||
s_file_selector_items.emplace_back(std::move(title), std::move(full_path), false);
|
||||
}
|
||||
else
|
||||
@ -1580,7 +1643,7 @@ void ImGuiFullscreen::PopulateFileSelectorItems()
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string title(StringUtil::StdStringFromFormat(ICON_FA_FILE " %s", fd.FileName.c_str()));
|
||||
std::string title(StringUtil::StdStringFromFormat(ICON_FA_FILE " %s", fd.FileName.c_str()));
|
||||
s_file_selector_items.emplace_back(std::move(title), std::move(full_path), true);
|
||||
}
|
||||
}
|
||||
@ -1652,7 +1715,7 @@ void ImGuiFullscreen::DrawFileSelector()
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, UIPrimaryTextColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBg, UIPrimaryDarkColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBgActive, UIPrimaryColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, UIBackgroundColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, MulAlpha(UIBackgroundColor, 0.95f));
|
||||
|
||||
bool is_open = !WantsToCloseMenu();
|
||||
bool directory_selected = false;
|
||||
@ -1665,13 +1728,13 @@ void ImGuiFullscreen::DrawFileSelector()
|
||||
|
||||
if (!s_file_selector_current_directory.empty())
|
||||
{
|
||||
MenuButton(fmt::format(ICON_FA_FOLDER_OPEN " {}", s_file_selector_current_directory).c_str(), nullptr, false,
|
||||
MenuButton(fmt::format(ICON_FA_FOLDER_OPEN " {}", s_file_selector_current_directory).c_str(), nullptr, false,
|
||||
LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY);
|
||||
}
|
||||
|
||||
if (s_file_selector_directory && !s_file_selector_current_directory.empty())
|
||||
{
|
||||
if (MenuButton(ICON_FA_FOLDER_PLUS " <Use This Directory>", nullptr, true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY))
|
||||
if (MenuButton(ICON_FA_FOLDER_PLUS " <Use This Directory>", nullptr, true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY))
|
||||
directory_selected = true;
|
||||
}
|
||||
|
||||
@ -1755,16 +1818,6 @@ void ImGuiFullscreen::DrawChoiceDialog()
|
||||
if (!s_choice_dialog_open)
|
||||
return;
|
||||
|
||||
const float width = 600.0f;
|
||||
const float title_height =
|
||||
g_large_font->FontSize + ImGui::GetStyle().FramePadding.y * 2.0f + ImGui::GetStyle().WindowPadding.y * 2.0f;
|
||||
const float height =
|
||||
std::min(400.0f, title_height + (LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY + (LAYOUT_MENU_BUTTON_Y_PADDING * 2.0f)) *
|
||||
static_cast<float>(s_choice_dialog_options.size()));
|
||||
ImGui::SetNextWindowSize(LayoutScale(width, height));
|
||||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
ImGui::OpenPopup(s_choice_dialog_title.c_str());
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,
|
||||
@ -1772,7 +1825,18 @@ void ImGuiFullscreen::DrawChoiceDialog()
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, UIPrimaryTextColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBg, UIPrimaryDarkColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBgActive, UIPrimaryColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, UIBackgroundColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, MulAlpha(UIBackgroundColor, 0.95f));
|
||||
|
||||
const float width = LayoutScale(600.0f);
|
||||
const float title_height =
|
||||
g_large_font->FontSize + ImGui::GetStyle().FramePadding.y * 2.0f + ImGui::GetStyle().WindowPadding.y * 2.0f;
|
||||
const float height =
|
||||
std::min(LayoutScale(400.0f),
|
||||
title_height + LayoutScale(LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY + (LAYOUT_MENU_BUTTON_Y_PADDING * 2.0f)) *
|
||||
static_cast<float>(s_choice_dialog_options.size()));
|
||||
ImGui::SetNextWindowSize(ImVec2(width, height));
|
||||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
ImGui::OpenPopup(s_choice_dialog_title.c_str());
|
||||
|
||||
bool is_open = !WantsToCloseMenu();
|
||||
s32 choice = -1;
|
||||
@ -1791,7 +1855,7 @@ void ImGuiFullscreen::DrawChoiceDialog()
|
||||
auto& option = s_choice_dialog_options[i];
|
||||
|
||||
const std::string title(
|
||||
fmt::format("{0} {1}", option.second ? ICON_FA_CHECK_SQUARE : ICON_FA_SQUARE, option.first));
|
||||
fmt::format("{0} {1}", option.second ? ICON_FA_CHECK_SQUARE : ICON_FA_SQUARE, option.first));
|
||||
if (MenuButton(title.c_str(), nullptr, true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY))
|
||||
{
|
||||
choice = i;
|
||||
@ -1806,7 +1870,7 @@ void ImGuiFullscreen::DrawChoiceDialog()
|
||||
auto& option = s_choice_dialog_options[i];
|
||||
std::string title;
|
||||
if (option.second)
|
||||
title += ICON_FA_CHECK " ";
|
||||
title += ICON_FA_CHECK " ";
|
||||
title += option.first;
|
||||
|
||||
if (ActiveButton(title.c_str(), option.second, true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY))
|
||||
@ -1871,9 +1935,14 @@ void ImGuiFullscreen::DrawInputDialog()
|
||||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
ImGui::OpenPopup(s_input_dialog_title.c_str());
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, LayoutScale(20.0f, 20.0f));
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,
|
||||
LayoutScale(LAYOUT_MENU_BUTTON_X_PADDING, LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, UIPrimaryTextColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBg, UIPrimaryDarkColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBgActive, UIPrimaryColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, MulAlpha(UIBackgroundColor, 0.95f));
|
||||
|
||||
bool is_open = true;
|
||||
if (ImGui::BeginPopupModal(s_input_dialog_title.c_str(), &is_open,
|
||||
@ -1881,16 +1950,25 @@ void ImGuiFullscreen::DrawInputDialog()
|
||||
ImGuiWindowFlags_NoMove))
|
||||
{
|
||||
ImGui::TextWrapped("%s", s_input_dialog_message.c_str());
|
||||
ImGui::NewLine();
|
||||
|
||||
if (!s_input_dialog_caption.empty())
|
||||
ImGui::TextUnformatted(s_input_dialog_caption.c_str());
|
||||
ImGui::InputText("##input", &s_input_dialog_text);
|
||||
|
||||
ImGui::NewLine();
|
||||
|
||||
BeginMenuButtons();
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
||||
|
||||
if (!s_input_dialog_caption.empty())
|
||||
{
|
||||
const float prev = ImGui::GetCursorPosX();
|
||||
ImGui::TextUnformatted(s_input_dialog_caption.c_str());
|
||||
ImGui::SetNextItemWidth(ImGui::GetCursorPosX() - prev);
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::SetNextItemWidth(ImGui::GetCurrentWindow()->WorkRect.GetWidth());
|
||||
}
|
||||
ImGui::InputText("##input", &s_input_dialog_text);
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
||||
|
||||
const bool ok_enabled = !s_input_dialog_text.empty();
|
||||
|
||||
if (ActiveButton(s_input_dialog_ok_text.c_str(), false, ok_enabled) && ok_enabled)
|
||||
@ -1903,7 +1981,7 @@ void ImGuiFullscreen::DrawInputDialog()
|
||||
cb(std::move(text));
|
||||
}
|
||||
|
||||
if (ActiveButton(ICON_FA_TIMES " Cancel", false))
|
||||
if (ActiveButton(ICON_FA_TIMES " Cancel", false))
|
||||
{
|
||||
CloseInputDialog();
|
||||
|
||||
@ -1917,8 +1995,9 @@ void ImGuiFullscreen::DrawInputDialog()
|
||||
if (!is_open)
|
||||
CloseInputDialog();
|
||||
|
||||
ImGui::PopFont();
|
||||
ImGui::PopStyleColor(4);
|
||||
ImGui::PopStyleVar(2);
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::CloseInputDialog()
|
||||
@ -1935,6 +2014,137 @@ void ImGuiFullscreen::CloseInputDialog()
|
||||
s_input_dialog_callback = {};
|
||||
}
|
||||
|
||||
bool ImGuiFullscreen::IsMessageBoxDialogOpen()
|
||||
{
|
||||
return s_message_dialog_open;
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::OpenConfirmMessageDialog(std::string title, std::string message,
|
||||
ConfirmMessageDialogCallback callback, std::string yes_button_text,
|
||||
std::string no_button_text)
|
||||
{
|
||||
CloseMessageDialog();
|
||||
|
||||
s_message_dialog_open = true;
|
||||
s_message_dialog_title = std::move(title);
|
||||
s_message_dialog_message = std::move(message);
|
||||
s_message_dialog_callback = std::move(callback);
|
||||
s_message_dialog_buttons[0] = std::move(yes_button_text);
|
||||
s_message_dialog_buttons[1] = std::move(no_button_text);
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::OpenInfoMessageDialog(std::string title, std::string message, InfoMessageDialogCallback callback,
|
||||
std::string button_text)
|
||||
{
|
||||
CloseMessageDialog();
|
||||
|
||||
s_message_dialog_open = true;
|
||||
s_message_dialog_title = std::move(title);
|
||||
s_message_dialog_message = std::move(message);
|
||||
s_message_dialog_callback = std::move(callback);
|
||||
s_message_dialog_buttons[0] = std::move(button_text);
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::OpenMessageDialog(std::string title, std::string message, MessageDialogCallback callback,
|
||||
std::string first_button_text, std::string second_button_text,
|
||||
std::string third_button_text)
|
||||
{
|
||||
CloseMessageDialog();
|
||||
|
||||
s_message_dialog_open = true;
|
||||
s_message_dialog_title = std::move(title);
|
||||
s_message_dialog_message = std::move(message);
|
||||
s_message_dialog_callback = std::move(callback);
|
||||
s_message_dialog_buttons[0] = std::move(first_button_text);
|
||||
s_message_dialog_buttons[1] = std::move(second_button_text);
|
||||
s_message_dialog_buttons[2] = std::move(third_button_text);
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::CloseMessageDialog()
|
||||
{
|
||||
if (!s_message_dialog_open)
|
||||
return;
|
||||
|
||||
s_message_dialog_open = false;
|
||||
s_message_dialog_title = {};
|
||||
s_message_dialog_message = {};
|
||||
s_message_dialog_buttons = {};
|
||||
s_message_dialog_callback = {};
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::DrawMessageDialog()
|
||||
{
|
||||
if (!s_message_dialog_open)
|
||||
return;
|
||||
|
||||
const char* win_id = s_message_dialog_title.empty() ? "##messagedialog" : s_message_dialog_title.c_str();
|
||||
|
||||
ImGui::SetNextWindowSize(LayoutScale(700.0f, 0.0f));
|
||||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
ImGui::OpenPopup(win_id);
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, LayoutScale(20.0f, 20.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,
|
||||
LayoutScale(LAYOUT_MENU_BUTTON_X_PADDING, LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, UIPrimaryTextColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBg, UIPrimaryDarkColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBgActive, UIPrimaryColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, MulAlpha(UIBackgroundColor, 0.95f));
|
||||
|
||||
bool is_open = true;
|
||||
const u32 flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove |
|
||||
(s_message_dialog_title.empty() ? ImGuiWindowFlags_NoTitleBar : 0);
|
||||
std::optional<s32> result;
|
||||
|
||||
if (ImGui::BeginPopupModal(win_id, &is_open, flags))
|
||||
{
|
||||
BeginMenuButtons();
|
||||
|
||||
ImGui::TextWrapped("%s", s_message_dialog_message.c_str());
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(20.0f));
|
||||
|
||||
for (s32 button_index = 0; button_index < static_cast<s32>(s_message_dialog_buttons.size()); button_index++)
|
||||
{
|
||||
if (!s_message_dialog_buttons[button_index].empty() &&
|
||||
ActiveButton(s_message_dialog_buttons[button_index].c_str(), false))
|
||||
{
|
||||
result = button_index;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
}
|
||||
|
||||
EndMenuButtons();
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(4);
|
||||
ImGui::PopStyleVar(3);
|
||||
ImGui::PopFont();
|
||||
|
||||
if (!is_open || result.has_value())
|
||||
{
|
||||
// have to move out in case they open another dialog in the callback
|
||||
auto cb = (std::move(s_message_dialog_callback));
|
||||
CloseMessageDialog();
|
||||
|
||||
if (std::holds_alternative<InfoMessageDialogCallback>(cb))
|
||||
{
|
||||
const InfoMessageDialogCallback& func = std::get<InfoMessageDialogCallback>(cb);
|
||||
if (func)
|
||||
func();
|
||||
}
|
||||
else if (std::holds_alternative<ConfirmMessageDialogCallback>(cb))
|
||||
{
|
||||
const ConfirmMessageDialogCallback& func = std::get<ConfirmMessageDialogCallback>(cb);
|
||||
if (func)
|
||||
func(result.value_or(1) == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static float s_notification_vertical_position = 0.3f;
|
||||
static float s_notification_vertical_direction = -1.0f;
|
||||
|
||||
@ -1965,10 +2175,12 @@ void ImGuiFullscreen::OpenBackgroundProgressDialog(const char* str_id, std::stri
|
||||
|
||||
std::unique_lock<std::mutex> lock(s_background_progress_lock);
|
||||
|
||||
#ifdef _DEBUG
|
||||
for (const BackgroundProgressDialogData& data : s_background_progress_dialogs)
|
||||
{
|
||||
DebugAssert(data.id != id);
|
||||
}
|
||||
#endif
|
||||
|
||||
BackgroundProgressDialogData data;
|
||||
data.id = id;
|
||||
@ -2271,41 +2483,44 @@ void ImGuiFullscreen::DrawToast()
|
||||
}
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::SetTheme()
|
||||
void ImGuiFullscreen::SetTheme(bool light)
|
||||
{
|
||||
#if 1
|
||||
// dark
|
||||
UIBackgroundColor = HEX_TO_IMVEC4(0x212121, 0xff);
|
||||
UIBackgroundTextColor = HEX_TO_IMVEC4(0xffffff, 0xff);
|
||||
UIBackgroundLineColor = HEX_TO_IMVEC4(0xf0f0f0, 0xff);
|
||||
UIBackgroundHighlightColor = HEX_TO_IMVEC4(0x4b4b4b, 0xff);
|
||||
UIPrimaryColor = HEX_TO_IMVEC4(0x2e2e2e, 0xff);
|
||||
UIPrimaryLightColor = HEX_TO_IMVEC4(0x484848, 0xff);
|
||||
UIPrimaryDarkColor = HEX_TO_IMVEC4(0x000000, 0xff);
|
||||
UIPrimaryTextColor = HEX_TO_IMVEC4(0xffffff, 0xff);
|
||||
UIDisabledColor = HEX_TO_IMVEC4(0xaaaaaa, 0xff);
|
||||
UITextHighlightColor = HEX_TO_IMVEC4(0x90caf9, 0xff);
|
||||
UIPrimaryLineColor = HEX_TO_IMVEC4(0xffffff, 0xff);
|
||||
UISecondaryColor = HEX_TO_IMVEC4(0x0d47a1, 0xff);
|
||||
UISecondaryLightColor = HEX_TO_IMVEC4(0x63a4ff, 0xff);
|
||||
UISecondaryDarkColor = HEX_TO_IMVEC4(0x002171, 0xff);
|
||||
UISecondaryTextColor = HEX_TO_IMVEC4(0xffffff, 0xff);
|
||||
#elif 1
|
||||
// light
|
||||
UIBackgroundColor = HEX_TO_IMVEC4(0xf5f5f6, 0xff);
|
||||
UIBackgroundTextColor = HEX_TO_IMVEC4(0x000000, 0xff);
|
||||
UIBackgroundLineColor = HEX_TO_IMVEC4(0xe1e2e1, 0xff);
|
||||
UIBackgroundHighlightColor = HEX_TO_IMVEC4(0xe1e2e1, 0xff);
|
||||
UIPrimaryColor = HEX_TO_IMVEC4(0x0d47a1, 0xff);
|
||||
UIPrimaryLightColor = HEX_TO_IMVEC4(0x5472d3, 0xff);
|
||||
UIPrimaryDarkColor = HEX_TO_IMVEC4(0x002171, 0xff);
|
||||
UIPrimaryTextColor = HEX_TO_IMVEC4(0xffffff, 0xff);
|
||||
UIDisabledColor = HEX_TO_IMVEC4(0xaaaaaa, 0xff);
|
||||
UITextHighlightColor = HEX_TO_IMVEC4(0x8e8e8e, 0xff);
|
||||
UIPrimaryLineColor = HEX_TO_IMVEC4(0x000000, 0xff);
|
||||
UISecondaryColor = HEX_TO_IMVEC4(0x3d5afe, 0xff);
|
||||
UISecondaryLightColor = HEX_TO_IMVEC4(0xc0cfff, 0xff);
|
||||
UISecondaryDarkColor = HEX_TO_IMVEC4(0x0031ca, 0xff);
|
||||
UISecondaryTextColor = HEX_TO_IMVEC4(0x000000, 0xff);
|
||||
#endif
|
||||
}
|
||||
if (!light)
|
||||
{
|
||||
// dark
|
||||
UIBackgroundColor = HEX_TO_IMVEC4(0x212121, 0xff);
|
||||
UIBackgroundTextColor = HEX_TO_IMVEC4(0xffffff, 0xff);
|
||||
UIBackgroundLineColor = HEX_TO_IMVEC4(0xf0f0f0, 0xff);
|
||||
UIBackgroundHighlightColor = HEX_TO_IMVEC4(0x4b4b4b, 0xff);
|
||||
UIPrimaryColor = HEX_TO_IMVEC4(0x2e2e2e, 0xff);
|
||||
UIPrimaryLightColor = HEX_TO_IMVEC4(0x484848, 0xff);
|
||||
UIPrimaryDarkColor = HEX_TO_IMVEC4(0x000000, 0xff);
|
||||
UIPrimaryTextColor = HEX_TO_IMVEC4(0xffffff, 0xff);
|
||||
UIDisabledColor = HEX_TO_IMVEC4(0xaaaaaa, 0xff);
|
||||
UITextHighlightColor = HEX_TO_IMVEC4(0x90caf9, 0xff);
|
||||
UIPrimaryLineColor = HEX_TO_IMVEC4(0xffffff, 0xff);
|
||||
UISecondaryColor = HEX_TO_IMVEC4(0x0d47a1, 0xff);
|
||||
UISecondaryLightColor = HEX_TO_IMVEC4(0x63a4ff, 0xff);
|
||||
UISecondaryDarkColor = HEX_TO_IMVEC4(0x002171, 0xff);
|
||||
UISecondaryTextColor = HEX_TO_IMVEC4(0xffffff, 0xff);
|
||||
}
|
||||
else
|
||||
{
|
||||
// light
|
||||
UIBackgroundColor = HEX_TO_IMVEC4(0xf5f5f6, 0xff);
|
||||
UIBackgroundTextColor = HEX_TO_IMVEC4(0x000000, 0xff);
|
||||
UIBackgroundLineColor = HEX_TO_IMVEC4(0xe1e2e1, 0xff);
|
||||
UIBackgroundHighlightColor = HEX_TO_IMVEC4(0xe1e2e1, 0xff);
|
||||
UIPrimaryColor = HEX_TO_IMVEC4(0x0d47a1, 0xff);
|
||||
UIPrimaryLightColor = HEX_TO_IMVEC4(0x5472d3, 0xff);
|
||||
UIPrimaryDarkColor = HEX_TO_IMVEC4(0x002171, 0xff);
|
||||
UIPrimaryTextColor = HEX_TO_IMVEC4(0xffffff, 0xff);
|
||||
UIDisabledColor = HEX_TO_IMVEC4(0xaaaaaa, 0xff);
|
||||
UITextHighlightColor = HEX_TO_IMVEC4(0x8e8e8e, 0xff);
|
||||
UIPrimaryLineColor = HEX_TO_IMVEC4(0x000000, 0xff);
|
||||
UISecondaryColor = HEX_TO_IMVEC4(0x3d5afe, 0xff);
|
||||
UISecondaryLightColor = HEX_TO_IMVEC4(0xc0cfff, 0xff);
|
||||
UISecondaryDarkColor = HEX_TO_IMVEC4(0x0031ca, 0xff);
|
||||
UISecondaryTextColor = HEX_TO_IMVEC4(0x000000, 0xff);
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include "IconsFontAwesome5.h"
|
||||
#include "common/types.h"
|
||||
#include "imgui.h"
|
||||
#include "imgui_internal.h"
|
||||
@ -100,6 +101,11 @@ static ALWAYS_INLINE ImVec4 ModAlpha(const ImVec4& v, float a)
|
||||
return ImVec4(v.x, v.y, v.z, a);
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE ImVec4 MulAlpha(const ImVec4& v, float a)
|
||||
{
|
||||
return ImVec4(v.x, v.y, v.z, v.w * a);
|
||||
}
|
||||
|
||||
/// Centers an image within the specified bounds, scaling up or down as needed.
|
||||
ImRect CenterImage(const ImVec2& fit_size, const ImVec2& image_size);
|
||||
ImRect CenterImage(const ImRect& fit_rect, const ImVec2& image_size);
|
||||
@ -107,7 +113,7 @@ ImRect CenterImage(const ImRect& fit_rect, const ImVec2& image_size);
|
||||
/// Initializes, setting up any state.
|
||||
bool Initialize(const char* placeholder_image_path);
|
||||
|
||||
void SetTheme();
|
||||
void SetTheme(bool light);
|
||||
void SetFonts(ImFont* standard_font, ImFont* medium_font, ImFont* large_font);
|
||||
bool UpdateLayoutScale();
|
||||
|
||||
@ -137,7 +143,7 @@ void PopSecondaryColor();
|
||||
|
||||
void DrawWindowTitle(const char* title);
|
||||
|
||||
bool BeginFullscreenColumns(const char* title = nullptr);
|
||||
bool BeginFullscreenColumns(const char* title = nullptr, float pos_y = 0.0f, bool expand_to_screen_width = false);
|
||||
void EndFullscreenColumns();
|
||||
|
||||
bool BeginFullscreenColumnWindow(float start, float end, const char* name,
|
||||
@ -163,6 +169,9 @@ bool ActiveButton(const char* title, bool is_active, bool enabled = true,
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, ImFont* font = g_large_font);
|
||||
bool MenuButton(const char* title, const char* summary, bool enabled = true, float height = LAYOUT_MENU_BUTTON_HEIGHT,
|
||||
ImFont* font = g_large_font, ImFont* summary_font = g_medium_font);
|
||||
bool MenuButtonWithoutSummary(const char* title, bool enabled = true,
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, ImFont* font = g_large_font,
|
||||
const ImVec2& text_align = ImVec2(0.0f, 0.0f));
|
||||
bool MenuButtonWithValue(const char* title, const char* summary, const char* value, bool enabled = true,
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT, ImFont* font = g_large_font,
|
||||
ImFont* summary_font = g_medium_font);
|
||||
@ -236,9 +245,23 @@ void CloseChoiceDialog();
|
||||
|
||||
using InputStringDialogCallback = std::function<void(std::string text)>;
|
||||
bool IsInputDialogOpen();
|
||||
void OpenInputStringDialog(std::string title, std::string message, std::string caption, std::string ok_button_text, InputStringDialogCallback callback);
|
||||
void OpenInputStringDialog(std::string title, std::string message, std::string caption, std::string ok_button_text,
|
||||
InputStringDialogCallback callback);
|
||||
void CloseInputDialog();
|
||||
|
||||
using ConfirmMessageDialogCallback = std::function<void(bool)>;
|
||||
using InfoMessageDialogCallback = std::function<void()>;
|
||||
using MessageDialogCallback = std::function<void(s32)>;
|
||||
bool IsMessageBoxDialogOpen();
|
||||
void OpenConfirmMessageDialog(std::string title, std::string message, ConfirmMessageDialogCallback callback,
|
||||
std::string yes_button_text = ICON_FA_CHECK " Yes",
|
||||
std::string no_button_text = ICON_FA_TIMES " No");
|
||||
void OpenInfoMessageDialog(std::string title, std::string message, InfoMessageDialogCallback callback = {},
|
||||
std::string button_text = ICON_FA_WINDOW_CLOSE " Close");
|
||||
void OpenMessageDialog(std::string title, std::string message, MessageDialogCallback callback,
|
||||
std::string first_button_text, std::string second_button_text, std::string third_button_text);
|
||||
void CloseMessageDialog();
|
||||
|
||||
float GetNotificationVerticalPosition();
|
||||
float GetNotificationVerticalDirection();
|
||||
void SetNotificationVerticalPosition(float position, float direction);
|
||||
|
@ -458,18 +458,7 @@ ImFont* ImGuiManager::AddFixedFont(float size)
|
||||
|
||||
bool ImGuiManager::AddIconFonts(float size)
|
||||
{
|
||||
static constexpr ImWchar range_fa[] = {
|
||||
0xf002, 0xf002, 0xf005, 0xf005, 0xf007, 0xf007, 0xf00c, 0xf00e, 0xf011, 0xf011, 0xf013, 0xf013, 0xf017, 0xf017,
|
||||
0xf019, 0xf019, 0xf021, 0xf021, 0xf025, 0xf025, 0xf027, 0xf028, 0xf02d, 0xf02e, 0xf030, 0xf030, 0xf03a, 0xf03a,
|
||||
0xf03d, 0xf03d, 0xf049, 0xf04c, 0xf050, 0xf050, 0xf059, 0xf059, 0xf05e, 0xf05e, 0xf065, 0xf065, 0xf067, 0xf067,
|
||||
0xf071, 0xf071, 0xf075, 0xf075, 0xf077, 0xf078, 0xf07b, 0xf07c, 0xf084, 0xf085, 0xf091, 0xf091, 0xf0a0, 0xf0a0,
|
||||
0xf0ac, 0xf0ad, 0xf0c5, 0xf0c5, 0xf0c7, 0xf0c8, 0xf0cb, 0xf0cb, 0xf0d0, 0xf0d0, 0xf0e2, 0xf0e2, 0xf0eb, 0xf0eb,
|
||||
0xf0f1, 0xf0f1, 0xf0f3, 0xf0f3, 0xf0fe, 0xf0fe, 0xf110, 0xf110, 0xf119, 0xf119, 0xf11b, 0xf11c, 0xf140, 0xf140,
|
||||
0xf144, 0xf144, 0xf14a, 0xf14a, 0xf15b, 0xf15b, 0xf188, 0xf188, 0xf191, 0xf192, 0xf1dd, 0xf1de, 0xf1e6, 0xf1e6,
|
||||
0xf1eb, 0xf1eb, 0xf1f8, 0xf1f8, 0xf242, 0xf242, 0xf245, 0xf245, 0xf26c, 0xf26c, 0xf279, 0xf279, 0xf2d0, 0xf2d0,
|
||||
0xf2db, 0xf2db, 0xf2f2, 0xf2f2, 0xf2f5, 0xf2f5, 0xf410, 0xf410, 0xf466, 0xf466, 0xf500, 0xf500, 0xf51f, 0xf51f,
|
||||
0xf545, 0xf545, 0xf548, 0xf548, 0xf552, 0xf552, 0xf57a, 0xf57a, 0xf5a2, 0xf5a2, 0xf5e7, 0xf5e7, 0xf65d, 0xf65e,
|
||||
0xf6a9, 0xf6a9, 0xf7c2, 0xf7c2, 0xf807, 0xf807, 0xf815, 0xf815, 0xf818, 0xf818, 0xf8cc, 0xf8cc, 0x0, 0x0};
|
||||
static constexpr ImWchar range_fa[] = { 0xf002,0xf002,0xf005,0xf005,0xf007,0xf007,0xf00c,0xf00e,0xf011,0xf011,0xf013,0xf013,0xf017,0xf017,0xf019,0xf019,0xf021,0xf021,0xf025,0xf025,0xf027,0xf028,0xf02d,0xf02e,0xf030,0xf030,0xf03a,0xf03a,0xf03d,0xf03d,0xf049,0xf04c,0xf050,0xf050,0xf059,0xf059,0xf05e,0xf05e,0xf065,0xf065,0xf067,0xf067,0xf071,0xf071,0xf075,0xf075,0xf077,0xf078,0xf07b,0xf07c,0xf084,0xf085,0xf091,0xf091,0xf0a0,0xf0a0,0xf0ac,0xf0ad,0xf0c5,0xf0c5,0xf0c7,0xf0c8,0xf0cb,0xf0cb,0xf0d0,0xf0d0,0xf0e2,0xf0e2,0xf0eb,0xf0eb,0xf0f1,0xf0f1,0xf0f3,0xf0f3,0xf0fe,0xf0fe,0xf110,0xf110,0xf119,0xf119,0xf11b,0xf11c,0xf140,0xf140,0xf144,0xf144,0xf14a,0xf14a,0xf15b,0xf15b,0xf188,0xf188,0xf191,0xf192,0xf1dd,0xf1de,0xf1e6,0xf1e6,0xf1eb,0xf1eb,0xf1f8,0xf1f8,0xf1fc,0xf1fc,0xf242,0xf242,0xf245,0xf245,0xf26c,0xf26c,0xf279,0xf279,0xf2d0,0xf2d0,0xf2db,0xf2db,0xf2f2,0xf2f2,0xf2f5,0xf2f5,0xf410,0xf410,0xf466,0xf466,0xf500,0xf500,0xf51f,0xf51f,0xf545,0xf545,0xf548,0xf548,0xf552,0xf552,0xf57a,0xf57a,0xf5a2,0xf5a2,0xf5e7,0xf5e7,0xf65d,0xf65e,0xf6a9,0xf6a9,0xf7c2,0xf7c2,0xf807,0xf807,0xf815,0xf815,0xf818,0xf818,0xf84c,0xf84c,0xf8cc,0xf8cc,0x0,0x0 };
|
||||
|
||||
ImFontConfig cfg;
|
||||
cfg.MergeMode = true;
|
||||
|
Reference in New Issue
Block a user