GUI: several mobile changes

This commit is contained in:
tildearrow 2022-12-03 00:51:57 -05:00
parent f84469e4fd
commit 69059dc702
12 changed files with 50 additions and 35 deletions

View file

@ -74,6 +74,7 @@ SOFTWARE.
#define IMGUI_DEFINE_MATH_OPERATORS
#endif // IMGUI_DEFINE_MATH_OPERATORS
#include "imgui_internal.h"
#include <IconsFontAwesome4.h>
#include <cstdlib>
#include <algorithm>
@ -119,7 +120,7 @@ namespace IGFD
#endif // IMGUI_BUTTON
// locales
#ifndef createDirButtonString
#define createDirButtonString "+"
#define createDirButtonString ICON_FA_PLUS
#endif // createDirButtonString
#ifndef okButtonString
#define okButtonString "OK"
@ -128,13 +129,13 @@ namespace IGFD
#define cancelButtonString "Cancel"
#endif // cancelButtonString
#ifndef resetButtonString
#define resetButtonString "R"
#define resetButtonString ICON_FA_REPEAT
#endif // resetButtonString
#ifndef drivesButtonString
#define drivesButtonString "Drives"
#endif // drivesButtonString
#ifndef editPathButtonString
#define editPathButtonString "E"
#define editPathButtonString ICON_FA_PENCIL
#endif // editPathButtonString
#ifndef searchString
#define searchString "Search"
@ -149,10 +150,10 @@ namespace IGFD
#define fileEntryString "[File]"
#endif // fileEntryString
#ifndef fileNameString
#define fileNameString "File Name:"
#define fileNameString "Name:"
#endif // fileNameString
#ifndef dirNameString
#define dirNameString "Directory Path:"
#define dirNameString "Path:"
#endif // dirNameString
#ifndef buttonResetSearchString
#define buttonResetSearchString "Reset search"
@ -3321,7 +3322,7 @@ namespace IGFD
//// FILE DIALOG CONSTRUCTOR / DESTRUCTOR ///////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
IGFD::FileDialog::FileDialog() : BookMarkFeature(), KeyExplorerFeature(), ThumbnailFeature() {DpiScale=1.0f; singleClickSel=false;}
IGFD::FileDialog::FileDialog() : BookMarkFeature(), KeyExplorerFeature(), ThumbnailFeature() {DpiScale=1.0f; singleClickSel=false; mobileMode=false;}
IGFD::FileDialog::~FileDialog() = default;
//////////////////////////////////////////////////////////////////////////////////////////////////
@ -3938,7 +3939,7 @@ namespace IGFD
vsnprintf(fdi.puVariadicBuffer, MAX_FILE_DIALOG_NAME_BUFFER, vFmt, args);
va_end(args);
float h = 0.0f;
float h = /*mobileMode?(ImGui::GetFontSize()+10.0f*DpiScale):*/0.0f;
#ifdef USE_THUMBNAILS
if (prDisplayMode == DisplayModeEnum::THUMBNAILS_LIST)
h = DisplayMode_ThumbailsList_ImageHeight;

View file

@ -1143,6 +1143,7 @@ namespace IGFD
bool puAnyWindowsHovered = false; // not remember why haha :) todo : to check if we can remove
double DpiScale;
bool singleClickSel;
bool mobileMode;
public:
static FileDialog* Instance() // Singleton for easier accces form anywhere but only one dialog at a time

View file

@ -1580,6 +1580,7 @@ enum ImGuiConfigFlags_
// [CUSTOM] Inertial scroll
ImGuiConfigFlags_InertialScrollEnable = 1 << 7, // Docking enable flags.
ImGuiConfigFlags_NoHoverColors = 1 << 8, // Disable all "hovered" color changes (useful for mobile).
// [BETA] Viewports
// When using viewports it is recommended that your default value for ImGuiCol_WindowBg is opaque (Alpha=1.0) so transition to a viewport won't be noticeable.

View file

@ -998,7 +998,7 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, ImS6
// Render
const ImU32 bg_col = GetColorU32(ImGuiCol_ScrollbarBg);
const ImU32 grab_col = GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab, alpha);
const ImU32 grab_col = GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : (hovered && !(g.IO.ConfigFlags&ImGuiConfigFlags_NoHoverColors)) ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab, alpha);
window->DrawList->AddRectFilled(bb_frame.Min, bb_frame.Max, bg_col, window->WindowRounding, flags);
ImRect grab_rect;
if (axis == ImGuiAxis_X)
@ -6329,9 +6329,9 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
// Render
if (held && (flags & ImGuiSelectableFlags_DrawHoveredWhenHeld))
hovered = true;
if (hovered || selected)
if ((hovered && !(g.IO.ConfigFlags&ImGuiConfigFlags_NoHoverColors)) || selected)
{
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : (hovered && !(g.IO.ConfigFlags&ImGuiConfigFlags_NoHoverColors)) ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
RenderFrame(bb.Min, bb.Max, col, false, 0.0f);
}
RenderNavHighlight(bb, id, ImGuiNavHighlightFlags_TypeThin | ImGuiNavHighlightFlags_NoRounding);