13 #error Must include imgui.h before imgui_internal.h
20 #pragma warning (push)
21 #pragma warning (disable: 4251) // class 'xxx' needs to have dll-interface to be used by clients of struct 'xxx' // when IMGUI_API is set to__declspec(dllexport)
25 #pragma clang diagnostic push
26 #pragma clang diagnostic ignored "-Wunused-function" // for stb_textedit.h
27 #pragma clang diagnostic ignored "-Wmissing-prototypes" // for stb_textedit.h
28 #pragma clang diagnostic ignored "-Wold-style-cast"
59 #undef STB_TEXTEDIT_STRING
60 #undef STB_TEXTEDIT_CHARTYPE
61 #define STB_TEXTEDIT_STRING ImGuiTextEditState
62 #define STB_TEXTEDIT_CHARTYPE ImWchar
63 #define STB_TEXTEDIT_GETWIDTH_NEWLINE -1.0f
80 #define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR)/sizeof(*_ARR)))
81 #define IM_PI 3.14159265358979323846f
82 #define IM_OFFSETOF(_TYPE,_ELM) ((size_t)&(((_TYPE*)0)->_ELM))
95 static inline bool ImCharIsSpace(
int c) {
return c ==
' ' || c ==
'\t' || c == 0x3000; }
96 static inline bool ImIsPowerOfTwo(
int v) {
return v != 0 && (v & (v - 1)) == 0; }
97 static inline int ImUpperPowerOfTwo(
int v) { v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++;
return v; }
111 IMGUI_API const char*
ImStristr(
const char* haystack,
const char* haystack_end,
const char* needle,
const char* needle_end);
117 #ifdef IMGUI_DEFINE_MATH_OPERATORS
118 static inline ImVec2 operator*(
const ImVec2& lhs,
const float rhs) {
return ImVec2(lhs.
x*rhs, lhs.
y*rhs); }
119 static inline ImVec2 operator/(
const ImVec2& lhs,
const float rhs) {
return ImVec2(lhs.
x/rhs, lhs.
y/rhs); }
124 static inline ImVec2& operator+=(
ImVec2& lhs,
const ImVec2& rhs) { lhs.
x += rhs.
x; lhs.
y += rhs.
y;
return lhs; }
125 static inline ImVec2& operator-=(
ImVec2& lhs,
const ImVec2& rhs) { lhs.
x -= rhs.
x; lhs.
y -= rhs.
y;
return lhs; }
126 static inline ImVec2& operator*=(
ImVec2& lhs,
const float rhs) { lhs.
x *= rhs; lhs.
y *= rhs;
return lhs; }
127 static inline ImVec2& operator/=(
ImVec2& lhs,
const float rhs) { lhs.
x /= rhs; lhs.
y /= rhs;
return lhs; }
131 static inline int ImMin(
int lhs,
int rhs) {
return lhs < rhs ? lhs : rhs; }
132 static inline int ImMax(
int lhs,
int rhs) {
return lhs >= rhs ? lhs : rhs; }
133 static inline float ImMin(
float lhs,
float rhs) {
return lhs < rhs ? lhs : rhs; }
134 static inline float ImMax(
float lhs,
float rhs) {
return lhs >= rhs ? lhs : rhs; }
137 static inline int ImClamp(
int v,
int mn,
int mx) {
return (v < mn) ? mn : (v > mx) ? mx : v; }
138 static inline float ImClamp(
float v,
float mn,
float mx) {
return (v < mn) ? mn : (v > mx) ? mx : v; }
140 static inline float ImSaturate(
float f) {
return (f < 0.0f) ? 0.0f : (f > 1.0f) ? 1.0f : f; }
141 static inline int ImLerp(
int a,
int b,
float t) {
return (
int)(a + (b - a) * t); }
142 static inline float ImLerp(
float a,
float b,
float t) {
return a + (b - a) * t; }
147 static inline float ImInvLength(
const ImVec2& lhs,
float fail_value) {
float d = lhs.
x*lhs.
x + lhs.
y*lhs.
y;
if (d > 0.0f)
return 1.0f / sqrtf(d);
return fail_value; }
148 static inline float ImFloor(
float f) {
return (
float)(
int)f; }
155 #ifdef IMGUI_DEFINE_PLACEMENT_NEW
156 struct ImPlacementNewDummy {};
157 inline void*
operator new(size_t, ImPlacementNewDummy,
void* ptr) {
return ptr; }
158 inline void operator delete(
void*, ImPlacementNewDummy,
void*) {}
159 #define IM_PLACEMENT_NEW(_PTR) new(ImPlacementNewDummy(), _PTR)
249 ImRect() : Min(FLT_MAX,FLT_MAX), Max(-FLT_MAX,-FLT_MAX) {}
252 ImRect(
float x1,
float y1,
float x2,
float y2) : Min(x1, y1), Max(x2, y2) {}
262 bool Contains(
const ImVec2& p)
const {
return p.
x >= Min.x && p.
y >= Min.y && p.
x < Max.x && p.
y < Max.y; }
265 void Add(
const ImVec2& rhs) {
if (Min.x > rhs.
x) Min.x = rhs.
x;
if (Min.y > rhs.
y) Min.y = rhs.
y;
if (Max.x < rhs.
x) Max.x = rhs.
x;
if (Max.y < rhs.
y) Max.y = rhs.
y; }
267 void Expand(
const float amount) { Min.x -= amount; Min.y -= amount; Max.x += amount; Max.y += amount; }
268 void Expand(
const ImVec2& amount) { Min.x -= amount.
x; Min.y -= amount.
y; Max.x += amount.
x; Max.y += amount.
y; }
271 void Floor() { Min.x = (float)(
int)Min.x; Min.y = (float)(
int)Min.y; Max.x = (float)(
int)Max.x; Max.y = (float)(
int)Max.y; }
274 if (!on_edge && Contains(p))
276 if (p.
x > Max.x) p.
x = Max.x;
277 else if (p.
x < Min.x) p.
x = Min.x;
278 if (p.
y > Max.y) p.
y = Max.y;
279 else if (p.
y < Min.y) p.
y = Min.y;
329 float Pos[8], NextWidths[8];
332 void Update(
int count,
float spacing,
bool clear);
333 float DeclColumns(
float w0,
float w1,
float w2);
334 float CalcExtraSpace(
float avail_w);
344 int CurLenA, CurLenW;
354 void CursorClamp() { StbState.cursor =
ImMin(StbState.cursor, CurLenW); StbState.select_start =
ImMin(StbState.select_start, CurLenW); StbState.select_end =
ImMin(StbState.select_end, CurLenW); }
355 bool HasSelection()
const {
return StbState.select_start != StbState.select_end; }
356 void ClearSelection() { StbState.select_start = StbState.select_end = StbState.cursor; }
357 void SelectAll() { StbState.select_start = 0; StbState.select_end = CurLenW; StbState.cursor = StbState.select_end; StbState.has_preferred_x =
false; }
358 void OnKeyPressed(
int key);
599 int StackSizesBackup[6];
618 CursorPos = CursorPosPrevLine = CursorStartPos = CursorMaxPos =
ImVec2(0.0f, 0.0f);
619 CurrentLineHeight = PrevLineHeight = 0.0f;
620 CurrentLineTextBaseOffset = PrevLineTextBaseOffset = 0.0f;
624 LastItemRect =
ImRect(0.0f,0.0f,0.0f,0.0f);
625 LastItemHoveredAndUsable = LastItemHoveredRect =
false;
626 MenuBarAppending =
false;
627 MenuBarOffsetX = 0.0f;
631 ButtonRepeat =
false;
632 AllowKeyboardFocus =
true;
634 memset(StackSizesBackup, 0,
sizeof(StackSizesBackup));
638 ColumnsOffsetX = 0.0f;
641 ColumnsMinX = ColumnsMaxX = 0.0f;
642 ColumnsStartPosY = 0.0f;
643 ColumnsStartMaxPosX = 0.0f;
644 ColumnsCellMinY = ColumnsCellMaxY = 0.0f;
715 ImGuiID GetID(
const char* str,
const char* str_end = NULL);
717 ImGuiID GetIDNoKeepAlive(
const char* str,
const char* str_end = NULL);
724 ImRect MenuBarRect()
const {
float y1 = Pos.y + TitleBarHeight();
return ImRect(Pos.x, y1, Pos.x + SizeFull.x, y1 + MenuBarHeight()); }
787 IMGUI_API bool SliderFloatN(
const char* label,
float* v,
int components,
float v_min,
float v_max,
const char* display_format,
float power);
788 IMGUI_API bool SliderIntN(
const char* label,
int* v,
int components,
int v_min,
int v_max,
const char* display_format);
791 IMGUI_API bool DragFloatN(
const char* label,
float* v,
int components,
float v_speed,
float v_min,
float v_max,
const char* display_format,
float power);
792 IMGUI_API bool DragIntN(
const char* label,
int* v,
int components,
float v_speed,
int v_min,
int v_max,
const char* display_format);
806 IMGUI_API void PlotEx(
ImGuiPlotType plot_type,
const char* label,
float (*values_getter)(
void* data,
int idx),
void* data,
int values_count,
int values_offset,
const char* overlay_text,
float scale_min,
float scale_max,
ImVec2 graph_size);
821 #pragma clang diagnostic pop
825 #pragma warning (pop)