ui stuff + clear notifications
This commit is contained in:
@@ -378,6 +378,7 @@ ImVec2 timerWindow(DrawData& drawData, ApplicationData& appData)
|
|||||||
// Draw window
|
// Draw window
|
||||||
if (ImGui::Begin(title.c_str(), 0, ImGuiWindowFlags_NoResize))
|
if (ImGui::Begin(title.c_str(), 0, ImGuiWindowFlags_NoResize))
|
||||||
{
|
{
|
||||||
|
dropShadowWindowTitle();
|
||||||
if (windowHeaderButton(ICON_SETTINGS_FILL))
|
if (windowHeaderButton(ICON_SETTINGS_FILL))
|
||||||
{
|
{
|
||||||
ImGui::OpenPopup(SETTINGS_POPUP_NAME);
|
ImGui::OpenPopup(SETTINGS_POPUP_NAME);
|
||||||
@@ -426,6 +427,7 @@ ImVec2 timerWindow(DrawData& drawData, ApplicationData& appData)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
timerData.isTimerActive = false;
|
timerData.isTimerActive = false;
|
||||||
|
WinToast::instance()->clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -541,6 +543,7 @@ ImVec2 checklistWindow(ApplicationData& appData, const char* title)
|
|||||||
{
|
{
|
||||||
if (ImGui::Begin(title, 0, ImGuiWindowFlags_NoResize))
|
if (ImGui::Begin(title, 0, ImGuiWindowFlags_NoResize))
|
||||||
{
|
{
|
||||||
|
dropShadowWindowTitle();
|
||||||
if (windowHeaderButton(ICON_SETTINGS_FILL))
|
if (windowHeaderButton(ICON_SETTINGS_FILL))
|
||||||
{
|
{
|
||||||
ImGui::OpenPopup(SETTINGS_POPUP_NAME);
|
ImGui::OpenPopup(SETTINGS_POPUP_NAME);
|
||||||
@@ -731,6 +734,7 @@ ImVec2 baseStationWindow(ApplicationData& appData)
|
|||||||
{
|
{
|
||||||
if (ImGui::Begin(std::format("{} Base Stations", ICON_ALARM_WARNING_FILL).c_str(), 0, ImGuiWindowFlags_NoResize))
|
if (ImGui::Begin(std::format("{} Base Stations", ICON_ALARM_WARNING_FILL).c_str(), 0, ImGuiWindowFlags_NoResize))
|
||||||
{
|
{
|
||||||
|
dropShadowWindowTitle();
|
||||||
if (windowHeaderButton(ICON_SETTINGS_FILL))
|
if (windowHeaderButton(ICON_SETTINGS_FILL))
|
||||||
{
|
{
|
||||||
ImGui::OpenPopup(SETTINGS_POPUP_NAME);
|
ImGui::OpenPopup(SETTINGS_POPUP_NAME);
|
||||||
@@ -780,6 +784,7 @@ ImVec2 audioDeviceWindow(ApplicationData& appData, std::vector<AudioDevice>& dev
|
|||||||
{
|
{
|
||||||
if (ImGui::Begin(title, 0, ImGuiWindowFlags_NoResize))
|
if (ImGui::Begin(title, 0, ImGuiWindowFlags_NoResize))
|
||||||
{
|
{
|
||||||
|
dropShadowWindowTitle();
|
||||||
if (windowHeaderButton(ICON_SETTINGS_FILL))
|
if (windowHeaderButton(ICON_SETTINGS_FILL))
|
||||||
{
|
{
|
||||||
ImGui::OpenPopup(SETTINGS_POPUP_NAME);
|
ImGui::OpenPopup(SETTINGS_POPUP_NAME);
|
||||||
@@ -791,7 +796,8 @@ ImVec2 audioDeviceWindow(ApplicationData& appData, std::vector<AudioDevice>& dev
|
|||||||
ImGui::TableSetupColumn("Volume", ImGuiTableColumnFlags_WidthStretch, 1.);
|
ImGui::TableSetupColumn("Volume", ImGuiTableColumnFlags_WidthStretch, 1.);
|
||||||
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, getButtonWidth(ICON_MUSIC_2_FILL));
|
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, getButtonWidth(ICON_MUSIC_2_FILL));
|
||||||
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, getButtonWidth(ICON_PHONE_FILL));
|
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, getButtonWidth(ICON_PHONE_FILL));
|
||||||
ImGui::TableHeadersRow();
|
|
||||||
|
dropShadowTableHeadersRow();
|
||||||
|
|
||||||
for (auto& dev : deviceList)
|
for (auto& dev : deviceList)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ void setAutostart(bool newValue)
|
|||||||
void loadUiStyle()
|
void loadUiStyle()
|
||||||
{
|
{
|
||||||
ImGuiStyle& style = ImGui::GetStyle();
|
ImGuiStyle& style = ImGui::GetStyle();
|
||||||
style.WindowPadding = { 6.f, 12.f };
|
style.WindowPadding = { 10.f, 14.f };
|
||||||
style.WindowBorderSize = 0.f;
|
style.WindowBorderSize = 0.f;
|
||||||
|
|
||||||
style.FramePadding = { 8.f, 4.f };
|
style.FramePadding = { 8.f, 4.f };
|
||||||
|
|||||||
@@ -575,31 +575,62 @@ ImVec2 getWindowSize(GLFWwindow* window)
|
|||||||
|
|
||||||
void dropShadow()
|
void dropShadow()
|
||||||
{
|
{
|
||||||
dropShadow(DEFAULT_DROP_SHADOW_SIZE, ImGui::GetStyle().Colors[DEFAULT_DROP_SHADOW_COLOR_ID]);
|
dropShadow(DEFAULT_DROP_SHADOW_SIZE, DEFAULT_DROP_SHADOW_SIZE, ImGui::GetStyle().Colors[DEFAULT_DROP_SHADOW_COLOR_ID]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dropShadow(const float shadowSize, const ImColor& color)
|
void dropShadow(const float shadowSizeX, const float shadowSizeY, const ImColor& color)
|
||||||
{
|
{
|
||||||
ImVec2 lastMin = ImGui::GetItemRectMin();
|
ImVec2 lastMin = ImGui::GetItemRectMin();
|
||||||
ImVec2 lastMax = ImGui::GetItemRectMax();
|
ImVec2 lastMax = ImGui::GetItemRectMax();
|
||||||
renderDropShadow(shadowSize, lastMin, lastMax, color);
|
renderDropShadow(shadowSizeX, shadowSizeY, lastMin, lastMax, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderDropShadow(const float shadowSize, const ImVec2& min, const ImVec2& max, const ImColor& color)
|
void renderDropShadow(const float shadowSizeX, const float shadowSizeY, const ImVec2& min, const ImVec2& max, const ImColor& color)
|
||||||
{
|
{
|
||||||
ImDrawList* windowDrawList = ImGui::GetWindowDrawList();
|
ImDrawList* windowDrawList = ImGui::GetWindowDrawList();
|
||||||
windowDrawList->AddQuadFilled(
|
if (shadowSizeY > 0.f)
|
||||||
{ min.x, max.y },
|
{
|
||||||
{ max.x, max.y },
|
windowDrawList->AddQuadFilled(
|
||||||
{ max.x + shadowSize, max.y + shadowSize },
|
{ min.x, max.y },
|
||||||
{ min.x + shadowSize, max.y + shadowSize },
|
{ max.x, max.y },
|
||||||
color);
|
{ max.x + shadowSizeX, max.y + shadowSizeY },
|
||||||
windowDrawList->AddQuadFilled(
|
{ min.x + shadowSizeX, max.y + shadowSizeY },
|
||||||
{ max.x, min.y },
|
color);
|
||||||
{ max.x + shadowSize, min.y + shadowSize },
|
}
|
||||||
{ max.x + shadowSize, max.y + shadowSize },
|
|
||||||
{ max.x, max.y },
|
if (shadowSizeX > 0.f)
|
||||||
color);
|
{
|
||||||
|
windowDrawList->AddQuadFilled(
|
||||||
|
{ max.x, min.y },
|
||||||
|
{ max.x + shadowSizeX, min.y + shadowSizeY },
|
||||||
|
{ max.x + shadowSizeX, max.y + shadowSizeY },
|
||||||
|
{ max.x, max.y },
|
||||||
|
color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void dropShadowTableHeadersRow()
|
||||||
|
{
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
|
||||||
|
ImVec2 startPos = {};
|
||||||
|
|
||||||
|
for (int i = 0; i < ImGui::TableGetColumnCount(); i++)
|
||||||
|
{
|
||||||
|
ImGui::TableSetColumnIndex(i);
|
||||||
|
ImGui::TableHeader(ImGui::TableGetColumnName());
|
||||||
|
if (i == 0) startPos = ImGui::GetItemRectMin();
|
||||||
|
}
|
||||||
|
|
||||||
|
renderDropShadow(DEFAULT_DROP_SHADOW_SIZE, DEFAULT_DROP_SHADOW_SIZE, startPos, ImGui::GetItemRectMax(), ImGui::GetStyle().Colors[DEFAULT_DROP_SHADOW_COLOR_ID]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dropShadowWindowTitle()
|
||||||
|
{
|
||||||
|
ImRect tempRect = ImGui::GetCurrentWindow()->ClipRect;
|
||||||
|
ImGui::PopClipRect();
|
||||||
|
dropShadow(0., 4., { .2f, .2f, .2f, .5f });
|
||||||
|
ImGui::PushClipRect(tempRect.Min, tempRect.Max, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dropButton(const char* label, const ImVec2& size, float shadowSize, bool smallButton)
|
bool dropButton(const char* label, const ImVec2& size, float shadowSize, bool smallButton)
|
||||||
@@ -630,7 +661,9 @@ bool dropButton(const char* label, const ImVec2& size, float shadowSize, bool sm
|
|||||||
|
|
||||||
ImGui::RenderFrame(rectMin, rectMax, col, true, style.FrameRounding);
|
ImGui::RenderFrame(rectMin, rectMax, col, true, style.FrameRounding);
|
||||||
ImGui::RenderTextClipped(rectMin, rectMax, label, NULL, &labelSize, style.ButtonTextAlign);
|
ImGui::RenderTextClipped(rectMin, rectMax, label, NULL, &labelSize, style.ButtonTextAlign);
|
||||||
renderDropShadow(held ? 1.f : shadowSize, rectMin, rectMax, ImGui::GetStyle().Colors[DEFAULT_DROP_SHADOW_COLOR_ID]);
|
|
||||||
|
float realShadowSize = held ? 1.f : shadowSize;
|
||||||
|
renderDropShadow(realShadowSize, realShadowSize, rectMin, rectMax, ImGui::GetStyle().Colors[DEFAULT_DROP_SHADOW_COLOR_ID]);
|
||||||
|
|
||||||
style.FramePadding = backupPadding;
|
style.FramePadding = backupPadding;
|
||||||
return result;
|
return result;
|
||||||
@@ -645,7 +678,7 @@ bool checkboxWithDropShadow(const char* label, bool* v, const float shadowSize)
|
|||||||
style.ItemInnerSpacing.x = oldSpacingX;
|
style.ItemInnerSpacing.x = oldSpacingX;
|
||||||
|
|
||||||
ImVec2 lastMin = ImGui::GetItemRectMin();
|
ImVec2 lastMin = ImGui::GetItemRectMin();
|
||||||
renderDropShadow(shadowSize, lastMin, lastMin + ImVec2{ ImGui::GetFrameHeight(), ImGui::GetFrameHeight() }, ImGui::GetStyle().Colors[DEFAULT_DROP_SHADOW_COLOR_ID]);
|
renderDropShadow(shadowSize, shadowSize, lastMin, lastMin + ImVec2{ ImGui::GetFrameHeight(), ImGui::GetFrameHeight() }, ImGui::GetStyle().Colors[DEFAULT_DROP_SHADOW_COLOR_ID]);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,9 +62,11 @@ constexpr float DEFAULT_DROP_SHADOW_SIZE = 3.f;
|
|||||||
constexpr ImGuiCol DEFAULT_DROP_SHADOW_COLOR_ID = ImGuiCol_TabUnfocused;
|
constexpr ImGuiCol DEFAULT_DROP_SHADOW_COLOR_ID = ImGuiCol_TabUnfocused;
|
||||||
|
|
||||||
void dropShadow();
|
void dropShadow();
|
||||||
void dropShadow(const float shadowSize, const ImColor& color);
|
void dropShadow(const float shadowSizeX, const float shadowSizeY, const ImColor& color);
|
||||||
void renderDropShadow(const float shadowSize, const ImVec2& min, const ImVec2& max, const ImColor& color);
|
void renderDropShadow(const float shadowSizeX, const float shadowSizeY, const ImVec2& min, const ImVec2& max, const ImColor& color);
|
||||||
|
|
||||||
|
void dropShadowTableHeadersRow();
|
||||||
|
void dropShadowWindowTitle();
|
||||||
bool dropButton(const char* label, const ImVec2& size = ImVec2(0, 0), float shadowSize = DEFAULT_DROP_SHADOW_SIZE, bool smallButton = false);
|
bool dropButton(const char* label, const ImVec2& size = ImVec2(0, 0), float shadowSize = DEFAULT_DROP_SHADOW_SIZE, bool smallButton = false);
|
||||||
bool checkboxWithDropShadow(const char* label, bool* v, const float shadowSize = DEFAULT_DROP_SHADOW_SIZE);
|
bool checkboxWithDropShadow(const char* label, bool* v, const float shadowSize = DEFAULT_DROP_SHADOW_SIZE);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user