|
@@ -668,9 +668,19 @@ bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags
|
|
|
|
|
|
// Render
|
|
// Render
|
|
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
|
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
|
|
|
+#ifdef WIN98
|
|
|
|
+ const ImU32 fill_col = GetColorU32(ImGuiCol_WindowBg);
|
|
|
|
+ window->DrawList->AddRectFilled(bb.Min, bb.Max, fill_col, 0.0f);
|
|
|
|
+
|
|
|
|
+ WinAddRect(bb.Min, bb.Max, (held && hovered));
|
|
|
|
+ PushStyleColor(ImGuiCol_Text, ImVec4(0.0f, 0.0f, 0.0f, 1.0f));
|
|
|
|
+ RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, NULL, &label_size, style.ButtonTextAlign, &bb);
|
|
|
|
+ PopStyleColor();
|
|
|
|
+#else
|
|
RenderNavHighlight(bb, id);
|
|
RenderNavHighlight(bb, id);
|
|
RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
|
|
RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
|
|
RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, NULL, &label_size, style.ButtonTextAlign, &bb);
|
|
RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, NULL, &label_size, style.ButtonTextAlign, &bb);
|
|
|
|
+#endif
|
|
|
|
|
|
// Automatically close popups
|
|
// Automatically close popups
|
|
//if (pressed && !(flags & ImGuiButtonFlags_DontClosePopups) && (window->Flags & ImGuiWindowFlags_Popup))
|
|
//if (pressed && !(flags & ImGuiButtonFlags_DontClosePopups) && (window->Flags & ImGuiWindowFlags_Popup))
|
|
@@ -762,9 +772,13 @@ bool ImGui::CloseButton(ImGuiID id, const ImVec2& pos)//, float size)
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
|
|
|
|
|
|
+#ifdef WIN98 // close button size
|
|
|
|
+ const ImRect bb(pos, pos + ImVec2(16.0f, 14.0f));
|
|
|
|
+#else
|
|
// We intentionally allow interaction when clipped so that a mechanical Alt,Right,Validate sequence close a window.
|
|
// We intentionally allow interaction when clipped so that a mechanical Alt,Right,Validate sequence close a window.
|
|
// (this isn't the regular behavior of buttons, but it doesn't affect the user much because navigation tends to keep items visible).
|
|
// (this isn't the regular behavior of buttons, but it doesn't affect the user much because navigation tends to keep items visible).
|
|
const ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize) + g.Style.FramePadding * 2.0f);
|
|
const ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize) + g.Style.FramePadding * 2.0f);
|
|
|
|
+#endif
|
|
bool is_clipped = !ItemAdd(bb, id);
|
|
bool is_clipped = !ItemAdd(bb, id);
|
|
|
|
|
|
bool hovered, held;
|
|
bool hovered, held;
|
|
@@ -775,14 +789,25 @@ bool ImGui::CloseButton(ImGuiID id, const ImVec2& pos)//, float size)
|
|
// Render
|
|
// Render
|
|
ImU32 col = GetColorU32(held ? ImGuiCol_ButtonActive : ImGuiCol_ButtonHovered);
|
|
ImU32 col = GetColorU32(held ? ImGuiCol_ButtonActive : ImGuiCol_ButtonHovered);
|
|
ImVec2 center = bb.GetCenter();
|
|
ImVec2 center = bb.GetCenter();
|
|
|
|
+
|
|
|
|
+#ifdef WIN98 // close button
|
|
|
|
+ const ImU32 fill_col = GetColorU32(ImGuiCol_WindowBg);
|
|
|
|
+ window->DrawList->AddRectFilled(bb.Min, bb.Max, fill_col, 0.0f);
|
|
|
|
+ WinAddRect(bb.Min, bb.Max, hovered && held);
|
|
|
|
+#else
|
|
if (hovered)
|
|
if (hovered)
|
|
window->DrawList->AddCircleFilled(center, ImMax(2.0f, g.FontSize * 0.5f + 1.0f), col, 12);
|
|
window->DrawList->AddCircleFilled(center, ImMax(2.0f, g.FontSize * 0.5f + 1.0f), col, 12);
|
|
|
|
+#endif
|
|
|
|
|
|
float cross_extent = g.FontSize * 0.5f * 0.7071f - 1.0f;
|
|
float cross_extent = g.FontSize * 0.5f * 0.7071f - 1.0f;
|
|
ImU32 cross_col = GetColorU32(ImGuiCol_Text);
|
|
ImU32 cross_col = GetColorU32(ImGuiCol_Text);
|
|
center -= ImVec2(0.5f, 0.5f);
|
|
center -= ImVec2(0.5f, 0.5f);
|
|
|
|
+#ifdef WIN98 // close button icon
|
|
|
|
+ RenderText(bb.Min + ImVec2(2.0f, 2.0f), "\u00D7");
|
|
|
|
+#else
|
|
window->DrawList->AddLine(center + ImVec2(+cross_extent, +cross_extent), center + ImVec2(-cross_extent, -cross_extent), cross_col, 1.0f);
|
|
window->DrawList->AddLine(center + ImVec2(+cross_extent, +cross_extent), center + ImVec2(-cross_extent, -cross_extent), cross_col, 1.0f);
|
|
window->DrawList->AddLine(center + ImVec2(+cross_extent, -cross_extent), center + ImVec2(-cross_extent, +cross_extent), cross_col, 1.0f);
|
|
window->DrawList->AddLine(center + ImVec2(+cross_extent, -cross_extent), center + ImVec2(-cross_extent, +cross_extent), cross_col, 1.0f);
|
|
|
|
+#endif
|
|
|
|
|
|
return pressed;
|
|
return pressed;
|
|
}
|
|
}
|
|
@@ -792,7 +817,11 @@ bool ImGui::CollapseButton(ImGuiID id, const ImVec2& pos)
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
|
|
|
|
|
|
+#ifdef WIN98 // collapse button size
|
|
|
|
+ ImRect bb(pos, pos + ImVec2(16.0f, 14.0f));
|
|
|
|
+#else
|
|
ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize) + g.Style.FramePadding * 2.0f);
|
|
ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize) + g.Style.FramePadding * 2.0f);
|
|
|
|
+#endif
|
|
ItemAdd(bb, id);
|
|
ItemAdd(bb, id);
|
|
bool hovered, held;
|
|
bool hovered, held;
|
|
bool pressed = ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_None);
|
|
bool pressed = ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_None);
|
|
@@ -801,9 +830,19 @@ bool ImGui::CollapseButton(ImGuiID id, const ImVec2& pos)
|
|
ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
|
ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
|
ImU32 text_col = GetColorU32(ImGuiCol_Text);
|
|
ImU32 text_col = GetColorU32(ImGuiCol_Text);
|
|
ImVec2 center = bb.GetCenter();
|
|
ImVec2 center = bb.GetCenter();
|
|
|
|
+
|
|
|
|
+#ifdef WIN98 // collapse button
|
|
|
|
+ const ImU32 fill_col = GetColorU32(ImGuiCol_WindowBg);
|
|
|
|
+ window->DrawList->AddRectFilled(bb.Min, bb.Max, fill_col, 0.0f);
|
|
|
|
+ WinAddRect(bb.Min, bb.Max, hovered && held);
|
|
|
|
+
|
|
|
|
+ // collapse icon
|
|
|
|
+ RenderText(bb.Min + ImVec2(2.0f, 2.0f), "\u00D6");
|
|
|
|
+#else
|
|
if (hovered || held)
|
|
if (hovered || held)
|
|
window->DrawList->AddCircleFilled(center/*+ ImVec2(0.0f, -0.5f)*/, g.FontSize * 0.5f + 1.0f, bg_col, 12);
|
|
window->DrawList->AddCircleFilled(center/*+ ImVec2(0.0f, -0.5f)*/, g.FontSize * 0.5f + 1.0f, bg_col, 12);
|
|
RenderArrow(window->DrawList, bb.Min + g.Style.FramePadding, text_col, window->Collapsed ? ImGuiDir_Right : ImGuiDir_Down, 1.0f);
|
|
RenderArrow(window->DrawList, bb.Min + g.Style.FramePadding, text_col, window->Collapsed ? ImGuiDir_Right : ImGuiDir_Down, 1.0f);
|
|
|
|
+#endif
|
|
|
|
|
|
// Switch to moving the window after mouse is moved beyond the initial drag threshold
|
|
// Switch to moving the window after mouse is moved beyond the initial drag threshold
|
|
if (IsItemActive() && IsMouseDragging(0))
|
|
if (IsItemActive() && IsMouseDragging(0))
|
|
@@ -888,8 +927,19 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, floa
|
|
const ImGuiStyle& style = g.Style;
|
|
const ImGuiStyle& style = g.Style;
|
|
const bool allow_interaction = (alpha >= 1.0f);
|
|
const bool allow_interaction = (alpha >= 1.0f);
|
|
|
|
|
|
|
|
+#ifdef WIN98
|
|
|
|
+
|
|
|
|
+ ImRect bb = bb_frame;
|
|
|
|
+ float button_size = (axis == ImGuiAxis_X) ? bb.GetHeight() : bb.GetWidth();
|
|
|
|
+ ImVec2 button_size_rect(button_size, button_size);
|
|
|
|
+ ImVec2 main_axis((axis == ImGuiAxis_X) ? 1.0f : 0.0f, (axis == ImGuiAxis_X) ? 0.0f : 1.0f);
|
|
|
|
+ ImVec2 main_axis_button_size = main_axis * button_size;
|
|
|
|
+
|
|
|
|
+ bb.Expand(main_axis * -button_size);
|
|
|
|
+#else
|
|
ImRect bb = bb_frame;
|
|
ImRect bb = bb_frame;
|
|
bb.Expand(ImVec2(-ImClamp(IM_FLOOR((bb_frame_width - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp(IM_FLOOR((bb_frame_height - 2.0f) * 0.5f), 0.0f, 3.0f)));
|
|
bb.Expand(ImVec2(-ImClamp(IM_FLOOR((bb_frame_width - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp(IM_FLOOR((bb_frame_height - 2.0f) * 0.5f), 0.0f, 3.0f)));
|
|
|
|
+#endif
|
|
|
|
|
|
// V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar)
|
|
// V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar)
|
|
const float scrollbar_size_v = (axis == ImGuiAxis_X) ? bb.GetWidth() : bb.GetHeight();
|
|
const float scrollbar_size_v = (axis == ImGuiAxis_X) ? bb.GetWidth() : bb.GetHeight();
|
|
@@ -944,6 +994,33 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, floa
|
|
}
|
|
}
|
|
|
|
|
|
// Render
|
|
// Render
|
|
|
|
+#ifdef WIN98 // scrollbar
|
|
|
|
+
|
|
|
|
+ ImRect grab_rect;
|
|
|
|
+ if (axis == ImGuiAxis_X) {
|
|
|
|
+ grab_rect = ImRect(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm), bb.Min.y, ImLerp(bb.Min.x, bb.Max.x, grab_v_norm) + grab_h_pixels, bb.Max.y);
|
|
|
|
+ } else {
|
|
|
|
+ grab_rect = ImRect(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm), bb.Max.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm) + grab_h_pixels);
|
|
|
|
+ }
|
|
|
|
+ WinAddRect(grab_rect.Min, grab_rect.Max, false);
|
|
|
|
+ {
|
|
|
|
+ const ImGuiID up_id = window->GetID("##scrollup");
|
|
|
|
+ ImRect button_bounds(bb_frame.Min, bb_frame.Min + button_size_rect);
|
|
|
|
+ bool held_up = false;
|
|
|
|
+ bool hovered_up = false;
|
|
|
|
+ bool pressed_up = ButtonBehavior(button_bounds, up_id, &hovered_up, &held_up, 0);
|
|
|
|
+ WinAddRect(button_bounds.Min, button_bounds.Max, (held_up && hovered_up));
|
|
|
|
+ }
|
|
|
|
+ {
|
|
|
|
+ const ImGuiID down_id = window->GetID("##scrolldown");
|
|
|
|
+ ImVec2 pos = bb_frame.Min + main_axis * (((axis == ImGuiAxis_X) ? bb_frame.GetWidth() : bb_frame.GetHeight()) - button_size);
|
|
|
|
+ ImRect button_bounds(pos, pos + button_size_rect);
|
|
|
|
+ bool held_down = false;
|
|
|
|
+ bool hovered_down = false;
|
|
|
|
+ bool pressed_down = ButtonBehavior(button_bounds, down_id, &hovered_down, &held_down, 0);
|
|
|
|
+ WinAddRect(button_bounds.Min, button_bounds.Max, (held_down && hovered_down));
|
|
|
|
+ }
|
|
|
|
+#else
|
|
const ImU32 bg_col = GetColorU32(ImGuiCol_ScrollbarBg);
|
|
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 ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab, alpha);
|
|
window->DrawList->AddRectFilled(bb_frame.Min, bb_frame.Max, bg_col, window->WindowRounding, rounding_corners);
|
|
window->DrawList->AddRectFilled(bb_frame.Min, bb_frame.Max, bg_col, window->WindowRounding, rounding_corners);
|
|
@@ -953,6 +1030,7 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, floa
|
|
else
|
|
else
|
|
grab_rect = ImRect(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm), bb.Max.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm) + grab_h_pixels);
|
|
grab_rect = ImRect(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm), bb.Max.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm) + grab_h_pixels);
|
|
window->DrawList->AddRectFilled(grab_rect.Min, grab_rect.Max, grab_col, style.ScrollbarRounding);
|
|
window->DrawList->AddRectFilled(grab_rect.Min, grab_rect.Max, grab_col, style.ScrollbarRounding);
|
|
|
|
+#endif
|
|
|
|
|
|
return held;
|
|
return held;
|
|
}
|
|
}
|