Refactor: moved section in imgui_internal.h
This commit is contained in:
parent
9266c0d2d1
commit
7c3fa7d049
2
imgui.h
2
imgui.h
@ -89,6 +89,8 @@ Index of this file:
|
|||||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||||
|
|
||||||
// Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our formatting functions.
|
// Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our formatting functions.
|
||||||
|
// (MSVC provides an equivalent mechanism via SAL Annotations but it would require the macros in a different
|
||||||
|
// location. e.g. #include <sal.h> + void myprintf(_Printf_format_string_ const char* format, ...))
|
||||||
#if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__) && !defined(__clang__)
|
#if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__) && !defined(__clang__)
|
||||||
#define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT+1)))
|
#define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT+1)))
|
||||||
#define IM_FMTLIST(FMT) __attribute__((format(gnu_printf, FMT, 0)))
|
#define IM_FMTLIST(FMT) __attribute__((format(gnu_printf, FMT, 0)))
|
||||||
|
114
imgui_internal.h
114
imgui_internal.h
@ -15,6 +15,8 @@ Index of this file:
|
|||||||
// [SECTION] Generic helpers
|
// [SECTION] Generic helpers
|
||||||
// [SECTION] ImDrawList support
|
// [SECTION] ImDrawList support
|
||||||
// [SECTION] Widgets support: flags, enums, data structures
|
// [SECTION] Widgets support: flags, enums, data structures
|
||||||
|
// [SECTION] Data types support
|
||||||
|
// [SECTION] Popup support
|
||||||
// [SECTION] Inputs support
|
// [SECTION] Inputs support
|
||||||
// [SECTION] Clipper support
|
// [SECTION] Clipper support
|
||||||
// [SECTION] Navigation support
|
// [SECTION] Navigation support
|
||||||
@ -983,43 +985,6 @@ enum ImGuiPlotType
|
|||||||
ImGuiPlotType_Histogram,
|
ImGuiPlotType_Histogram,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiPopupPositionPolicy
|
|
||||||
{
|
|
||||||
ImGuiPopupPositionPolicy_Default,
|
|
||||||
ImGuiPopupPositionPolicy_ComboBox,
|
|
||||||
ImGuiPopupPositionPolicy_Tooltip,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ImGuiDataVarInfo
|
|
||||||
{
|
|
||||||
ImGuiDataType Type;
|
|
||||||
ImU32 Count; // 1+
|
|
||||||
ImU32 Offset; // Offset in parent structure
|
|
||||||
void* GetVarPtr(void* parent) const { return (void*)((unsigned char*)parent + Offset); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ImGuiDataTypeTempStorage
|
|
||||||
{
|
|
||||||
ImU8 Data[8]; // Can fit any data up to ImGuiDataType_COUNT
|
|
||||||
};
|
|
||||||
|
|
||||||
// Type information associated to one ImGuiDataType. Retrieve with DataTypeGetInfo().
|
|
||||||
struct ImGuiDataTypeInfo
|
|
||||||
{
|
|
||||||
size_t Size; // Size in bytes
|
|
||||||
const char* Name; // Short descriptive name for the type, for debugging
|
|
||||||
const char* PrintFmt; // Default printf format for the type
|
|
||||||
const char* ScanFmt; // Default scanf format for the type
|
|
||||||
};
|
|
||||||
|
|
||||||
// Extend ImGuiDataType_
|
|
||||||
enum ImGuiDataTypePrivate_
|
|
||||||
{
|
|
||||||
ImGuiDataType_String = ImGuiDataType_COUNT + 1,
|
|
||||||
ImGuiDataType_Pointer,
|
|
||||||
ImGuiDataType_ID,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Stacked color modifier, backup of modified data so we can restore it
|
// Stacked color modifier, backup of modified data so we can restore it
|
||||||
struct ImGuiColorMod
|
struct ImGuiColorMod
|
||||||
{
|
{
|
||||||
@ -1133,21 +1098,6 @@ struct IMGUI_API ImGuiInputTextState
|
|||||||
void SelectAll() { Stb.select_start = 0; Stb.cursor = Stb.select_end = CurLenW; Stb.has_preferred_x = 0; }
|
void SelectAll() { Stb.select_start = 0; Stb.cursor = Stb.select_end = CurLenW; Stb.has_preferred_x = 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Storage for current popup stack
|
|
||||||
struct ImGuiPopupData
|
|
||||||
{
|
|
||||||
ImGuiID PopupId; // Set on OpenPopup()
|
|
||||||
ImGuiWindow* Window; // Resolved on BeginPopup() - may stay unresolved if user never calls OpenPopup()
|
|
||||||
ImGuiWindow* BackupNavWindow;// Set on OpenPopup(), a NavWindow that will be restored on popup close
|
|
||||||
int ParentNavLayer; // Resolved on BeginPopup(). Actually a ImGuiNavLayer type (declared down below), initialized to -1 which is not part of an enum, but serves well-enough as "not any of layers" value
|
|
||||||
int OpenFrameCount; // Set on OpenPopup()
|
|
||||||
ImGuiID OpenParentId; // Set on OpenPopup(), we need this to differentiate multiple menu sets from each others (e.g. inside menu bar vs loose menu items)
|
|
||||||
ImVec2 OpenPopupPos; // Set on OpenPopup(), preferred popup position (typically == OpenMousePos when using mouse)
|
|
||||||
ImVec2 OpenMousePos; // Set on OpenPopup(), copy of mouse position at the time of opening popup
|
|
||||||
|
|
||||||
ImGuiPopupData() { memset(this, 0, sizeof(*this)); ParentNavLayer = OpenFrameCount = -1; }
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ImGuiNextWindowDataFlags_
|
enum ImGuiNextWindowDataFlags_
|
||||||
{
|
{
|
||||||
ImGuiNextWindowDataFlags_None = 0,
|
ImGuiNextWindowDataFlags_None = 0,
|
||||||
@ -1277,6 +1227,66 @@ struct ImGuiPtrOrIndex
|
|||||||
ImGuiPtrOrIndex(int index) { Ptr = NULL; Index = index; }
|
ImGuiPtrOrIndex(int index) { Ptr = NULL; Index = index; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// [SECTION] Data types support
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
struct ImGuiDataVarInfo
|
||||||
|
{
|
||||||
|
ImGuiDataType Type;
|
||||||
|
ImU32 Count; // 1+
|
||||||
|
ImU32 Offset; // Offset in parent structure
|
||||||
|
void* GetVarPtr(void* parent) const { return (void*)((unsigned char*)parent + Offset); }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ImGuiDataTypeTempStorage
|
||||||
|
{
|
||||||
|
ImU8 Data[8]; // Can fit any data up to ImGuiDataType_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
// Type information associated to one ImGuiDataType. Retrieve with DataTypeGetInfo().
|
||||||
|
struct ImGuiDataTypeInfo
|
||||||
|
{
|
||||||
|
size_t Size; // Size in bytes
|
||||||
|
const char* Name; // Short descriptive name for the type, for debugging
|
||||||
|
const char* PrintFmt; // Default printf format for the type
|
||||||
|
const char* ScanFmt; // Default scanf format for the type
|
||||||
|
};
|
||||||
|
|
||||||
|
// Extend ImGuiDataType_
|
||||||
|
enum ImGuiDataTypePrivate_
|
||||||
|
{
|
||||||
|
ImGuiDataType_String = ImGuiDataType_COUNT + 1,
|
||||||
|
ImGuiDataType_Pointer,
|
||||||
|
ImGuiDataType_ID,
|
||||||
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// [SECTION] Popup support
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
enum ImGuiPopupPositionPolicy
|
||||||
|
{
|
||||||
|
ImGuiPopupPositionPolicy_Default,
|
||||||
|
ImGuiPopupPositionPolicy_ComboBox,
|
||||||
|
ImGuiPopupPositionPolicy_Tooltip,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Storage for popup stacks (g.OpenPopupStack and g.BeginPopupStack)
|
||||||
|
struct ImGuiPopupData
|
||||||
|
{
|
||||||
|
ImGuiID PopupId; // Set on OpenPopup()
|
||||||
|
ImGuiWindow* Window; // Resolved on BeginPopup() - may stay unresolved if user never calls OpenPopup()
|
||||||
|
ImGuiWindow* BackupNavWindow;// Set on OpenPopup(), a NavWindow that will be restored on popup close
|
||||||
|
int ParentNavLayer; // Resolved on BeginPopup(). Actually a ImGuiNavLayer type (declared down below), initialized to -1 which is not part of an enum, but serves well-enough as "not any of layers" value
|
||||||
|
int OpenFrameCount; // Set on OpenPopup()
|
||||||
|
ImGuiID OpenParentId; // Set on OpenPopup(), we need this to differentiate multiple menu sets from each others (e.g. inside menu bar vs loose menu items)
|
||||||
|
ImVec2 OpenPopupPos; // Set on OpenPopup(), preferred popup position (typically == OpenMousePos when using mouse)
|
||||||
|
ImVec2 OpenMousePos; // Set on OpenPopup(), copy of mouse position at the time of opening popup
|
||||||
|
|
||||||
|
ImGuiPopupData() { memset(this, 0, sizeof(*this)); ParentNavLayer = OpenFrameCount = -1; }
|
||||||
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// [SECTION] Inputs support
|
// [SECTION] Inputs support
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -597,7 +597,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
g.NavDisableHighlight = true;
|
g.NavDisableHighlight = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gamepad/Keyboard navigation
|
// Gamepad/Keyboard handling
|
||||||
// We report navigated item as hovered but we don't set g.HoveredId to not interfere with mouse.
|
// We report navigated item as hovered but we don't set g.HoveredId to not interfere with mouse.
|
||||||
if (g.NavId == id && !g.NavDisableHighlight && g.NavDisableMouseHover)
|
if (g.NavId == id && !g.NavDisableHighlight && g.NavDisableMouseHover)
|
||||||
if (!(flags & ImGuiButtonFlags_NoHoveredOnFocus))
|
if (!(flags & ImGuiButtonFlags_NoHoveredOnFocus))
|
||||||
|
Loading…
Reference in New Issue
Block a user