mirror of
https://github.com/shadps4-emu/ext-imgui.git
synced 2024-11-27 20:20:40 +00:00
Merge remote-tracking branch 'origin' into 2015-03-antialiased-primitives
This commit is contained in:
commit
c52cefa2c2
55
imgui.cpp
55
imgui.cpp
@ -390,7 +390,6 @@
|
||||
- listbox: scrolling should track modified selection.
|
||||
- menus: local shortcuts, global shortcuts (#126)
|
||||
- menus: icons
|
||||
- menus: see we can allow for click-menu-hold-release-on-item to work (like Windows does)
|
||||
- menus: menubars: some sort of priority / effect of main menu-bar on desktop size?
|
||||
- tabs
|
||||
- separator: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y)
|
||||
@ -1024,19 +1023,21 @@ enum ImGuiLayoutType_
|
||||
enum ImGuiButtonFlags_
|
||||
{
|
||||
ImGuiButtonFlags_Repeat = 1 << 0,
|
||||
ImGuiButtonFlags_PressedOnClick = 1 << 1,
|
||||
ImGuiButtonFlags_FlattenChilds = 1 << 2,
|
||||
ImGuiButtonFlags_DontClosePopups = 1 << 3,
|
||||
ImGuiButtonFlags_Disabled = 1 << 4,
|
||||
ImGuiButtonFlags_AlignTextBaseLine = 1 << 5
|
||||
ImGuiButtonFlags_PressedOnClick = 1 << 1, // return pressed on click only (default requires click+release)
|
||||
ImGuiButtonFlags_PressedOnRelease = 1 << 2, // return pressed on release only (default requires click+release)
|
||||
ImGuiButtonFlags_FlattenChilds = 1 << 3,
|
||||
ImGuiButtonFlags_DontClosePopups = 1 << 4,
|
||||
ImGuiButtonFlags_Disabled = 1 << 5,
|
||||
ImGuiButtonFlags_AlignTextBaseLine = 1 << 6
|
||||
};
|
||||
|
||||
enum ImGuiSelectableFlagsPrivate_
|
||||
{
|
||||
// NB: need to be in sync with last value of ImGuiSelectableFlags_
|
||||
ImGuiSelectableFlags_MenuItem = 1 << 2,
|
||||
ImGuiSelectableFlags_Disabled = 1 << 3,
|
||||
ImGuiSelectableFlags_DrawFillAvailWidth = 1 << 4
|
||||
ImGuiSelectableFlags_Menu = 1 << 2,
|
||||
ImGuiSelectableFlags_MenuItem = 1 << 3,
|
||||
ImGuiSelectableFlags_Disabled = 1 << 4,
|
||||
ImGuiSelectableFlags_DrawFillAvailWidth = 1 << 5
|
||||
};
|
||||
|
||||
|
||||
@ -3007,6 +3008,8 @@ bool ImGui::IsMouseDragging(int button, float lock_threshold)
|
||||
{
|
||||
ImGuiState& g = *GImGui;
|
||||
IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
|
||||
if (!g.IO.MouseDown[button])
|
||||
return false;
|
||||
if (lock_threshold < 0.0f)
|
||||
lock_threshold = g.IO.MouseDragThreshold;
|
||||
return g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold;
|
||||
@ -5123,7 +5126,7 @@ static inline bool IsWindowContentHoverable(ImGuiWindow* window)
|
||||
{
|
||||
// An active popup disable hovering on other windows (apart from its own children)
|
||||
ImGuiState& g = *GImGui;
|
||||
if (ImGuiWindow* focused_window = g.FocusedWindow)
|
||||
if (ImGuiWindow* focused_window = g.FocusedWindow)
|
||||
if (ImGuiWindow* focused_root_window = focused_window->RootWindow)
|
||||
if ((focused_root_window->Flags & ImGuiWindowFlags_Popup) != 0 && focused_root_window->WasActive && focused_root_window != window->RootWindow)
|
||||
return false;
|
||||
@ -5178,6 +5181,11 @@ static bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
||||
}
|
||||
FocusWindow(window);
|
||||
}
|
||||
else if (g.IO.MouseReleased[0] && (flags & ImGuiButtonFlags_PressedOnRelease))
|
||||
{
|
||||
pressed = true;
|
||||
SetActiveId(0);
|
||||
}
|
||||
else if ((flags & ImGuiButtonFlags_Repeat) && g.ActiveId == id && ImGui::IsMouseClicked(0, true))
|
||||
{
|
||||
pressed = true;
|
||||
@ -6588,7 +6596,7 @@ static void Plot(ImGuiPlotType plot_type, const char* label, float (*values_gett
|
||||
|
||||
// Tooltip on hover
|
||||
int v_hovered = -1;
|
||||
if (IsMouseHoveringRect(inner_bb))
|
||||
if (IsHovered(inner_bb, 0))
|
||||
{
|
||||
const float t = ImClamp((g.IO.MousePos.x - inner_bb.Min.x) / (inner_bb.Max.x - inner_bb.Min.x), 0.0f, 0.9999f);
|
||||
const int v_idx = (int)(t * (values_count + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0)));
|
||||
@ -7900,8 +7908,12 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
||||
return false;
|
||||
}
|
||||
|
||||
ImGuiButtonFlags button_flags = 0;
|
||||
if (flags & ImGuiSelectableFlags_Menu) button_flags |= ImGuiButtonFlags_PressedOnClick;
|
||||
if (flags & ImGuiSelectableFlags_MenuItem) button_flags |= ImGuiButtonFlags_PressedOnClick|ImGuiButtonFlags_PressedOnRelease;
|
||||
if (flags & ImGuiSelectableFlags_Disabled) button_flags |= ImGuiButtonFlags_Disabled;
|
||||
bool hovered, held;
|
||||
bool pressed = ButtonBehavior(bb_with_spacing, id, &hovered, &held, true, ((flags & ImGuiSelectableFlags_MenuItem) ? ImGuiButtonFlags_PressedOnClick : 0) | ((flags & ImGuiSelectableFlags_Disabled) ? ImGuiButtonFlags_Disabled : 0));
|
||||
bool pressed = ButtonBehavior(bb_with_spacing, id, &hovered, &held, true, button_flags);
|
||||
if (flags & ImGuiSelectableFlags_Disabled)
|
||||
selected = false;
|
||||
|
||||
@ -8159,7 +8171,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
|
||||
window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * 0.5f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing * 2.0f);
|
||||
float w = label_size.x;
|
||||
pressed = ImGui::Selectable(label, opened, ImGuiSelectableFlags_MenuItem | ImGuiSelectableFlags_DontClosePopups | (!enabled ? ImGuiSelectableFlags_Disabled : 0), ImVec2(w, 0.0f));
|
||||
pressed = ImGui::Selectable(label, opened, ImGuiSelectableFlags_Menu | ImGuiSelectableFlags_DontClosePopups | (!enabled ? ImGuiSelectableFlags_Disabled : 0), ImVec2(w, 0.0f));
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::SameLine();
|
||||
window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * 0.5f);
|
||||
@ -8169,7 +8181,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
|
||||
popup_pos = ImVec2(pos.x, pos.y - style.WindowPadding.y);
|
||||
float w = window->MenuColumns.DeclColumns(label_size.x, 0.0f, (float)(int)(g.FontSize * 1.20f)); // Feedback to next frame
|
||||
float extra_w = ImMax(0.0f, window->Pos.x + ImGui::GetContentRegionMax().x - pos.x - w);
|
||||
pressed = ImGui::Selectable(label, opened, ImGuiSelectableFlags_MenuItem | ImGuiSelectableFlags_DontClosePopups | ImGuiSelectableFlags_DrawFillAvailWidth | (!enabled ? ImGuiSelectableFlags_Disabled : 0), ImVec2(w, 0.0f));
|
||||
pressed = ImGui::Selectable(label, opened, ImGuiSelectableFlags_Menu | ImGuiSelectableFlags_DontClosePopups | ImGuiSelectableFlags_DrawFillAvailWidth | (!enabled ? ImGuiSelectableFlags_Disabled : 0), ImVec2(w, 0.0f));
|
||||
if (!enabled) ImGui::PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]);
|
||||
RenderCollapseTriangle(pos + ImVec2(window->MenuColumns.Pos[2] + extra_w + g.FontSize * 0.20f, 0.0f), false);
|
||||
if (!enabled) ImGui::PopStyleColor();
|
||||
@ -9611,19 +9623,6 @@ void ImFontAtlas::Clear()
|
||||
ClearFonts();
|
||||
}
|
||||
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
void ImGui::GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size)
|
||||
{
|
||||
printf("GetDefaultFontData() is obsoleted in ImGui 1.30.\n");
|
||||
printf("Please use ImGui::GetIO().Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8() functions to retrieve uncompressed texture data.\n");
|
||||
if (fnt_data) *fnt_data = NULL;
|
||||
if (fnt_size) *fnt_size = 0;
|
||||
if (png_data) *png_data = NULL;
|
||||
if (png_size) *png_size = 0;
|
||||
IM_ASSERT(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ImFontAtlas::GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel)
|
||||
{
|
||||
// Lazily build
|
||||
@ -11195,7 +11194,7 @@ void ImGui::ShowTestWindow(bool* opened)
|
||||
if (ImGui::TreeNode("Clipping"))
|
||||
{
|
||||
static ImVec2 size(100, 100), offset(50, 20);
|
||||
ImGui::TextWrapped("On a per-widget basis we are occasionally clipping text if it won't fit in its frame. Otherwise we are doing coarser clipping + passing a scissor rectangle to the renderer. The system is designed to try minimizing both execution and CPU/GPU rendering cost.");
|
||||
ImGui::TextWrapped("On a per-widget basis we are occasionally clipping text CPU-side if it won't fit in its frame. Otherwise we are doing coarser clipping + passing a scissor rectangle to the renderer. The system is designed to try minimizing both execution and CPU/GPU rendering cost.");
|
||||
ImGui::DragFloat2("size", (float*)&size, 0.5f, 0.0f, 200.0f, "%.0f");
|
||||
ImGui::DragFloat2("offset", (float*)&offset, 0.5f, -200, 200.0f, "%.0f");
|
||||
ImVec2 pos = ImGui::GetCursorScreenPos();
|
||||
|
1
imgui.h
1
imgui.h
@ -408,7 +408,6 @@ namespace ImGui
|
||||
|
||||
// Obsolete (will be removed)
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
IMGUI_API void GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size); // OBSOLETE 1.30+
|
||||
static inline void OpenNextNode(bool open) { ImGui::SetNextTreeNodeOpened(open, 0); } // OBSOLETE 1.34+
|
||||
static inline bool GetWindowIsFocused() { return ImGui::IsWindowFocused(); } // OBSOLETE 1.36+
|
||||
static inline bool GetWindowCollapsed() { return ImGui::IsWindowCollapsed(); } // OBSOLETE 1.39+
|
||||
|
Loading…
Reference in New Issue
Block a user