543 #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) 544 #define _CRT_SECURE_NO_WARNINGS 548 #define IMGUI_DEFINE_MATH_OPERATORS 549 #define IMGUI_DEFINE_PLACEMENT_NEW 556 #if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier 563 #pragma warning (disable: 4127) // condition expression is constant 564 #pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff) 565 #pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen 570 #pragma clang diagnostic ignored "-Wunknown-pragmas" // warning : unknown warning group '-Wformat-pedantic *' // not all warnings are known by all clang versions.. so ignoring warnings triggers new warnings on some configuration. great! 571 #pragma clang diagnostic ignored "-Wold-style-cast" // warning : use of old-style cast // yes, they are more terse. 572 #pragma clang diagnostic ignored "-Wfloat-equal" // warning : comparing floating point with == or != is unsafe // storing and comparing against same constants (typically 0.0f) is ok. 573 #pragma clang diagnostic ignored "-Wformat-nonliteral" // warning : format string is not a string literal // passing non-literal to vsnformat(). yes, user passing incorrect format strings can crash the code. 574 #pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals. 575 #pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it. 576 #pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness // 577 #pragma clang diagnostic ignored "-Wformat-pedantic" // warning : format specifies type 'void *' but the argument has type 'xxxx *' // unreasonable, would lead to casting every %p arg to void*. probably enabled by -pedantic. 578 #pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int' // 579 #elif defined(__GNUC__) 580 #pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used 581 #pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size 582 #pragma GCC diagnostic ignored "-Wformat" // warning: format '%p' expects argument of type 'void*', but argument 6 has type 'ImGuiWindow*' 583 #pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function 584 #pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value 585 #pragma GCC diagnostic ignored "-Wcast-qual" // warning: cast from type 'xxxx' to type 'xxxx' casts away qualifiers 586 #pragma GCC diagnostic ignored "-Wformat-nonliteral" // warning: format not a string literal, format string not checked 593 static float GetDraggedColumnOffset(
int column_index);
595 static bool IsKeyPressedMap(
ImGuiKey key,
bool repeat =
true);
597 static ImFont* GetDefaultFont();
598 static void SetCurrentFont(
ImFont* font);
600 static void SetWindowScrollY(
ImGuiWindow* window,
float new_scroll_y);
606 static void ClearSetNextWindowData();
607 static void CheckStacksSize(
ImGuiWindow* window,
bool write);
608 static void Scrollbar(
ImGuiWindow* window,
bool horizontal);
615 static ImGuiIniData* FindWindowSettings(
const char* name);
616 static ImGuiIniData* AddWindowSettings(
const char* name);
617 static void LoadIniSettingsFromDisk(
const char* ini_filename);
618 static void SaveIniSettingsToDisk(
const char* ini_filename);
619 static void MarkIniSettingsDirty(
ImGuiWindow* window);
621 static ImRect GetVisibleRect();
623 static void CloseInactivePopups();
624 static void ClosePopupToLevel(
int remaining);
626 static ImVec2 FindBestPopupWindowPos(
const ImVec2& base_pos,
const ImVec2& size,
int* last_dir,
const ImRect& rect_to_avoid);
629 static int InputTextCalcTextLenAndLineCount(
const char* text_begin,
const char** out_text_end);
630 static ImVec2 InputTextCalcTextSizeW(
const ImWchar* text_begin,
const ImWchar* text_end,
const ImWchar** remaining = NULL,
ImVec2* out_offset = NULL,
bool stop_on_new_line =
false);
632 static inline void DataTypeFormatString(
ImGuiDataType data_type,
void* data_ptr,
const char* display_format,
char* buf,
int buf_size);
633 static inline void DataTypeFormatString(
ImGuiDataType data_type,
void* data_ptr,
int decimal_precision,
char* buf,
int buf_size);
634 static void DataTypeApplyOp(
ImGuiDataType data_type,
int op,
void* value1,
const void* value2);
635 static bool DataTypeApplyOpFromText(
const char* buf,
const char* initial_value_buf,
ImGuiDataType data_type,
void* data_ptr,
const char* scalar_format);
641 static const char* GetClipboardTextFn_DefaultImpl(
void* user_data);
642 static void SetClipboardTextFn_DefaultImpl(
void* user_data,
const char* text);
643 static void ImeSetInputScreenPosFn_DefaultImpl(
int x,
int y);
750 memset(
this, 0,
sizeof(*
this));
753 DisplaySize =
ImVec2(-1.0f, -1.0f);
754 DeltaTime = 1.0f/60.0f;
755 IniSavingRate = 5.0f;
756 IniFilename =
"imgui.ini";
757 LogFilename =
"imgui_log.txt";
758 MouseDoubleClickTime = 0.30f;
759 MouseDoubleClickMaxDist = 6.0f;
762 KeyRepeatDelay = 0.250f;
763 KeyRepeatRate = 0.050f;
766 Fonts = &GImDefaultFontAtlas;
767 FontGlobalScale = 1.0f;
769 FontAllowUserScaling =
false;
770 DisplayFramebufferScale =
ImVec2(1.0f, 1.0f);
771 DisplayVisibleMin = DisplayVisibleMax =
ImVec2(0.0f, 0.0f);
774 RenderDrawListsFn = NULL;
777 GetClipboardTextFn = GetClipboardTextFn_DefaultImpl;
778 SetClipboardTextFn = SetClipboardTextFn_DefaultImpl;
779 ClipboardUserData = NULL;
780 ImeSetInputScreenPosFn = ImeSetInputScreenPosFn_DefaultImpl;
781 ImeWindowHandle = NULL;
784 MousePos =
ImVec2(-FLT_MAX, -FLT_MAX);
785 MousePosPrev =
ImVec2(-FLT_MAX, -FLT_MAX);
786 MouseDragThreshold = 6.0f;
787 for (
int i = 0; i <
IM_ARRAYSIZE(MouseDownDuration); i++) MouseDownDuration[i] = MouseDownDurationPrev[i] = -1.0f;
788 for (
int i = 0; i <
IM_ARRAYSIZE(KeysDownDuration); i++) KeysDownDuration[i] = KeysDownDurationPrev[i] = -1.0f;
801 const int n =
ImStrlenW(InputCharacters);
804 InputCharacters[n] = c;
805 InputCharacters[n+1] =
'\0';
813 ImWchar wchars[wchars_buf_len];
815 for (
int i = 0; i < wchars_buf_len && wchars[i] != 0; i++)
816 AddInputCharacter(wchars[i]);
823 #define IM_F32_TO_INT8_UNBOUND(_VAL) ((int)((_VAL) * 255.0f + ((_VAL)>=0 ? 0.5f : -0.5f))) // Unsaturated, for display purpose 824 #define IM_F32_TO_INT8_SAT(_VAL) ((int)(ImSaturate(_VAL) * 255.0f + 0.5f)) // Saturated, always output 0..255 828 #define IM_NEWLINE "\r\n" 830 #define IM_NEWLINE "\n" 837 float ab_len = sqrtf(ab_dir.
x * ab_dir.
x + ab_dir.
y * ab_dir.
y);
838 ab_dir *= 1.0f / ab_len;
839 float dot = ap.
x * ab_dir.
x + ap.
y * ab_dir.
y;
844 return a + ab_dir * dot;
849 bool b1 = ((p.
x - b.
x) * (a.
y - b.
y) - (p.
y - b.
y) * (a.
x - b.
x)) < 0.0f;
850 bool b2 = ((p.
x - c.
x) * (b.
y - c.
y) - (p.
y - c.
y) * (b.
x - c.
x)) < 0.0f;
851 bool b3 = ((p.
x - a.
x) * (c.
y - a.
y) - (p.
y - a.
y) * (c.
x - a.
x)) < 0.0f;
852 return ((b1 == b2) && (b2 == b3));
860 const float denom = v0.
x * v1.
y - v1.
x * v0.
y;
861 out_v = (v2.
x * v1.
y - v1.
x * v2.
y) / denom;
862 out_w = (v0.
x * v2.
y - v2.
x * v0.
y) / denom;
863 out_u = 1.0f - out_v - out_w;
871 float dist2_ab = ImLengthSqr(p - proj_ab);
872 float dist2_bc = ImLengthSqr(p - proj_bc);
873 float dist2_ca = ImLengthSqr(p - proj_ca);
874 float m = ImMin(dist2_ab, ImMin(dist2_bc, dist2_ca));
885 while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; }
889 int ImStrnicmp(
const char* str1,
const char* str2,
int count)
892 while (count > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; count--; }
898 if (count < 1)
return;
899 strncpy(dst, src, (
size_t)count);
905 size_t len = strlen(str) + 1;
907 return (
char*)memcpy(buff, (
const void*)str, len);
919 while (buf_mid_line > buf_begin && buf_mid_line[-1] !=
'\n')
924 const char*
ImStristr(
const char* haystack,
const char* haystack_end,
const char* needle,
const char* needle_end)
927 needle_end = needle + strlen(needle);
929 const char un0 = (char)toupper(*needle);
930 while ((!haystack_end && *haystack) || (haystack_end && haystack < haystack_end))
932 if (toupper(*haystack) == un0)
934 const char* b = needle + 1;
935 for (
const char* a = haystack + 1; b < needle_end; a++, b++)
936 if (toupper(*a) != toupper(*b))
946 static const char* ImAtoi(
const char* src,
int* output)
949 if (*src ==
'-') { negative = 1; src++; }
950 if (*src ==
'+') { src++; }
952 while (*src >=
'0' && *src <=
'9')
953 v = (v * 10) + (*src++ -
'0');
954 *output = negative ? -v : v;
965 int w = vsnprintf(buf, buf_size, fmt, args);
967 if (w == -1 || w >= buf_size)
976 int w = vsnprintf(buf, buf_size, fmt, args);
977 if (w == -1 || w >= buf_size)
987 static ImU32 crc32_lut[256] = { 0 };
990 const ImU32 polynomial = 0xEDB88320;
991 for (
ImU32 i = 0; i < 256; i++)
994 for (
ImU32 j = 0; j < 8; j++)
995 crc = (crc >> 1) ^ (
ImU32(-
int(crc & 1)) & polynomial);
1002 const unsigned char* current = (
const unsigned char*)data;
1008 crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ *current++];
1013 while (
unsigned char c = *current++)
1019 if (c ==
'#' && current[0] ==
'#' && current[1] ==
'#')
1021 crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ c];
1036 unsigned int c = (
unsigned int)-1;
1037 const unsigned char* str = (
const unsigned char*)in_text;
1040 c = (
unsigned int)(*str++);
1044 if ((*str & 0xe0) == 0xc0)
1047 if (in_text_end && in_text_end - (
const char*)str < 2)
return 1;
1048 if (*str < 0xc2)
return 2;
1049 c = (
unsigned int)((*str++ & 0x1f) << 6);
1050 if ((*str & 0xc0) != 0x80)
return 2;
1051 c += (*str++ & 0x3f);
1055 if ((*str & 0xf0) == 0xe0)
1058 if (in_text_end && in_text_end - (
const char*)str < 3)
return 1;
1059 if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf))
return 3;
1060 if (*str == 0xed && str[1] > 0x9f)
return 3;
1061 c = (
unsigned int)((*str++ & 0x0f) << 12);
1062 if ((*str & 0xc0) != 0x80)
return 3;
1063 c += (
unsigned int)((*str++ & 0x3f) << 6);
1064 if ((*str & 0xc0) != 0x80)
return 3;
1065 c += (*str++ & 0x3f);
1069 if ((*str & 0xf8) == 0xf0)
1072 if (in_text_end && in_text_end - (
const char*)str < 4)
return 1;
1073 if (*str > 0xf4)
return 4;
1074 if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf))
return 4;
1075 if (*str == 0xf4 && str[1] > 0x8f)
return 4;
1076 c = (
unsigned int)((*str++ & 0x07) << 18);
1077 if ((*str & 0xc0) != 0x80)
return 4;
1078 c += (
unsigned int)((*str++ & 0x3f) << 12);
1079 if ((*str & 0xc0) != 0x80)
return 4;
1080 c += (
unsigned int)((*str++ & 0x3f) << 6);
1081 if ((*str & 0xc0) != 0x80)
return 4;
1082 c += (*str++ & 0x3f);
1084 if ((c & 0xFFFFF800) == 0xD800)
return 4;
1095 ImWchar* buf_end = buf + buf_size;
1096 while (buf_out < buf_end-1 && (!in_text_end || in_text < in_text_end) && *in_text)
1106 if (in_text_remaining)
1107 *in_text_remaining = in_text;
1108 return (
int)(buf_out - buf);
1114 while ((!in_text_end || in_text < in_text_end) && *in_text)
1127 static inline int ImTextCharToUtf8(
char* buf,
int buf_size,
unsigned int c)
1136 if (buf_size < 2)
return 0;
1137 buf[0] = (char)(0xc0 + (c >> 6));
1138 buf[1] = (char)(0x80 + (c & 0x3f));
1141 if (c >= 0xdc00 && c < 0xe000)
1145 if (c >= 0xd800 && c < 0xdc00)
1147 if (buf_size < 4)
return 0;
1148 buf[0] = (char)(0xf0 + (c >> 18));
1149 buf[1] = (char)(0x80 + ((c >> 12) & 0x3f));
1150 buf[2] = (char)(0x80 + ((c >> 6) & 0x3f));
1151 buf[3] = (char)(0x80 + ((c ) & 0x3f));
1156 if (buf_size < 3)
return 0;
1157 buf[0] = (char)(0xe0 + (c >> 12));
1158 buf[1] = (char)(0x80 + ((c>> 6) & 0x3f));
1159 buf[2] = (char)(0x80 + ((c ) & 0x3f));
1164 static inline int ImTextCountUtf8BytesFromChar(
unsigned int c)
1166 if (c < 0x80)
return 1;
1167 if (c < 0x800)
return 2;
1168 if (c >= 0xdc00 && c < 0xe000)
return 0;
1169 if (c >= 0xd800 && c < 0xdc00)
return 4;
1175 char* buf_out = buf;
1176 const char* buf_end = buf + buf_size;
1177 while (buf_out < buf_end-1 && (!in_text_end || in_text < in_text_end) && *in_text)
1179 unsigned int c = (
unsigned int)(*in_text++);
1181 *buf_out++ = (char)c;
1183 buf_out += ImTextCharToUtf8(buf_out, (
int)(buf_end-buf_out-1), c);
1186 return (
int)(buf_out - buf);
1191 int bytes_count = 0;
1192 while ((!in_text_end || in_text < in_text_end) && *in_text)
1194 unsigned int c = (
unsigned int)(*in_text++);
1198 bytes_count += ImTextCountUtf8BytesFromChar(c);
1205 float s = 1.0f/255.0f;
1227 c.
w *= style.
Alpha * alpha_mul;
1242 return style.
Colors[idx];
1248 if (style_alpha >= 1.0f)
1251 a = (int)(a * style_alpha);
1271 const float chroma = r - (g < b ? g : b);
1272 out_h = fabsf(K + (g - b) / (6.f * chroma + 1e-20f));
1273 out_s = chroma / (r + 1e-20f);
1284 out_r = out_g = out_b = v;
1288 h = fmodf(h, 1.0f) / (60.0f/360.0f);
1290 float f = h - (float)i;
1291 float p = v * (1.0f - s);
1292 float q = v * (1.0f - s * f);
1293 float t = v * (1.0f - s * (1.0f - f));
1297 case 0: out_r = v; out_g = t; out_b = p;
break;
1298 case 1: out_r = q; out_g = v; out_b = p;
break;
1299 case 2: out_r = p; out_g = v; out_b = t;
break;
1300 case 3: out_r = p; out_g = q; out_b = v;
break;
1301 case 4: out_r = t; out_g = p; out_b = v;
break;
1302 case 5:
default: out_r = v; out_g = p; out_b = q;
break;
1308 #if defined(_WIN32) && !defined(__CYGWIN__) 1313 buf.
resize(filename_wsize + mode_wsize);
1316 return _wfopen((
wchar_t*)&buf[0], (
wchar_t*)&buf[filename_wsize]);
1318 return fopen(filename, mode);
1324 void*
ImFileLoadToMemory(
const char* filename,
const char* file_open_mode,
int* out_file_size,
int padding_bytes)
1331 if ((f =
ImFileOpen(filename, file_open_mode)) == NULL)
1334 long file_size_signed;
1335 if (fseek(f, 0, SEEK_END) || (file_size_signed = ftell(f)) == -1 || fseek(f, 0, SEEK_SET))
1341 int file_size = (int)file_size_signed;
1343 if (file_data == NULL)
1348 if (fread(file_data, 1, (
size_t)file_size, f) != (
size_t)file_size)
1354 if (padding_bytes > 0)
1355 memset((
void *)(((
char*)file_data) + file_size), 0, padding_bytes);
1359 *out_file_size = file_size;
1379 int count = (int)(last - first);
1382 int count2 = count / 2;
1387 count -= count2 + 1;
1400 if (it == Data.
end() || it->key != key)
1407 return GetInt(key, default_val ? 1 : 0) != 0;
1413 if (it == Data.
end() || it->key != key)
1421 if (it == Data.
end() || it->key != key)
1430 if (it == Data.
end() || it->key != key)
1431 it = Data.
insert(it,
Pair(key, default_val));
1437 return (
bool*)GetIntRef(key, default_val ? 1 : 0);
1443 if (it == Data.
end() || it->key != key)
1444 it = Data.
insert(it,
Pair(key, default_val));
1451 if (it == Data.
end() || it->key != key)
1452 it = Data.
insert(it,
Pair(key, default_val));
1460 if (it == Data.
end() || it->key != key)
1462 Data.insert(it,
Pair(key, val));
1470 SetInt(key, val ? 1 : 0);
1476 if (it == Data.
end() || it->key != key)
1478 Data.insert(it,
Pair(key, val));
1487 if (it == Data.
end() || it->key != key)
1489 Data.insert(it,
Pair(key, val));
1497 for (
int i = 0; i < Data.Size; i++)
1529 return value_changed;
1536 const char* we = wb;
1539 if (*we == separator)
1553 TextRange input_range(InputBuf, InputBuf+strlen(InputBuf));
1554 input_range.
split(
',', Filters);
1557 for (
int i = 0; i != Filters.Size; i++)
1559 Filters[i].trim_blanks();
1560 if (Filters[i].empty())
1562 if (Filters[i].front() !=
'-')
1569 if (Filters.empty())
1575 for (
int i = 0; i != Filters.Size; i++)
1580 if (f.
front() ==
'-')
1608 #define va_copy(dest, src) (dest = src) 1617 int len = vsnprintf(NULL, 0, fmt, args);
1621 const int write_off = Buf.Size;
1622 const int needed_sz = write_off + len;
1623 if (write_off + len >= Buf.Capacity)
1625 int double_capacity = Buf.Capacity * 2;
1626 Buf.reserve(needed_sz > double_capacity ? needed_sz : double_capacity);
1629 Buf.resize(needed_sz);
1636 va_start(args, fmt);
1648 Spacing = Width = NextWidth = 0.0f;
1649 memset(Pos, 0,
sizeof(Pos));
1650 memset(NextWidths, 0,
sizeof(NextWidths));
1657 Width = NextWidth = 0.0f;
1659 if (clear) memset(NextWidths, 0,
sizeof(NextWidths));
1660 for (
int i = 0; i < Count; i++)
1662 if (i > 0 && NextWidths[i] > 0.0f)
1664 Pos[i] = (float)(
int)Width;
1665 Width += NextWidths[i];
1666 NextWidths[i] = 0.0f;
1673 NextWidths[0] = ImMax(NextWidths[0], w0);
1674 NextWidths[1] = ImMax(NextWidths[1], w1);
1675 NextWidths[2] = ImMax(NextWidths[2], w2);
1676 for (
int i = 0; i < 3; i++)
1677 NextWidth += NextWidths[i] + ((i > 0 && NextWidths[i] > 0.0f) ?
Spacing : 0.0f);
1678 return ImMax(Width, NextWidth);
1683 return ImMax(0.0f, avail_w - Width);
1690 static void SetCursorPosYAndSetupDummyPrevLine(
float pos_y,
float line_height)
1708 ItemsHeight = items_height;
1711 DisplayEnd = DisplayStart = -1;
1712 if (ItemsHeight > 0.0f)
1715 if (DisplayStart > 0)
1716 SetCursorPosYAndSetupDummyPrevLine(StartPosY + DisplayStart * ItemsHeight, ItemsHeight);
1726 if (ItemsCount < INT_MAX)
1727 SetCursorPosYAndSetupDummyPrevLine(StartPosY + ItemsCount * ItemsHeight, ItemsHeight);
1749 if (ItemsCount == 1) { ItemsCount = -1;
return false; }
1752 Begin(ItemsCount-1, items_height);
1760 IM_ASSERT(DisplayStart >= 0 && DisplayEnd >= 0);
1777 IDStack.push_back(ID);
1779 OrderWithinParent = 0;
1780 PosFloat = Pos =
ImVec2(0.0f, 0.0f);
1781 Size = SizeFull =
ImVec2(0.0f, 0.0f);
1782 SizeContents = SizeContentsExplicit =
ImVec2(0.0f, 0.0f);
1784 MoveId =
GetID(
"#MOVE");
1785 Scroll =
ImVec2(0.0f, 0.0f);
1786 ScrollTarget =
ImVec2(FLT_MAX, FLT_MAX);
1787 ScrollTargetCenterRatio =
ImVec2(0.5f, 0.5f);
1788 ScrollbarX = ScrollbarY =
false;
1789 ScrollbarSizes =
ImVec2(0.0f, 0.0f);
1791 Active = WasActive =
false;
1798 AutoFitFramesX = AutoFitFramesY = -1;
1799 AutoFitOnlyGrows =
false;
1800 AutoFitChildAxises = 0x00;
1801 AutoPosLastDirection = -1;
1804 SetWindowPosVal = SetWindowPosPivot =
ImVec2(FLT_MAX, FLT_MAX);
1806 LastFrameActive = -1;
1807 ItemWidthDefault = 0.0f;
1808 FontWindowScale = 1.0f;
1812 DrawList->_OwnerName = Name;
1813 ParentWindow = NULL;
1815 RootNonPopupWindow = NULL;
1817 FocusIdxAllCounter = FocusIdxTabCounter = -1;
1818 FocusIdxAllRequestCurrent = FocusIdxTabRequestCurrent = INT_MAX;
1819 FocusIdxAllRequestNext = FocusIdxTabRequestNext = INT_MAX;
1824 DrawList->~ImDrawList();
1833 ImGuiID seed = IDStack.back();
1834 ImGuiID id =
ImHash(str, str_end ? (
int)(str_end - str) : 0, seed);
1841 ImGuiID seed = IDStack.back();
1849 ImGuiID seed = IDStack.back();
1850 return ImHash(str, str_end ? (
int)(str_end - str) : 0, seed);
1901 static inline bool IsWindowContentHoverable(
ImGuiWindow* window)
1953 const bool is_clipped =
IsClippedEx(bb,
id,
false);
1979 if (!IsWindowContentHoverable(window))
2004 if (!IsWindowContentHoverable(window))
2028 if (allow_keyboard_focus)
2039 if (allow_keyboard_focus)
2056 if (size.
x < 0.0f || size.
y < 0.0f)
2067 if (wrap_pos_x < 0.0f)
2071 if (wrap_pos_x == 0.0f)
2073 else if (wrap_pos_x > 0.0f)
2076 return ImMax(wrap_pos_x - pos.
x, 1.0f);
2118 #ifdef IMGUI_SET_CURRENT_CONTEXT_FUNC 2119 IMGUI_SET_CURRENT_CONTEXT_FUNC(ctx);
2127 if (!malloc_fn) malloc_fn = malloc;
2138 ctx->~ImGuiContext();
2151 return GImGui->
Style;
2162 return GImGui->
Time;
2186 SetCurrentFont(GetDefaultFont());
2300 if (
ImGuiWindow* modal_window = GetFrontMostModalRootWindow())
2304 while (window && window != modal_window)
2316 int mouse_earliest_button_down = -1;
2317 bool mouse_any_down =
false;
2325 mouse_earliest_button_down = i;
2327 bool mouse_avail_to_imgui = (mouse_earliest_button_down == -1) || g.
IO.
MouseDownOwned[mouse_earliest_button_down];
2339 if (!mouse_avail_to_imgui)
2354 window->
Pos += offset;
2356 window->
Size *= scale;
2394 CloseInactivePopups();
2474 static ImGuiIniData* FindWindowSettings(
const char* name)
2487 static ImGuiIniData* AddWindowSettings(
const char* name)
2501 static void LoadIniSettingsFromDisk(
const char* ini_filename)
2513 const char* buf_end = file_data + file_size;
2514 for (
const char* line_start = file_data; line_start < buf_end; )
2516 const char* line_end = line_start;
2517 while (line_end < buf_end && *line_end !=
'\n' && *line_end !=
'\r')
2520 if (line_start[0] ==
'[' && line_end > line_start && line_end[-1] ==
']')
2524 settings = FindWindowSettings(name);
2526 settings = AddWindowSettings(name);
2532 if (sscanf(line_start,
"Pos=%f,%f", &x, &y) == 2)
2534 else if (sscanf(line_start,
"Size=%f,%f", &x, &y) == 2)
2536 else if (sscanf(line_start,
"Collapsed=%d", &i) == 1)
2540 line_start = line_end+1;
2546 static void SaveIniSettingsToDisk(
const char* ini_filename)
2562 settings->
Pos = window->
Pos;
2575 if (settings->
Pos.
x == FLT_MAX)
2577 const char* name = settings->
Name;
2578 if (
const char* p = strstr(name,
"###"))
2580 fprintf(f,
"[%s]\n", name);
2581 fprintf(f,
"Pos=%d,%d\n", (
int)settings->
Pos.
x, (
int)settings->
Pos.
y);
2582 fprintf(f,
"Size=%d,%d\n", (
int)settings->
Size.
x, (
int)settings->
Size.
y);
2583 fprintf(f,
"Collapsed=%d\n", settings->
Collapsed);
2590 static void MarkIniSettingsDirty(
ImGuiWindow* window)
2599 static int ChildWindowComparer(
const void* lhs,
const void* rhs)
2620 for (
int i = 0; i < count; i++)
2624 AddWindowToSortedBuffer(out_sorted_windows, child);
2664 AddDrawListToRenderList(out_render_list, window->
DrawList);
2672 AddWindowToRenderList(out_render_list, child);
2676 static void AddWindowToRenderListSelectLayer(
ImGuiWindow* window)
2693 window->
DrawList->
PushClipRect(clip_rect_min, clip_rect_max, intersect_with_current_clip_rect);
2739 else if (g.
NavWindow != NULL && GetFrontMostModalRootWindow() == NULL)
2790 AddWindowToRenderListSelectLayer(window);
2795 int flattened_size = n;
2816 g.
OverlayDrawList.
AddImage(tex_id, pos+
ImVec2(1,0), pos+
ImVec2(1,0) + size, cursor_data.
TexUvMin[1], cursor_data.
TexUvMax[1],
IM_COL32(0,0,0,48));
2817 g.
OverlayDrawList.
AddImage(tex_id, pos+
ImVec2(2,0), pos+
ImVec2(2,0) + size, cursor_data.
TexUvMin[1], cursor_data.
TexUvMax[1],
IM_COL32(0,0,0,48));
2840 const char* text_display_end = text;
2842 text_end = (
const char*)-1;
2844 while (text_display_end < text_end && *text_display_end !=
'\0' && (text_display_end[0] !=
'#' || text_display_end[1] !=
'#'))
2846 return text_display_end;
2857 va_start(args, fmt);
2860 vfprintf(g.
LogFile, fmt, args);
2871 static void LogRenderedText(
const ImVec2* ref_pos,
const char* text,
const char* text_end = NULL)
2879 const bool log_new_line = ref_pos && (ref_pos->
y > window->
DC.
LogLinePosY + 1);
2883 const char* text_remaining = text;
2890 const char* line_end = text_remaining;
2891 while (line_end < text_end)
2892 if (*line_end ==
'\n')
2896 if (line_end >= text_end)
2899 const bool is_first_line = (text == text_remaining);
2900 bool is_last_line =
false;
2901 if (line_end == NULL)
2903 is_last_line =
true;
2904 line_end = text_end;
2906 if (line_end != NULL && !(is_last_line && (line_end - text_remaining)==0))
2908 const int char_count = (int)(line_end - text_remaining);
2909 if (log_new_line || !is_first_line)
2917 text_remaining = line_end + 1;
2929 const char* text_display_end;
2930 if (hide_text_after_hash)
2937 text_end = text + strlen(text);
2938 text_display_end = text_end;
2941 const int text_len = (int)(text_display_end - text);
2946 LogRenderedText(&pos, text, text_display_end);
2956 text_end = text + strlen(text);
2958 const int text_len = (int)(text_end - text);
2963 LogRenderedText(&pos, text, text_end);
2973 const int text_len = (int)(text_display_end - text);
2982 const ImVec2 text_size = text_size_if_known ? *text_size_if_known :
CalcTextSize(text, text_display_end,
false, 0.0f);
2984 const ImVec2* clip_min = clip_rect ? &clip_rect->
Min : &pos_min;
2985 const ImVec2* clip_max = clip_rect ? &clip_rect->
Max : &pos_max;
2986 bool need_clipping = (pos.
x + text_size.
x >= clip_max->
x) || (pos.
y + text_size.
y >= clip_max->
y);
2988 need_clipping |= (pos.
x < clip_min->
x) || (pos.
y < clip_min->
y);
2991 if (align.
x > 0.0f) pos.
x = ImMax(pos.
x, pos.
x + (pos_max.
x - pos.
x - text_size.
x) * align.
x);
2992 if (align.
y > 0.0f) pos.
y = ImMax(pos.
y, pos.
y + (pos_max.
y - pos.
y - text_size.
y) * align.
y);
2997 ImVec4 fine_clip_rect(clip_min->
x, clip_min->
y, clip_max->
x, clip_max->
y);
3005 LogRenderedText(&pos, text, text_display_end);
3037 const float h = g.
FontSize * 1.00f;
3038 const float r = h * 0.40f * scale;
3039 ImVec2 center = p_min +
ImVec2(h*0.50f, h*0.50f*scale);
3044 center.
y -= r*0.25f;
3045 a = center + ImVec2(0,1)*r;
3046 b = center + ImVec2(-0.866f,-0.5f)*r;
3047 c = center + ImVec2(0.866f,-0.5f)*r;
3051 a = center + ImVec2(1,0)*r;
3052 b = center + ImVec2(-0.500f,0.866f)*r;
3053 c = center + ImVec2(-0.500f,-0.866f)*r;
3069 float start_x = (float)(
int)(g.
FontSize * 0.307f + 0.5f);
3070 float rem_third = (float)(
int)((g.
FontSize - start_x) / 3.0f);
3071 float bx = pos.
x + 0.5f + start_x + rem_third;
3085 const char* text_display_end;
3086 if (hide_text_after_double_hash)
3089 text_display_end = text_end;
3092 const float font_size = g.
FontSize;
3093 if (text == text_display_end)
3094 return ImVec2(0.0f, font_size);
3095 ImVec2 text_size = font->
CalcTextSizeA(font_size, FLT_MAX, wrap_width, text, text_display_end, NULL);
3098 const float font_scale = font_size / font->
FontSize;
3099 const float character_spacing_x = 1.0f * font_scale;
3100 if (text_size.
x > 0.0f)
3101 text_size.
x -= character_spacing_x;
3102 text_size.
x = (float)(
int)(text_size.
x + 0.95f);
3117 *out_items_display_start = 0;
3118 *out_items_display_end = items_count;
3123 *out_items_display_start = *out_items_display_end = 0;
3128 int start = (int)((window->
ClipRect.
Min.
y - pos.
y) / items_height);
3129 int end = (int)((window->
ClipRect.
Max.
y - pos.
y) / items_height);
3130 start = ImClamp(start, 0, items_count);
3131 end = ImClamp(end + 1, start, items_count);
3132 *out_items_display_start = start;
3133 *out_items_display_end = end;
3168 ImRect rect_clipped(r_min, r_max);
3183 static bool IsKeyPressedMap(
ImGuiKey key,
bool repeat)
3185 const int key_index = GImGui->
IO.
KeyMap[key];
3192 return GImGui->
IO.
KeyMap[imgui_key];
3198 if (user_key_index < 0)
return false;
3207 if (t <= repeat_delay || repeat_rate <= 0.0f)
3209 const int count = (int)((t - repeat_delay) / repeat_rate) - (
int)((t_prev - repeat_delay) / repeat_rate);
3210 return (count > 0) ? count : 0;
3216 if (key_index < 0)
return false;
3225 if (user_key_index < 0)
return false;
3238 if (user_key_index < 0)
return false;
3263 if ((fmodf(t - delay, rate) > rate*0.5f) != (fmodf(t - delay - g.
IO.
DeltaTime, rate) > rate*0.5f))
3290 if (lock_threshold < 0.0f)
3312 if (mouse_pos == NULL)
3314 const float MOUSE_INVALID = -256000.0f;
3315 return mouse_pos->
x >= MOUSE_INVALID && mouse_pos->
y >= MOUSE_INVALID;
3322 if (lock_threshold < 0.0f)
3327 return ImVec2(0.0f, 0.0f);
3426 static ImRect GetVisibleRect()
3435 static void BeginTooltipEx(
ImGuiWindowFlags extra_flags,
bool override_previous_tooltip)
3438 char window_name[16];
3440 if (override_previous_tooltip)
3454 BeginTooltipEx(0,
true);
3462 va_start(args, fmt);
3469 BeginTooltipEx(0,
false);
3490 else if (reopen_existing || g.
OpenPopupStack[current_stack_size].PopupId !=
id)
3503 static void CloseInactivePopups()
3523 bool has_focus =
false;
3540 return front_most_popup;
3544 static void ClosePopupToLevel(
int remaining)
3571 ClosePopupToLevel(popup_idx);
3574 static inline void ClearSetNextWindowData()
3588 ClearSetNextWindowData();
3601 bool is_open =
Begin(name, NULL, flags);
3615 ClearSetNextWindowData();
3640 ClearSetNextWindowData();
3649 bool is_open =
Begin(name, p_open, flags);
3650 if (!is_open || (p_open && !*p_open))
3689 str_id =
"window_context";
3699 str_id =
"void_context";
3711 ImVec2 size = ImFloor(size_arg);
3712 const int auto_fit_axises = ((size.
x == 0.0f) ? 0x01 : 0x00) | ((size.
y == 0.0f) ? 0x02 : 0x00);
3714 size.
x = ImMax(content_avail.
x, 4.0f) - fabsf(size.
x);
3716 size.
y = ImMax(content_avail.
y, 4.0f) - fabsf(size.
y);
3719 flags |= extra_flags;
3727 bool ret =
ImGui::Begin(title, NULL, size, -1.0f, flags);
3739 return BeginChildEx(str_id, window->
GetID(str_id), size_arg, border, extra_flags);
3744 return BeginChildEx(NULL,
id, size_arg, border, extra_flags);
3761 sz.
x = ImMax(4.0f, sz.
x);
3763 sz.
y = ImMax(4.0f, sz.
y);
3792 static void CheckStacksSize(
ImGuiWindow* window,
bool write)
3797 {
int current = window->
IDStack.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"PushID/PopID or TreeNode/TreePop Mismatch!"); p_backup++; }
3798 {
int current = window->
DC.
GroupStack.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"BeginGroup/EndGroup Mismatch!"); p_backup++; }
3799 {
int current = g.
CurrentPopupStack.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"BeginMenu/EndMenu or BeginPopup/EndPopup Mismatch"); p_backup++;}
3800 {
int current = g.
ColorModifiers.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"PushStyleColor/PopStyleColor Mismatch!"); p_backup++; }
3801 {
int current = g.
StyleModifiers.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"PushStyleVar/PopStyleVar Mismatch!"); p_backup++; }
3802 {
int current = g.
FontStack.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"PushFont/PopFont Mismatch!"); p_backup++; }
3806 static ImVec2 FindBestPopupWindowPos(
const ImVec2& base_pos,
const ImVec2& size,
int* last_dir,
const ImRect& r_inner)
3812 ImRect r_outer(GetVisibleRect());
3813 r_outer.
Expand(
ImVec2((size.
x - r_outer.
GetWidth() > safe_padding.
x*2) ? -safe_padding.
x : 0.0f, (size.
y - r_outer.
GetHeight() > safe_padding.
y*2) ? -safe_padding.
y : 0.0f));
3814 ImVec2 base_pos_clamped = ImClamp(base_pos, r_outer.
Min, r_outer.
Max - size);
3816 for (
int n = (*last_dir != -1) ? -1 : 0; n < 4; n++)
3818 const int dir = (n == -1) ? *last_dir : n;
3823 return ImVec2(dir == 0 ? r_inner.
Max.
x : dir == 3 ? r_inner.
Min.
x - size.
x : base_pos_clamped.
x, dir == 1 ? r_inner.
Max.
y : dir == 2 ? r_inner.
Min.
y - size.
y : base_pos_clamped.
y);
3829 pos.
x = ImMax(ImMin(pos.
x + size.
x, r_outer.
Max.
x) - size.
x, r_outer.
Min.
x);
3830 pos.
y = ImMax(ImMin(pos.
y + size.
y, r_outer.
Max.
y) - size.
y, r_outer.
Min.
y);
3852 window->
Flags = flags;
3869 settings = AddWindowSettings(name);
3878 if (settings->
Pos.
x != FLT_MAX)
3885 if (ImLengthSqr(settings->
Size) > 0.00001f)
3886 size = settings->
Size;
3897 if (window->
Size.
x <= 0.0f)
3899 if (window->
Size.
y <= 0.0f)
3951 ImVec2 size_auto_fit_after_constraint = CalcSizeFullWithConstraint(window, size_auto_fit);
3954 if (size_auto_fit_after_constraint.
y < window->
SizeContents.
y && !(flags & ImGuiWindowFlags_NoScrollbar))
3956 size_auto_fit.
y = ImMax(size_auto_fit.
y - style.
ItemSpacing.
y, 0.0f);
3958 return size_auto_fit;
3970 scroll = ImMax(scroll,
ImVec2(0.0f, 0.0f));
4005 bool window_is_new =
false;
4009 window = CreateNewWindow(name, size_on_first_use, flags);
4010 window_is_new =
true;
4014 const bool first_begin_of_the_frame = (window->
LastFrameActive != current_frame);
4015 if (first_begin_of_the_frame)
4018 flags = window->
Flags;
4023 SetCurrentWindow(window);
4024 CheckStacksSize(window,
true);
4027 bool window_just_activated_by_user = (window->
LastFrameActive < current_frame - 1);
4031 window_just_activated_by_user |= (window->
PopupId != popup_ref.
PopupId);
4032 window_just_activated_by_user |= (window != popup_ref.
Window);
4033 popup_ref.
Window = window;
4038 const bool window_just_appearing_after_hidden_for_resize = (window->
HiddenFrames == 1);
4039 window->
Appearing = (window_just_activated_by_user || window_just_appearing_after_hidden_for_resize);
4042 bool window_pos_set_by_api =
false, window_size_set_by_api =
false;
4075 else if (first_begin_of_the_frame)
4093 int root_idx, root_non_popup_idx;
4097 for (root_non_popup_idx = root_idx; root_non_popup_idx > 0; root_non_popup_idx--)
4105 if (first_begin_of_the_frame)
4117 ImRect fullscreen_rect(GetVisibleRect());
4123 if (window_just_activated_by_user)
4127 if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api)
4139 MarkIniSettingsDirty(window);
4162 if (!window_size_set_by_api)
4172 const ImVec2 size_auto_fit = CalcSizeAutoFit(window);
4182 else if (!window_size_set_by_api)
4195 MarkIniSettingsDirty(window);
4206 if (flags & ImGuiWindowFlags_ChildWindow)
4211 if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup))
4218 if (window_pos_with_pivot)
4233 rect_to_avoid =
ImRect(parent_window->
Pos.
x + horizontal_overlap, -FLT_MAX, parent_window->
Pos.
x + parent_window->
Size.
x - horizontal_overlap - parent_window->
ScrollbarSizes.
x, FLT_MAX);
4236 else if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api && window_just_appearing_after_hidden_for_resize)
4246 ImRect rect_to_avoid(ref_pos.
x - 16, ref_pos.
y - 8, ref_pos.
x + 24, ref_pos.
y + 24);
4253 if (!(flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Tooltip))
4277 window->
Scroll = CalcNextScrollFromScrollTargetAndClamp(window);
4281 if ((flags & ImGuiWindowFlags_Modal) != 0 && window == GetFrontMostModalRootWindow())
4294 ImU32 resize_col = 0;
4295 const float resize_corner_size = ImMax(g.
FontSize * 1.35f, window_rounding + 1.0f + g.
FontSize * 0.2f);
4301 const ImRect resize_rect(br -
ImVec2(resize_corner_size * 0.75f, resize_corner_size * 0.75f), br);
4306 if (hovered || held)
4309 ImVec2 size_target(FLT_MAX,FLT_MAX);
4313 size_target = size_auto_fit;
4322 if (size_target.
x != FLT_MAX && size_target.
y != FLT_MAX)
4324 window->
SizeFull = CalcSizeFullWithConstraint(window, size_target);
4325 MarkIniSettingsDirty(window);
4345 else if ((flags & ImGuiWindowFlags_ChildWindow) != 0)
4348 if (bg_alpha >= 0.0f)
4349 bg_color.
w = bg_alpha;
4350 bg_color.
w *= style.
Alpha;
4351 if (bg_color.
w > 0.0f)
4356 if (!(flags & ImGuiWindowFlags_NoTitleBar))
4370 Scrollbar(window,
true);
4372 Scrollbar(window,
false);
4376 if (!(flags & ImGuiWindowFlags_NoResize))
4390 if (!(flags & ImGuiWindowFlags_NoTitleBar))
4445 if (!(flags & (ImGuiWindowFlags_ChildWindow|ImGuiWindowFlags_Tooltip)) || (flags & ImGuiWindowFlags_Popup))
4449 if (!(flags & ImGuiWindowFlags_NoTitleBar))
4452 if (!(flags & ImGuiWindowFlags_NoCollapse))
4460 const float PAD = 2.0f;
4475 text_min.
x += pad_left;
4476 text_max.
x -= pad_right;
4499 const float border_size = window->
BorderSize;
4502 clip_rect.
Min.
x = ImFloor(0.5f + title_bar_rect.
Min.
x + ImMax(border_size, ImFloor(window->
WindowPadding.
x*0.5f)));
4509 if (first_begin_of_the_frame)
4516 if (flags & ImGuiWindowFlags_ChildWindow)
4529 if (style.
Alpha <= 0.0f)
4555 CheckStacksSize(window,
false);
4564 static void Scrollbar(
ImGuiWindow* window,
bool horizontal)
4568 const ImGuiID id = window->
GetID(horizontal ?
"#SCROLLX" :
"#SCROLLY");
4572 float other_scrollbar_size_w = other_scrollbar ? style.
ScrollbarSize : 0.0f;
4574 const float border_size = window->
BorderSize;
4577 : ImRect(window_rect.
Max.
x - style.
ScrollbarSize, window->
Pos.
y + border_size, window_rect.
Max.
x - border_size, window_rect.
Max.
y - other_scrollbar_size_w - border_size);
4584 int window_rounding_corners;
4590 bb.
Expand(
ImVec2(-ImClamp((
float)(
int)((bb.
Max.
x - bb.
Min.
x - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp((
float)(
int)((bb.
Max.
y - bb.
Min.
y - 2.0f) * 0.5f), 0.0f, 3.0f)));
4594 float scroll_v = horizontal ? window->
Scroll.
x : window->
Scroll.
y;
4595 float win_size_avail_v = (horizontal ? window->
SizeFull.
x : window->
SizeFull.
y) - other_scrollbar_size_w;
4600 IM_ASSERT(ImMax(win_size_contents_v, win_size_avail_v) > 0.0f);
4601 const float win_size_v = ImMax(ImMax(win_size_contents_v, win_size_avail_v), 1.0f);
4602 const float grab_h_pixels = ImClamp(scrollbar_size_v * (win_size_avail_v / win_size_v), style.
GrabMinSize, scrollbar_size_v);
4603 const float grab_h_norm = grab_h_pixels / scrollbar_size_v;
4607 bool hovered =
false;
4608 const bool previously_held = (g.
ActiveId == id);
4611 float scroll_max = ImMax(1.0f, win_size_contents_v - win_size_avail_v);
4612 float scroll_ratio = ImSaturate(scroll_v / scroll_max);
4613 float grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v;
4614 if (held && grab_h_norm < 1.0f)
4616 float scrollbar_pos_v = horizontal ? bb.
Min.
x : bb.
Min.
y;
4621 const float clicked_v_norm = ImSaturate((mouse_pos_v - scrollbar_pos_v) / scrollbar_size_v);
4624 bool seek_absolute =
false;
4625 if (!previously_held)
4628 if (clicked_v_norm >= grab_v_norm && clicked_v_norm <= grab_v_norm + grab_h_norm)
4630 *click_delta_to_grab_center_v = clicked_v_norm - grab_v_norm - grab_h_norm*0.5f;
4634 seek_absolute =
true;
4635 *click_delta_to_grab_center_v = 0.0f;
4641 const float scroll_v_norm = ImSaturate((clicked_v_norm - *click_delta_to_grab_center_v - grab_h_norm*0.5f) / (1.0f - grab_h_norm));
4642 scroll_v = (float)(
int)(0.5f + scroll_v_norm * scroll_max);
4649 scroll_ratio = ImSaturate(scroll_v / scroll_max);
4650 grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v;
4654 *click_delta_to_grab_center_v = clicked_v_norm - grab_v_norm - grab_h_norm*0.5f;
4711 const float w_item_one = ImMax(1.0f, (
float)(
int)((w_full - (style.
ItemInnerSpacing.
x) * (components-1)) / (
float)components));
4712 const float w_item_last = ImMax(1.0f, (
float)(
int)(w_full - (w_item_one + style.
ItemInnerSpacing.
x) * (components-1)));
4714 for (
int i = 0; i < components-1; i++)
4734 w = ImMax(1.0f, width_to_right_edge + w);
4740 static ImFont* GetDefaultFont()
4746 static void SetCurrentFont(
ImFont* font)
4761 font = GetDefaultFont();
4762 SetCurrentFont(font);
4885 return &GStyleVarInfo[idx];
5023 return window->
Size.
x;
5029 return window->
Size.
y;
5039 static void SetWindowScrollY(
ImGuiWindow* window,
float new_scroll_y)
5042 window->
Scroll.
y = new_scroll_y;
5065 SetWindowPos(window, pos, cond);
5071 SetWindowPos(window, pos, cond);
5077 return window->
Size;
5119 SetWindowSize(window, size, cond);
5154 SetWindowCollapsed(window, collapsed, cond);
5183 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS 5299 return GImGui->
Font;
5420 IM_ASSERT(center_y_ratio >= 0.0f && center_y_ratio <= 1.0f);
5422 if (center_y_ratio <= 0.0f && window->ScrollTarget.y <= window->
WindowPadding.
y)
5469 va_start(args, fmt);
5484 va_start(args, fmt);
5499 va_start(args, fmt);
5515 va_start(args, fmt);
5528 const char* text_begin = text;
5529 if (text_end == NULL)
5530 text_end = text + strlen(text);
5533 const bool wrap_enabled = wrap_pos_x >= 0.0f;
5534 if (text_end - text > 2000 && !wrap_enabled)
5540 const char* line = text;
5546 if (text_pos.
y <= clip_rect.
Max.
y)
5553 int lines_skippable = (int)((clip_rect.
Min.
y - text_pos.
y) / line_height);
5554 if (lines_skippable > 0)
5556 int lines_skipped = 0;
5557 while (line < text_end && lines_skipped < lines_skippable)
5559 const char* line_end = strchr(line,
'\n');
5561 line_end = text_end;
5562 line = line_end + 1;
5565 pos.
y += lines_skipped * line_height;
5570 if (line < text_end)
5572 ImRect line_rect(pos, pos +
ImVec2(FLT_MAX, line_height));
5573 while (line < text_end)
5575 const char* line_end = strchr(line,
'\n');
5580 text_size.
x = ImMax(text_size.
x, line_size.
x);
5583 line_end = text_end;
5584 line = line_end + 1;
5585 line_rect.
Min.
y += line_height;
5586 line_rect.
Max.
y += line_height;
5587 pos.
y += line_height;
5591 int lines_skipped = 0;
5592 while (line < text_end)
5594 const char* line_end = strchr(line,
'\n');
5596 line_end = text_end;
5597 line = line_end + 1;
5600 pos.
y += lines_skipped * line_height;
5603 text_size.
y += (pos - text_pos).y;
5606 ImRect bb(text_pos, text_pos + text_size);
5617 ImRect bb(text_pos, text_pos + text_size);
5658 const char* value_text_begin = &g.
TempBuffer[0];
5661 if (label_size.
x > 0.0f)
5668 va_start(args, fmt);
5680 if (out_hovered) *out_hovered =
false;
5681 if (out_held) *out_held =
false;
5694 bool pressed =
false;
5753 hovered = pressed = held =
false;
5755 if (out_hovered) *out_hovered = hovered;
5756 if (out_held) *out_held = held;
5777 const ImRect bb(pos, pos + size);
5800 return ButtonEx(label, size_arg, 0);
5850 const float cross_extent = (radius * 0.7071f) - 1.0f;
5867 if (border_col.
w > 0.0f)
5873 if (border_col.
w > 0.0f)
5899 PushID((
void *)user_texture_id);
5903 const ImVec2 padding = (frame_padding >= 0) ?
ImVec2((
float)frame_padding, (float)frame_padding) : style.
FramePadding;
5916 if (bg_col.
w > 0.0f)
6011 const bool log_to_clipboard =
Button(
"Log To Clipboard");
SameLine();
6024 if (log_to_clipboard)
6044 storage->
SetInt(
id, is_open);
6049 const int stored_value = storage->
GetInt(
id, -1);
6050 if (stored_value == -1)
6053 storage->
SetInt(
id, is_open);
6057 is_open = stored_value != 0;
6101 const float text_offset_x = (g.
FontSize + (display_frame ? padding.
x*3 : padding.
x*2));
6102 const float text_width = g.
FontSize + (label_size.
x > 0.0f ? label_size.
x + padding.
x*2 : 0.0f);
6109 if (!
ItemAdd(interact_bb, &
id))
6124 bool hovered, held, pressed =
ButtonBehavior(interact_bb,
id, &hovered, &held, button_flags);
6130 if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick)
6143 const ImVec2 text_pos = bb.
Min +
ImVec2(text_offset_x, padding.
y + text_base_offset_y);
6152 const char log_prefix[] =
"\n##";
6153 const char log_suffix[] =
"##";
6154 LogRenderedText(&text_pos, log_prefix, log_prefix+3);
6156 LogRenderedText(&text_pos, log_suffix+1, log_suffix+3);
6171 else if (!(flags & ImGuiTreeNodeFlags_Leaf))
6174 LogRenderedText(&text_pos,
">");
6175 RenderText(text_pos, label, label_end,
false);
6200 if (p_open && !*p_open)
6209 float button_sz = g.
FontSize * 0.5f;
6261 va_start(args, fmt);
6262 bool is_open =
TreeNodeExV(str_id, flags, fmt, args);
6270 va_start(args, fmt);
6271 bool is_open =
TreeNodeExV(ptr_id, flags, fmt, args);
6279 va_start(args, fmt);
6288 va_start(args, fmt);
6342 const void* ptr_id = (
void*)(intptr_t)int_id;
6418 va_start(args, fmt);
6423 static inline void DataTypeFormatString(
ImGuiDataType data_type,
void* data_ptr,
const char* display_format,
char* buf,
int buf_size)
6428 ImFormatString(buf, buf_size, display_format, *(
float*)data_ptr);
6431 static inline void DataTypeFormatString(
ImGuiDataType data_type,
void* data_ptr,
int decimal_precision,
char* buf,
int buf_size)
6435 if (decimal_precision < 0)
6438 ImFormatString(buf, buf_size,
"%.*d", decimal_precision, *(
int*)data_ptr);
6442 if (decimal_precision < 0)
6445 ImFormatString(buf, buf_size,
"%.*f", decimal_precision, *(
float*)data_ptr);
6449 static void DataTypeApplyOp(
ImGuiDataType data_type,
int op,
void* value1,
const void* value2)
6454 *(
int*)value1 = *(
int*)value1 + *(
const int*)value2;
6456 *(
int*)value1 = *(
int*)value1 - *(
const int*)value2;
6461 *(
float*)value1 = *(
float*)value1 + *(
const float*)value2;
6463 *(
float*)value1 = *(
float*)value1 - *(
const float*)value2;
6468 static bool DataTypeApplyOpFromText(
const char* buf,
const char* initial_value_buf,
ImGuiDataType data_type,
void* data_ptr,
const char* scalar_format)
6470 while (ImCharIsSpace(*buf))
6476 if (op ==
'+' || op ==
'*' || op ==
'/')
6479 while (ImCharIsSpace(*buf))
6492 scalar_format =
"%d";
6493 int* v = (
int*)data_ptr;
6494 const int old_v = *v;
6496 if (op && sscanf(initial_value_buf, scalar_format, &arg0i) < 1)
6501 if (op ==
'+') {
if (sscanf(buf,
"%f", &arg1f) == 1) *v = (
int)(arg0i + arg1f); }
6502 else if (op ==
'*') {
if (sscanf(buf,
"%f", &arg1f) == 1) *v = (
int)(arg0i * arg1f); }
6503 else if (op ==
'/') {
if (sscanf(buf,
"%f", &arg1f) == 1 && arg1f != 0.0f) *v = (
int)(arg0i / arg1f); }
6504 else {
if (sscanf(buf, scalar_format, &arg0i) == 1) *v = arg0i; }
6505 return (old_v != *v);
6510 scalar_format =
"%f";
6511 float* v = (
float*)data_ptr;
6512 const float old_v = *v;
6514 if (op && sscanf(initial_value_buf, scalar_format, &arg0f) < 1)
6518 if (sscanf(buf, scalar_format, &arg1f) < 1)
6520 if (op ==
'+') { *v = arg0f + arg1f; }
6521 else if (op ==
'*') { *v = arg0f * arg1f; }
6522 else if (op ==
'/') {
if (arg1f != 0.0f) *v = arg0f / arg1f; }
6523 else { *v = arg1f; }
6524 return (old_v != *v);
6544 DataTypeFormatString(data_type, data_ptr, decimal_precision, buf,
IM_ARRAYSIZE(buf));
6552 if (text_value_changed)
6560 int precision = default_precision;
6561 while ((fmt = strchr(fmt,
'%')) != NULL)
6564 if (fmt[0] ==
'%') { fmt++;
continue; }
6565 while (*fmt >=
'0' && *fmt <=
'9')
6569 fmt = ImAtoi(fmt + 1, &precision);
6570 if (precision < 0 || precision > 10)
6571 precision = default_precision;
6573 if (*fmt ==
'e' || *fmt ==
'E')
6580 static float GetMinimumStepAtDecimalPrecision(
int decimal_precision)
6582 static const float min_steps[10] = { 1.0f, 0.1f, 0.01f, 0.001f, 0.0001f, 0.00001f, 0.000001f, 0.0000001f, 0.00000001f, 0.000000001f };
6583 return (decimal_precision >= 0 && decimal_precision < 10) ? min_steps[decimal_precision] : powf(10.0f, (
float)-decimal_precision);
6591 if (decimal_precision < 0)
6593 const float min_step = GetMinimumStepAtDecimalPrecision(decimal_precision);
6594 bool negative = value < 0.0f;
6595 value = fabsf(value);
6596 float remainder = fmodf(value, min_step);
6597 if (remainder <= min_step*0.5f)
6600 value += (min_step - remainder);
6601 return negative ? -value : value;
6604 static inline float SliderBehaviorCalcRatioFromValue(
float v,
float v_min,
float v_max,
float power,
float linear_zero_pos)
6609 const bool is_non_linear = (power < 1.0f-0.00001f) || (power > 1.0f+0.00001f);
6610 const float v_clamped = (v_min < v_max) ? ImClamp(v, v_min, v_max) : ImClamp(v, v_max, v_min);
6613 if (v_clamped < 0.0f)
6615 const float f = 1.0f - (v_clamped - v_min) / (ImMin(0.0f,v_max) - v_min);
6616 return (1.0f - powf(f, 1.0f/power)) * linear_zero_pos;
6620 const float f = (v_clamped - ImMax(0.0f,v_min)) / (v_max - ImMax(0.0f,v_min));
6621 return linear_zero_pos + powf(f, 1.0f/power) * (1.0f - linear_zero_pos);
6626 return (v_clamped - v_min) / (v_max - v_min);
6638 const bool is_non_linear = (power < 1.0f-0.00001f) || (power > 1.0f+0.00001f);
6641 const float grab_padding = 2.0f;
6642 const float slider_sz = is_horizontal ? (frame_bb.
GetWidth() - grab_padding * 2.0f) : (frame_bb.
GetHeight() - grab_padding * 2.0f);
6644 if (decimal_precision != 0)
6647 grab_sz = ImMin(ImMax(1.0f * (slider_sz / ((v_min < v_max ? v_max - v_min : v_min - v_max) + 1.0f)), style.
GrabMinSize), slider_sz);
6648 const float slider_usable_sz = slider_sz - grab_sz;
6649 const float slider_usable_pos_min = (is_horizontal ? frame_bb.
Min.
x : frame_bb.
Min.
y) + grab_padding + grab_sz*0.5f;
6650 const float slider_usable_pos_max = (is_horizontal ? frame_bb.
Max.
x : frame_bb.
Max.
y) - grab_padding - grab_sz*0.5f;
6653 float linear_zero_pos = 0.0f;
6654 if (v_min * v_max < 0.0f)
6657 const float linear_dist_min_to_0 = powf(fabsf(0.0f - v_min), 1.0f/power);
6658 const float linear_dist_max_to_0 = powf(fabsf(v_max - 0.0f), 1.0f/power);
6659 linear_zero_pos = linear_dist_min_to_0 / (linear_dist_min_to_0+linear_dist_max_to_0);
6664 linear_zero_pos = v_min < 0.0f ? 1.0f : 0.0f;
6668 bool value_changed =
false;
6671 bool set_new_value =
false;
6672 float clicked_t = 0.0f;
6676 clicked_t = (slider_usable_sz > 0.0f) ? ImClamp((mouse_abs_pos - slider_usable_pos_min) / slider_usable_sz, 0.0f, 1.0f) : 0.0f;
6678 clicked_t = 1.0f - clicked_t;
6679 set_new_value =
true;
6692 if (clicked_t < linear_zero_pos)
6695 float a = 1.0f - (clicked_t / linear_zero_pos);
6697 new_value = ImLerp(ImMin(v_max,0.0f), v_min, a);
6703 if (fabsf(linear_zero_pos - 1.0f) > 1.e-6f)
6704 a = (clicked_t - linear_zero_pos) / (1.0f - linear_zero_pos);
6708 new_value = ImLerp(ImMax(v_min,0.0f), v_max, a);
6714 new_value = ImLerp(v_min, v_max, clicked_t);
6718 new_value =
RoundScalar(new_value, decimal_precision);
6719 if (*v != new_value)
6722 value_changed =
true;
6728 float grab_t = SliderBehaviorCalcRatioFromValue(*v, v_min, v_max, power, linear_zero_pos);
6730 grab_t = 1.0f - grab_t;
6731 const float grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t);
6734 grab_bb =
ImRect(
ImVec2(grab_pos - grab_sz*0.5f, frame_bb.
Min.
y + grab_padding),
ImVec2(grab_pos + grab_sz*0.5f, frame_bb.
Max.
y - grab_padding));
6736 grab_bb =
ImRect(
ImVec2(frame_bb.
Min.
x + grab_padding, grab_pos - grab_sz*0.5f),
ImVec2(frame_bb.
Max.
x - grab_padding, grab_pos + grab_sz*0.5f));
6739 return value_changed;
6747 bool ImGui::SliderFloat(
const char* label,
float* v,
float v_min,
float v_max,
const char* display_format,
float power)
6770 if (!display_format)
6771 display_format =
"%.3f";
6775 bool start_text_input =
false;
6781 if (tab_focus_requested || g.
IO.
KeyCtrl)
6783 start_text_input =
true;
6792 const bool value_changed =
SliderBehavior(frame_bb,
id, v, v_min, v_max, power, decimal_precision);
6799 if (label_size.
x > 0.0f)
6802 return value_changed;
6805 bool ImGui::VSliderFloat(
const char* label,
const ImVec2& size,
float* v,
float v_min,
float v_max,
const char* display_format,
float power)
6824 if (!display_format)
6825 display_format =
"%.3f";
6842 if (label_size.
x > 0.0f)
6845 return value_changed;
6850 float v_deg = (*v_rad) * 360.0f / (2*
IM_PI);
6851 bool value_changed =
SliderFloat(label, &v_deg, v_degrees_min, v_degrees_max,
"%.0f deg", 1.0f);
6852 *v_rad = v_deg * (2*
IM_PI) / 360.0f;
6853 return value_changed;
6856 bool ImGui::SliderInt(
const char* label,
int* v,
int v_min,
int v_max,
const char* display_format)
6858 if (!display_format)
6859 display_format =
"%.0f";
6860 float v_f = (float)*v;
6861 bool value_changed =
SliderFloat(label, &v_f, (
float)v_min, (
float)v_max, display_format, 1.0f);
6863 return value_changed;
6868 if (!display_format)
6869 display_format =
"%.0f";
6870 float v_f = (float)*v;
6871 bool value_changed =
VSliderFloat(label, size, &v_f, (
float)v_min, (
float)v_max, display_format, 1.0f);
6873 return value_changed;
6877 bool ImGui::SliderFloatN(
const char* label,
float* v,
int components,
float v_min,
float v_max,
const char* display_format,
float power)
6884 bool value_changed =
false;
6888 for (
int i = 0; i < components; i++)
6891 value_changed |=
SliderFloat(
"##v", &v[i], v_min, v_max, display_format, power);
6901 return value_changed;
6904 bool ImGui::SliderFloat2(
const char* label,
float v[2],
float v_min,
float v_max,
const char* display_format,
float power)
6906 return SliderFloatN(label, v, 2, v_min, v_max, display_format, power);
6909 bool ImGui::SliderFloat3(
const char* label,
float v[3],
float v_min,
float v_max,
const char* display_format,
float power)
6911 return SliderFloatN(label, v, 3, v_min, v_max, display_format, power);
6914 bool ImGui::SliderFloat4(
const char* label,
float v[4],
float v_min,
float v_max,
const char* display_format,
float power)
6916 return SliderFloatN(label, v, 4, v_min, v_max, display_format, power);
6919 bool ImGui::SliderIntN(
const char* label,
int* v,
int components,
int v_min,
int v_max,
const char* display_format)
6926 bool value_changed =
false;
6930 for (
int i = 0; i < components; i++)
6933 value_changed |=
SliderInt(
"##v", &v[i], v_min, v_max, display_format);
6943 return value_changed;
6946 bool ImGui::SliderInt2(
const char* label,
int v[2],
int v_min,
int v_max,
const char* display_format)
6948 return SliderIntN(label, v, 2, v_min, v_max, display_format);
6951 bool ImGui::SliderInt3(
const char* label,
int v[3],
int v_min,
int v_max,
const char* display_format)
6953 return SliderIntN(label, v, 3, v_min, v_max, display_format);
6956 bool ImGui::SliderInt4(
const char* label,
int v[4],
int v_min,
int v_max,
const char* display_format)
6958 return SliderIntN(label, v, 4, v_min, v_max, display_format);
6970 bool value_changed =
false;
6984 if (v_speed == 0.0f && (v_max - v_min) != 0.0f && (v_max - v_min) < FLT_MAX)
6989 float adjust_delta = 0.0f;
6998 adjust_delta *= v_speed;
7001 if (fabsf(adjust_delta) > 0.0f)
7003 if (fabsf(power - 1.0f) > 0.001f)
7006 float v0_abs = v_cur >= 0.0f ? v_cur : -v_cur;
7007 float v0_sign = v_cur >= 0.0f ? 1.0f : -1.0f;
7008 float v1 = powf(v0_abs, 1.0f / power) + (adjust_delta * v0_sign);
7009 float v1_abs = v1 >= 0.0f ? v1 : -v1;
7010 float v1_sign = v1 >= 0.0f ? 1.0f : -1.0f;
7011 v_cur = powf(v1_abs, power) * v0_sign * v1_sign;
7015 v_cur += adjust_delta;
7020 v_cur = ImClamp(v_cur, v_min, v_max);
7029 value_changed =
true;
7038 return value_changed;
7041 bool ImGui::DragFloat(
const char* label,
float* v,
float v_speed,
float v_min,
float v_max,
const char* display_format,
float power)
7065 if (!display_format)
7066 display_format =
"%.3f";
7070 bool start_text_input =
false;
7078 start_text_input =
true;
7087 const bool value_changed =
DragBehavior(frame_bb,
id, v, v_speed, v_min, v_max, decimal_precision, power);
7094 if (label_size.
x > 0.0f)
7097 return value_changed;
7100 bool ImGui::DragFloatN(
const char* label,
float* v,
int components,
float v_speed,
float v_min,
float v_max,
const char* display_format,
float power)
7107 bool value_changed =
false;
7111 for (
int i = 0; i < components; i++)
7114 value_changed |=
DragFloat(
"##v", &v[i], v_speed, v_min, v_max, display_format, power);
7124 return value_changed;
7127 bool ImGui::DragFloat2(
const char* label,
float v[2],
float v_speed,
float v_min,
float v_max,
const char* display_format,
float power)
7129 return DragFloatN(label, v, 2, v_speed, v_min, v_max, display_format, power);
7132 bool ImGui::DragFloat3(
const char* label,
float v[3],
float v_speed,
float v_min,
float v_max,
const char* display_format,
float power)
7134 return DragFloatN(label, v, 3, v_speed, v_min, v_max, display_format, power);
7137 bool ImGui::DragFloat4(
const char* label,
float v[4],
float v_speed,
float v_min,
float v_max,
const char* display_format,
float power)
7139 return DragFloatN(label, v, 4, v_speed, v_min, v_max, display_format, power);
7142 bool ImGui::DragFloatRange2(
const char* label,
float* v_current_min,
float* v_current_max,
float v_speed,
float v_min,
float v_max,
const char* display_format,
const char* display_format_max,
float power)
7153 bool value_changed =
DragFloat(
"##min", v_current_min, v_speed, (v_min >= v_max) ? -FLT_MAX : v_min, (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max), display_format, power);
7156 value_changed |=
DragFloat(
"##max", v_current_max, v_speed, (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min), (v_min >= v_max) ? FLT_MAX : v_max, display_format_max ? display_format_max : display_format, power);
7164 return value_changed;
7168 bool ImGui::DragInt(
const char* label,
int* v,
float v_speed,
int v_min,
int v_max,
const char* display_format)
7170 if (!display_format)
7171 display_format =
"%.0f";
7172 float v_f = (float)*v;
7173 bool value_changed =
DragFloat(label, &v_f, v_speed, (
float)v_min, (
float)v_max, display_format);
7175 return value_changed;
7178 bool ImGui::DragIntN(
const char* label,
int* v,
int components,
float v_speed,
int v_min,
int v_max,
const char* display_format)
7185 bool value_changed =
false;
7189 for (
int i = 0; i < components; i++)
7192 value_changed |=
DragInt(
"##v", &v[i], v_speed, v_min, v_max, display_format);
7202 return value_changed;
7205 bool ImGui::DragInt2(
const char* label,
int v[2],
float v_speed,
int v_min,
int v_max,
const char* display_format)
7207 return DragIntN(label, v, 2, v_speed, v_min, v_max, display_format);
7210 bool ImGui::DragInt3(
const char* label,
int v[3],
float v_speed,
int v_min,
int v_max,
const char* display_format)
7212 return DragIntN(label, v, 3, v_speed, v_min, v_max, display_format);
7215 bool ImGui::DragInt4(
const char* label,
int v[4],
float v_speed,
int v_min,
int v_max,
const char* display_format)
7217 return DragIntN(label, v, 4, v_speed, v_min, v_max, display_format);
7220 bool ImGui::DragIntRange2(
const char* label,
int* v_current_min,
int* v_current_max,
float v_speed,
int v_min,
int v_max,
const char* display_format,
const char* display_format_max)
7231 bool value_changed =
DragInt(
"##min", v_current_min, v_speed, (v_min >= v_max) ? INT_MIN : v_min, (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max), display_format);
7234 value_changed |=
DragInt(
"##max", v_current_max, v_speed, (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min), (v_min >= v_max) ? INT_MAX : v_max, display_format_max ? display_format_max : display_format);
7242 return value_changed;
7245 void ImGui::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)
7255 if (graph_size.
x == 0.0f)
7257 if (graph_size.
y == 0.0f)
7269 if (scale_min == FLT_MAX || scale_max == FLT_MAX)
7271 float v_min = FLT_MAX;
7272 float v_max = -FLT_MAX;
7273 for (
int i = 0; i < values_count; i++)
7275 const float v = values_getter(data, i);
7276 v_min = ImMin(v_min, v);
7277 v_max = ImMax(v_max, v);
7279 if (scale_min == FLT_MAX)
7281 if (scale_max == FLT_MAX)
7287 if (values_count > 0)
7289 int res_w = ImMin((
int)graph_size.
x, values_count) + ((plot_type ==
ImGuiPlotType_Lines) ? -1 : 0);
7296 const float t = ImClamp((g.
IO.
MousePos.
x - inner_bb.
Min.
x) / (inner_bb.
Max.
x - inner_bb.
Min.
x), 0.0f, 0.9999f);
7297 const int v_idx = (int)(t * item_count);
7298 IM_ASSERT(v_idx >= 0 && v_idx < values_count);
7300 const float v0 = values_getter(data, (v_idx + values_offset) % values_count);
7301 const float v1 = values_getter(data, (v_idx + 1 + values_offset) % values_count);
7303 SetTooltip(
"%d: %8.4g\n%d: %8.4g", v_idx, v0, v_idx+1, v1);
7309 const float t_step = 1.0f / (float)res_w;
7311 float v0 = values_getter(data, (0 + values_offset) % values_count);
7313 ImVec2 tp0 =
ImVec2( t0, 1.0f - ImSaturate((v0 - scale_min) / (scale_max - scale_min)) );
7314 float histogram_zero_line_t = (scale_min * scale_max < 0.0f) ? (-scale_min / (scale_max - scale_min)) : (scale_min < 0.0f ? 0.0f : 1.0f);
7319 for (
int n = 0; n < res_w; n++)
7321 const float t1 = t0 + t_step;
7322 const int v1_idx = (int)(t0 * item_count + 0.5f);
7323 IM_ASSERT(v1_idx >= 0 && v1_idx < values_count);
7324 const float v1 = values_getter(data, (v1_idx + values_offset + 1) % values_count);
7325 const ImVec2 tp1 =
ImVec2( t1, 1.0f - ImSaturate((v1 - scale_min) / (scale_max - scale_min)) );
7332 window->
DrawList->
AddLine(pos0, pos1, v_hovered == v1_idx ? col_hovered : col_base);
7336 if (pos1.
x >= pos0.
x + 2.0f)
7350 if (label_size.
x > 0.0f)
7362 static float Plot_ArrayGetter(
void* data,
int idx)
7365 const float v = *(
float*)(
void*)((
unsigned char*)plot_data->
Values + (
size_t)idx * plot_data->
Stride);
7369 void ImGui::PlotLines(
const char* label,
const float* values,
int values_count,
int values_offset,
const char* overlay_text,
float scale_min,
float scale_max,
ImVec2 graph_size,
int stride)
7372 PlotEx(
ImGuiPlotType_Lines, label, &Plot_ArrayGetter, (
void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);
7375 void ImGui::PlotLines(
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)
7377 PlotEx(
ImGuiPlotType_Lines, label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);
7380 void ImGui::PlotHistogram(
const char* label,
const float* values,
int values_count,
int values_offset,
const char* overlay_text,
float scale_min,
float scale_max,
ImVec2 graph_size,
int stride)
7383 PlotEx(
ImGuiPlotType_Histogram, label, &Plot_ArrayGetter, (
void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);
7386 void ImGui::PlotHistogram(
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)
7408 fraction = ImSaturate(fraction);
7415 char overlay_buf[32];
7419 overlay = overlay_buf;
7423 if (overlay_size.
x > 0.0f)
7424 RenderTextClipped(
ImVec2(ImClamp(fill_br.
x + style.
ItemSpacing.
x, bb.
Min.
x, bb.
Max.
x - overlay_size.
x - style.
ItemInnerSpacing.
x), bb.
Min.
y), bb.
Max, overlay, NULL, &overlay_size,
ImVec2(0.0f,0.5f), &bb);
7441 ImRect total_bb = check_bb;
7442 if (label_size.
x > 0)
7445 if (label_size.
x > 0)
7448 total_bb =
ImRect(ImMin(check_bb.
Min, text_bb.
Min), ImMax(check_bb.
Max, text_bb.
Max));
7463 const float pad = ImMax(1.0f, (
float)(
int)(check_sz / 6.0f));
7468 LogRenderedText(&text_bb.
Min, *v ?
"[x]" :
"[ ]");
7469 if (label_size.
x > 0.0f)
7477 bool v = ((*flags & flags_value) == flags_value);
7478 bool pressed =
Checkbox(label, &v);
7482 *flags |= flags_value;
7484 *flags &= ~flags_value;
7504 ImRect total_bb = check_bb;
7505 if (label_size.
x > 0)
7508 if (label_size.
x > 0)
7511 total_bb.
Add(text_bb);
7518 center.
x = (float)(
int)center.
x + 0.5f;
7519 center.
y = (float)(
int)center.
y + 0.5f;
7520 const float radius = check_bb.
GetHeight() * 0.5f;
7529 const float pad = ImMax(1.0f, (
float)(
int)(check_sz / 6.0f));
7540 LogRenderedText(&text_bb.
Min, active ?
"(x)" :
"( )");
7541 if (label_size.
x > 0.0f)
7549 const bool pressed =
RadioButton(label, *v == v_button);
7557 static int InputTextCalcTextLenAndLineCount(
const char* text_begin,
const char** out_text_end)
7560 const char* s = text_begin;
7561 while (
char c = *s++)
7565 if (s[0] !=
'\n' && s[0] !=
'\r')
7574 const float line_height = GImGui->
FontSize;
7575 const float scale = line_height / font->
FontSize;
7578 float line_width = 0.0f;
7580 const ImWchar* s = text_begin;
7581 while (s < text_end)
7583 unsigned int c = (
unsigned int)(*s++);
7586 text_size.
x = ImMax(text_size.
x, line_width);
7587 text_size.
y += line_height;
7589 if (stop_on_new_line)
7596 const float char_width = font->
GetCharAdvance((
unsigned short)c) * scale;
7597 line_width += char_width;
7600 if (text_size.
x < line_width)
7601 text_size.
x = line_width;
7604 *out_offset =
ImVec2(line_width, text_size.
y + line_height);
7606 if (line_width > 0 || text_size.
y == 0.0f)
7607 text_size.
y += line_height;
7619 static int STB_TEXTEDIT_STRINGLEN(
const STB_TEXTEDIT_STRING* obj) {
return obj->CurLenW; }
7622 static int STB_TEXTEDIT_KEYTOTEXT(
int key) {
return key >= 0x10000 ? 0 : key; }
7623 static ImWchar STB_TEXTEDIT_NEWLINE =
'\n';
7624 static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r,
STB_TEXTEDIT_STRING* obj,
int line_start_idx)
7626 const ImWchar* text = obj->Text.Data;
7627 const ImWchar* text_remaining = NULL;
7628 const ImVec2 size = InputTextCalcTextSizeW(text + line_start_idx, text + obj->CurLenW, &text_remaining, NULL,
true);
7631 r->baseline_y_delta = size.
y;
7634 r->num_chars = (int)(text_remaining - (text + line_start_idx));
7637 static bool is_separator(
unsigned int c) {
return ImCharIsSpace(c) || c==
',' || c==
';' || c==
'(' || c==
')' || c==
'{' || c==
'}' || c==
'[' || c==
']' || c==
'|'; }
7638 static int is_word_boundary_from_right(
STB_TEXTEDIT_STRING* obj,
int idx) {
return idx > 0 ? (is_separator( obj->Text[idx-1] ) && !is_separator( obj->Text[idx] ) ) : 1; }
7639 static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL(
STB_TEXTEDIT_STRING* obj,
int idx) { idx--;
while (idx >= 0 && !is_word_boundary_from_right(obj, idx)) idx--;
return idx < 0 ? 0 : idx; }
7640 #ifdef __APPLE__ // FIXME: Move setting to IO structure 7641 static int is_word_boundary_from_left(
STB_TEXTEDIT_STRING* obj,
int idx) {
return idx > 0 ? (!is_separator( obj->Text[idx-1] ) && is_separator( obj->Text[idx] ) ) : 1; }
7642 static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(
STB_TEXTEDIT_STRING* obj,
int idx) { idx++;
int len = obj->CurLenW;
while (idx < len && !is_word_boundary_from_left(obj, idx)) idx++;
return idx > len ? len : idx; }
7644 static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(
STB_TEXTEDIT_STRING* obj,
int idx) { idx++;
int len = obj->CurLenW;
while (idx < len && !is_word_boundary_from_right(obj, idx)) idx++;
return idx > len ? len : idx; }
7646 #define STB_TEXTEDIT_MOVEWORDLEFT STB_TEXTEDIT_MOVEWORDLEFT_IMPL // They need to be #define for stb_textedit.h 7647 #define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_IMPL 7651 ImWchar* dst = obj->Text.Data + pos;
7658 const ImWchar* src = obj->Text.Data + pos + n;
7666 const int text_len = obj->CurLenW;
7668 if (new_text_len + text_len + 1 > obj->Text.Size)
7672 if (new_text_len_utf8 + obj->CurLenA + 1 > obj->BufSizeA)
7675 ImWchar* text = obj->Text.Data;
7676 if (pos != text_len)
7677 memmove(text + pos + new_text_len, text + pos, (
size_t)(text_len - pos) *
sizeof(
ImWchar));
7678 memcpy(text + pos, new_text, (
size_t)new_text_len *
sizeof(
ImWchar));
7680 obj->CurLenW += new_text_len;
7681 obj->CurLenA += new_text_len_utf8;
7682 obj->Text[obj->CurLenW] =
'\0';
7688 #define STB_TEXTEDIT_K_LEFT 0x10000 // keyboard input to move cursor left 7689 #define STB_TEXTEDIT_K_RIGHT 0x10001 // keyboard input to move cursor right 7690 #define STB_TEXTEDIT_K_UP 0x10002 // keyboard input to move cursor up 7691 #define STB_TEXTEDIT_K_DOWN 0x10003 // keyboard input to move cursor down 7692 #define STB_TEXTEDIT_K_LINESTART 0x10004 // keyboard input to move cursor to start of line 7693 #define STB_TEXTEDIT_K_LINEEND 0x10005 // keyboard input to move cursor to end of line 7694 #define STB_TEXTEDIT_K_TEXTSTART 0x10006 // keyboard input to move cursor to start of text 7695 #define STB_TEXTEDIT_K_TEXTEND 0x10007 // keyboard input to move cursor to end of text 7696 #define STB_TEXTEDIT_K_DELETE 0x10008 // keyboard input to delete selection or character under cursor 7697 #define STB_TEXTEDIT_K_BACKSPACE 0x10009 // keyboard input to delete selection or character left of cursor 7698 #define STB_TEXTEDIT_K_UNDO 0x1000A // keyboard input to perform undo 7699 #define STB_TEXTEDIT_K_REDO 0x1000B // keyboard input to perform redo 7700 #define STB_TEXTEDIT_K_WORDLEFT 0x1000C // keyboard input to move cursor left one word 7701 #define STB_TEXTEDIT_K_WORDRIGHT 0x1000D // keyboard input to move cursor right one word 7702 #define STB_TEXTEDIT_K_SHIFT 0x20000 7704 #define STB_TEXTEDIT_IMPLEMENTATION 7705 #include "stb_textedit.h" 7711 stb_textedit_key(
this, &StbState, key);
7712 CursorFollow =
true;
7721 IM_ASSERT(pos + bytes_count <= BufTextLen);
7722 char* dst = Buf + pos;
7723 const char* src = Buf + pos + bytes_count;
7724 while (
char c = *src++)
7728 if (CursorPos + bytes_count >= pos)
7729 CursorPos -= bytes_count;
7730 else if (CursorPos >= pos)
7732 SelectionStart = SelectionEnd = CursorPos;
7734 BufTextLen -= bytes_count;
7739 const int new_text_len = new_text_end ? (int)(new_text_end - new_text) : (int)strlen(new_text);
7740 if (new_text_len + BufTextLen + 1 >= BufSize)
7743 if (BufTextLen != pos)
7744 memmove(Buf + pos + new_text_len, Buf + pos, (
size_t)(BufTextLen - pos));
7745 memcpy(Buf + pos, new_text, (
size_t)new_text_len *
sizeof(
char));
7746 Buf[BufTextLen + new_text_len] =
'\0';
7748 if (CursorPos >= pos)
7749 CursorPos += new_text_len;
7750 SelectionStart = SelectionEnd = CursorPos;
7752 BufTextLen += new_text_len;
7758 unsigned int c = *p_char;
7760 if (c < 128 && c !=
' ' && !isprint((
int)(c & 0xFF)))
7769 if (c >= 0xE000 && c <= 0xF8FF)
7775 if (!(c >=
'0' && c <=
'9') && (c !=
'.') && (c !=
'-') && (c !=
'+') && (c !=
'*') && (c !=
'/'))
7779 if (!(c >=
'0' && c <=
'9') && !(c >=
'a' && c <= 'f') && !(c >=
'A' && c <=
'F'))
7783 if (c >=
'a' && c <=
'z')
7784 *p_char = (c += (
unsigned int)(
'A'-
'a'));
7787 if (ImCharIsSpace(c))
7797 callback_data.
Flags = flags;
7798 callback_data.
UserData = user_data;
7799 if (callback(&callback_data) != 0)
7879 const bool focus_requested =
FocusableItemRegister(window,
id, (flags & (ImGuiInputTextFlags_CallbackCompletion|ImGuiInputTextFlags_AllowTabInput)) == 0);
7881 const bool focus_requested_by_tab = focus_requested && !focus_requested_by_code;
7883 const bool user_clicked = hovered && io.
MouseClicked[0];
7886 bool clear_active_id =
false;
7889 if (focus_requested || user_clicked || user_scrolled)
7896 const int prev_len_w = edit_state.
CurLenW;
7900 const char* buf_end = NULL;
7902 edit_state.
CurLenA = (int)(buf_end - buf);
7907 const bool recycle_state = (edit_state.
Id == id) && (prev_len_w == edit_state.
CurLenW);
7918 stb_textedit_initialize_state(&edit_state.
StbState, !is_multiline);
7919 if (!is_multiline && focus_requested_by_code)
7923 edit_state.
StbState.insert_mode =
true;
7924 if (!is_multiline && (focus_requested_by_tab || (user_clicked && io.
KeyCtrl)))
7933 clear_active_id =
true;
7936 bool value_changed =
false;
7937 bool enter_pressed =
false;
7945 const char* buf_end = NULL;
7947 edit_state.
CurLenA = (int)(buf_end - buf);
7962 const bool osx_double_click_selects_words = io.
OSXBehaviors;
7963 if (select_all || (hovered && !osx_double_click_selects_words && io.
MouseDoubleClicked[0]))
7976 stb_textedit_click(&edit_state, &edit_state.
StbState, mouse_x, mouse_y);
7981 stb_textedit_drag(&edit_state, &edit_state.
StbState, mouse_x, mouse_y);
7998 if (!InputTextFilterCharacter(&c, flags, callback, user_data))
8009 bool cancel_edit =
false;
8037 if (!is_multiline || (ctrl_enter_for_new_line && !io.
KeyCtrl) || (!ctrl_enter_for_new_line && io.
KeyCtrl))
8039 enter_pressed = clear_active_id =
true;
8041 else if (is_editable)
8043 unsigned int c =
'\n';
8044 if (InputTextFilterCharacter(&c, flags, callback, user_data))
8050 unsigned int c =
'\t';
8051 if (InputTextFilterCharacter(&c, flags, callback, user_data))
8054 else if (IsKeyPressedMap(
ImGuiKey_Escape)) { clear_active_id = cancel_edit =
true; }
8058 else if (is_shortcut_key_only && !is_password && ((IsKeyPressedMap(
ImGuiKey_X) && is_editable) || IsKeyPressedMap(
ImGuiKey_C)) && (!is_multiline || edit_state.
HasSelection()))
8061 const bool cut = IsKeyPressedMap(
ImGuiKey_X);
8077 stb_textedit_cut(&edit_state, &edit_state.
StbState);
8080 else if (is_shortcut_key_only && IsKeyPressedMap(
ImGuiKey_V) && is_editable)
8086 const int clipboard_len = (int)strlen(clipboard);
8088 int clipboard_filtered_len = 0;
8089 for (
const char* s = clipboard; *s; )
8095 if (c >= 0x10000 || !InputTextFilterCharacter(&c, flags, callback, user_data))
8097 clipboard_filtered[clipboard_filtered_len++] = (
ImWchar)c;
8099 clipboard_filtered[clipboard_filtered_len] = 0;
8100 if (clipboard_filtered_len > 0)
8102 stb_textedit_paste(&edit_state, &edit_state.
StbState, clipboard_filtered, clipboard_filtered_len);
8118 value_changed =
true;
8125 if (apply_edit_back_to_user_buffer)
8145 if ((flags & ImGuiInputTextFlags_CallbackCompletion) != 0 && IsKeyPressedMap(
ImGuiKey_Tab))
8150 else if ((flags & ImGuiInputTextFlags_CallbackHistory) != 0 && IsKeyPressedMap(
ImGuiKey_UpArrow))
8155 else if ((flags & ImGuiInputTextFlags_CallbackHistory) != 0 && IsKeyPressedMap(
ImGuiKey_DownArrow))
8168 callback_data.
Flags = flags;
8169 callback_data.
UserData = user_data;
8170 callback_data.
ReadOnly = !is_editable;
8172 callback_data.
EventKey = event_key;
8185 callback(&callback_data);
8208 value_changed =
true;
8214 if (clear_active_id && g.
ActiveId ==
id)
8226 ImVec2 text_size(0.f, 0.f);
8227 const bool is_currently_scrolling = (edit_state.
Id ==
id && is_multiline && g.
ActiveId == draw_window->
GetIDNoKeepAlive(
"#SCROLLY"));
8228 if (g.
ActiveId ==
id || is_currently_scrolling)
8239 ImVec2 cursor_offset, select_start_offset;
8243 const ImWchar* searches_input_ptr[2];
8244 searches_input_ptr[0] = text_begin + edit_state.
StbState.cursor;
8245 searches_input_ptr[1] = NULL;
8246 int searches_remaining = 1;
8247 int searches_result_line_number[2] = { -1, -999 };
8250 searches_input_ptr[1] = text_begin + ImMin(edit_state.
StbState.select_start, edit_state.
StbState.select_end);
8251 searches_result_line_number[1] = -1;
8252 searches_remaining++;
8257 searches_remaining += is_multiline ? 1 : 0;
8259 for (
const ImWchar* s = text_begin; *s != 0; s++)
8263 if (searches_result_line_number[0] == -1 && s >= searches_input_ptr[0]) { searches_result_line_number[0] = line_count;
if (--searches_remaining <= 0)
break; }
8264 if (searches_result_line_number[1] == -1 && s >= searches_input_ptr[1]) { searches_result_line_number[1] = line_count;
if (--searches_remaining <= 0)
break; }
8267 if (searches_result_line_number[0] == -1) searches_result_line_number[0] = line_count;
8268 if (searches_result_line_number[1] == -1) searches_result_line_number[1] = line_count;
8271 cursor_offset.
x = InputTextCalcTextSizeW(
ImStrbolW(searches_input_ptr[0], text_begin), searches_input_ptr[0]).
x;
8272 cursor_offset.
y = searches_result_line_number[0] * g.
FontSize;
8273 if (searches_result_line_number[1] >= 0)
8275 select_start_offset.
x = InputTextCalcTextSizeW(
ImStrbolW(searches_input_ptr[1], text_begin), searches_input_ptr[1]).
x;
8276 select_start_offset.
y = searches_result_line_number[1] * g.
FontSize;
8290 const float scroll_increment_x = size.
x * 0.25f;
8291 if (cursor_offset.
x < edit_state.
ScrollX)
8292 edit_state.
ScrollX = (float)(
int)ImMax(0.0f, cursor_offset.
x - scroll_increment_x);
8293 else if (cursor_offset.
x - size.
x >= edit_state.
ScrollX)
8294 edit_state.
ScrollX = (float)(
int)(cursor_offset.
x - size.
x + scroll_increment_x);
8304 float scroll_y = draw_window->
Scroll.
y;
8305 if (cursor_offset.
y - g.
FontSize < scroll_y)
8306 scroll_y = ImMax(0.0f, cursor_offset.
y - g.
FontSize);
8307 else if (cursor_offset.
y - size.
y >= scroll_y)
8308 scroll_y = cursor_offset.
y - size.
y;
8310 draw_window->
Scroll.
y = scroll_y;
8320 const ImWchar* text_selected_begin = text_begin + ImMin(edit_state.
StbState.select_start, edit_state.
StbState.select_end);
8321 const ImWchar* text_selected_end = text_begin + ImMax(edit_state.
StbState.select_start, edit_state.
StbState.select_end);
8323 float bg_offy_up = is_multiline ? 0.0f : -1.0f;
8324 float bg_offy_dn = is_multiline ? 0.0f : 2.0f;
8326 ImVec2 rect_pos = render_pos + select_start_offset - render_scroll;
8327 for (
const ImWchar* p = text_selected_begin; p < text_selected_end; )
8331 if (rect_pos.
y < clip_rect.
y)
8333 while (p < text_selected_end)
8339 ImVec2 rect_size = InputTextCalcTextSizeW(p, text_selected_end, &p, NULL,
true);
8340 if (rect_size.
x <= 0.0f) rect_size.
x = (float)(
int)(g.
Font->
GetCharAdvance((
unsigned short)
' ') * 0.50f);
8346 rect_pos.
x = render_pos.
x - render_scroll.x;
8355 ImVec2 cursor_screen_pos = render_pos + cursor_offset - render_scroll;
8356 ImRect cursor_screen_rect(cursor_screen_pos.
x, cursor_screen_pos.
y-g.
FontSize+0.5f, cursor_screen_pos.
x+1.0f, cursor_screen_pos.
y-1.5f);
8357 if (cursor_is_visible && cursor_screen_rect.
Overlaps(clip_rect))
8367 const char* buf_end = NULL;
8369 text_size =
ImVec2(size.
x, InputTextCalcTextLenAndLineCount(buf_display, &buf_end) * g.
FontSize);
8385 LogRenderedText(&render_pos, buf_display, NULL);
8387 if (label_size.
x > 0)
8391 return enter_pressed;
8393 return value_changed;
8399 return InputTextEx(label, buf, (
int)buf_size,
ImVec2(0,0), flags, callback, user_data);
8407 static inline float SmallSquareSize()
8426 const ImVec2 button_sz =
ImVec2(SmallSquareSize(), SmallSquareSize());
8431 DataTypeFormatString(data_type, data_ptr, scalar_format, buf,
IM_ARRAYSIZE(buf));
8433 bool value_changed =
false;
8447 DataTypeApplyOp(data_type,
'-', data_ptr, g.
IO.
KeyCtrl && step_fast_ptr ? step_fast_ptr : step_ptr);
8448 value_changed =
true;
8453 DataTypeApplyOp(data_type,
'+', data_ptr, g.
IO.
KeyCtrl && step_fast_ptr ? step_fast_ptr : step_ptr);
8454 value_changed =
true;
8459 if (label_size.
x > 0)
8467 return value_changed;
8472 char display_format[16];
8473 if (decimal_precision < 0)
8474 strcpy(display_format,
"%f");
8477 return InputScalarEx(label,
ImGuiDataType_Float, (
void*)v, (
void*)(step>0.0f ? &step : NULL), (
void*)(step_fast>0.0f ? &step_fast : NULL), display_format, extra_flags);
8484 return InputScalarEx(label,
ImGuiDataType_Int, (
void*)v, (
void*)(step>0.0f ? &step : NULL), (
void*)(step_fast>0.0f ? &step_fast : NULL), scalar_format, extra_flags);
8494 bool value_changed =
false;
8498 for (
int i = 0; i < components; i++)
8501 value_changed |=
InputFloat(
"##v", &v[i], 0, 0, decimal_precision, extra_flags);
8512 return value_changed;
8517 return InputFloatN(label, v, 2, decimal_precision, extra_flags);
8522 return InputFloatN(label, v, 3, decimal_precision, extra_flags);
8527 return InputFloatN(label, v, 4, decimal_precision, extra_flags);
8537 bool value_changed =
false;
8541 for (
int i = 0; i < components; i++)
8544 value_changed |=
InputInt(
"##v", &v[i], 0, 0, extra_flags);
8555 return value_changed;
8560 return InputIntN(label, v, 2, extra_flags);
8565 return InputIntN(label, v, 3, extra_flags);
8570 return InputIntN(label, v, 4, extra_flags);
8573 static bool Items_ArrayGetter(
void* data,
int idx,
const char** out_text)
8575 const char*
const* items = (
const char*
const*)data;
8577 *out_text = items[idx];
8581 static bool Items_SingleStringGetter(
void* data,
int idx,
const char** out_text)
8584 const char* items_separated_by_zeros = (
const char*)data;
8585 int items_count = 0;
8586 const char* p = items_separated_by_zeros;
8589 if (idx == items_count)
8602 bool ImGui::Combo(
const char* label,
int* current_item,
const char*
const* items,
int items_count,
int height_in_items)
8604 const bool value_changed =
Combo(label, current_item, Items_ArrayGetter, (
void*)items, items_count, height_in_items);
8605 return value_changed;
8609 bool ImGui::Combo(
const char* label,
int* current_item,
const char* items_separated_by_zeros,
int height_in_items)
8611 int items_count = 0;
8612 const char* p = items_separated_by_zeros;
8618 bool value_changed =
Combo(label, current_item, Items_SingleStringGetter, (
void*)items_separated_by_zeros, items_count, height_in_items);
8619 return value_changed;
8640 const float arrow_size = SmallSquareSize();
8652 if (preview_value != NULL)
8655 if (label_size.
x > 0)
8658 if (pressed && !popup_open)
8667 if (popup_size.
x == 0.0f)
8670 float popup_y1 = frame_bb.
Max.
y;
8676 popup_y2 = frame_bb.
Min.
y;
8705 bool ImGui::Combo(
const char* label,
int* current_item,
bool (*items_getter)(
void*,
int,
const char**),
void* data,
int items_count,
int height_in_items)
8710 const char* preview_text = NULL;
8711 if (*current_item >= 0 && *current_item < items_count)
8712 items_getter(data, *current_item, &preview_text);
8715 if (height_in_items < 0)
8716 height_in_items = 7;
8724 bool value_changed =
false;
8725 for (
int i = 0; i < items_count; i++)
8727 PushID((
void*)(intptr_t)i);
8728 const bool item_selected = (i == *current_item);
8729 const char* item_text;
8730 if (!items_getter(data, i, &item_text))
8731 item_text =
"*Unknown item*";
8734 value_changed =
true;
8743 return value_changed;
8762 ImVec2 size(size_arg.
x != 0.0f ? size_arg.
x : label_size.
x, size_arg.
y != 0.0f ? size_arg.
y : label_size.
y);
8765 ImRect bb(pos, pos + size);
8771 float w_draw = ImMax(label_size.
x, window->
Pos.
x + max_x - window_padding.
x - window->
DC.
CursorPos.
x);
8773 ImRect bb_with_spacing(pos, pos + size_draw);
8774 if (size_arg.
x == 0.0f || (flags & ImGuiSelectableFlags_DrawFillAvailWidth))
8775 bb_with_spacing.
Max.
x += window_padding.
x;
8778 float spacing_L = (float)(
int)(style.
ItemSpacing.
x * 0.5f);
8779 float spacing_U = (float)(
int)(style.
ItemSpacing.
y * 0.5f);
8782 bb_with_spacing.
Min.
x -= spacing_L;
8783 bb_with_spacing.
Min.
y -= spacing_U;
8784 bb_with_spacing.
Max.
x += spacing_R;
8785 bb_with_spacing.
Max.
y += spacing_D;
8786 if (!
ItemAdd(bb_with_spacing, &
id))
8788 if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->
DC.
ColumnsCount > 1)
8799 bool pressed =
ButtonBehavior(bb_with_spacing,
id, &hovered, &held, button_flags);
8800 if (flags & ImGuiSelectableFlags_Disabled)
8804 if (hovered || selected)
8810 if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->
DC.
ColumnsCount > 1)
8828 if (
Selectable(label, *p_selected, flags, size_arg))
8830 *p_selected = !*p_selected;
8856 if (label_size.
x > 0)
8868 if (height_in_items < 0)
8869 height_in_items = ImMin(items_count, 7);
8870 float height_in_items_f = height_in_items < items_count ? (height_in_items + 0.40f) : (height_in_items + 0.00f);
8895 bool ImGui::ListBox(
const char* label,
int* current_item,
const char*
const* items,
int items_count,
int height_items)
8897 const bool value_changed =
ListBox(label, current_item, Items_ArrayGetter, (
void*)items, items_count, height_items);
8898 return value_changed;
8901 bool ImGui::ListBox(
const char* label,
int* current_item,
bool (*items_getter)(
void*,
int,
const char**),
void* data,
int items_count,
int height_in_items)
8907 bool value_changed =
false;
8909 while (clipper.
Step())
8912 const bool item_selected = (i == *current_item);
8913 const char* item_text;
8914 if (!items_getter(data, i, &item_text))
8915 item_text =
"*Unknown item*";
8921 value_changed =
true;
8926 return value_changed;
8929 bool ImGui::MenuItem(
const char* label,
const char* shortcut,
bool selected,
bool enabled)
8943 if (shortcut_size.
x > 0.0f)
8956 bool ImGui::MenuItem(
const char* label,
const char* shortcut,
bool* p_selected,
bool enabled)
8958 if (
MenuItem(label, shortcut, p_selected ? *p_selected :
false, enabled))
8961 *p_selected = !*p_selected;
9045 if (menuset_is_open)
9057 float w = label_size.
x;
9075 if (menuset_is_open)
9078 bool want_open =
false, want_close =
false;
9082 bool moving_within_opened_triangle =
false;
9087 ImRect next_window_rect = next_window->Rect();
9089 ImVec2 tb = (window->
Pos.
x < next_window->Pos.x) ? next_window_rect.
GetTL() : next_window_rect.
GetTR();
9090 ImVec2 tc = (window->
Pos.
x < next_window->Pos.x) ? next_window_rect.
GetBL() : next_window_rect.
GetBR();
9091 float extra = ImClamp(fabsf(ta.
x - tb.
x) * 0.30f, 5.0f, 30.0f);
9092 ta.
x += (window->
Pos.
x < next_window->Pos.x) ? -0.5f : +0.5f;
9093 tb.
y = ta.
y + ImMax((tb.
y - extra) - ta.
y, -100.0f);
9094 tc.
y = ta.
y + ImMin((tc.
y + extra) - ta.
y, +100.0f);
9101 want_open = (!menu_is_open && hovered && !moving_within_opened_triangle) || (!menu_is_open && hovered && pressed);
9103 else if (menu_is_open && pressed && menuset_is_open)
9106 want_open = menu_is_open =
false;
9108 else if (pressed || (hovered && menuset_is_open && !menu_is_open))
9125 menu_is_open |= want_open;
9136 return menu_is_open;
9150 BeginTooltipEx(0,
true);
9153 if (text_end > text)
9163 Text(
"#%02X%02X%02X\nR: %d, G: %d, B: %d\n(%.3f, %.3f, %.3f)", cr, cg, cb, cr, cg, cb, col[0], col[1], col[2]);
9165 Text(
"#%02X%02X%02X%02X\nR:%d, G:%d, B:%d, A:%d\n(%.3f, %.3f, %.3f, %.3f)", cr, cg, cb, ca, cr, cg, cb, ca, col[0], col[1], col[2], col[3]);
9190 for (
float y = p_min.
y + grid_off.
y; y < p_max.
y; y += grid_step, yi++)
9192 float y1 = ImClamp(y, p_min.
y, p_max.
y), y2 = ImMin(y + grid_step, p_max.
y);
9195 for (
float x = p_min.
x + grid_off.
x + (yi & 1) * grid_step; x < p_max.
x; x += grid_step * 2.0f)
9197 float x1 = ImClamp(x, p_min.
x, p_max.
x), x2 = ImMin(x + grid_step, p_max.
x);
9200 int rounding_corners_flags_cell = 0;
9203 rounding_corners_flags_cell &= rounding_corners_flags;
9223 IM_ASSERT(ImIsPowerOfTwo((
int)(flags & ImGuiColorEditFlags__InputsMask)));
9224 IM_ASSERT(ImIsPowerOfTwo((
int)(flags & ImGuiColorEditFlags__DataTypeMask)));
9225 IM_ASSERT(ImIsPowerOfTwo((
int)(flags & ImGuiColorEditFlags__PickerMask)));
9240 float default_size = SmallSquareSize();
9242 size.
x = default_size;
9244 size.
y = default_size;
9256 ImVec4 col_without_alpha(col.
x, col.
y, col.
z, 1.0f);
9257 float grid_step = ImMin(size.
x, size.
y) / 2.99f;
9261 float mid_x = (float)(
int)((bb.
Min.
x + bb.
Max.
x) * 0.5f + 0.5f);
9289 if ((!allow_opt_inputs && !allow_opt_datatype) || !
BeginPopup(
"context"))
9293 if (allow_opt_inputs)
9299 if (allow_opt_datatype)
9306 if (allow_opt_inputs || allow_opt_datatype)
9317 sprintf(buf,
"(%d,%d,%d,%d)", cr, cg, cb, ca);
9320 if (flags & ImGuiColorEditFlags_NoAlpha)
9321 sprintf(buf,
"0x%02X%02X%02X", cr, cg, cb);
9323 sprintf(buf,
"0x%02X%02X%02X%02X", cr, cg, cb, ca);
9337 if ((!allow_opt_picker && !allow_opt_alpha_bar) || !
ImGui::BeginPopup(
"context"))
9340 if (allow_opt_picker)
9344 for (
int picker_type = 0; picker_type < 2; picker_type++)
9363 if (allow_opt_alpha_bar)
9382 const float square_sz = SmallSquareSize();
9389 const int components = alpha ? 4 : 3;
9413 float f[4] = { col[0], col[1], col[2], alpha ? col[3] : 1.0f };
9418 bool value_changed =
false;
9419 bool value_changed_as_float =
false;
9421 if ((flags & (
ImGuiColorEditFlags_RGB | ImGuiColorEditFlags_HSV)) != 0 && (flags & ImGuiColorEditFlags_NoInputs) == 0)
9424 const float w_item_one = ImMax(1.0f, (
float)(
int)((w_items_all - (style.
ItemInnerSpacing.
x) * (components-1)) / (
float)components));
9425 const float w_item_last = ImMax(1.0f, (
float)(
int)(w_items_all - (w_item_one + style.
ItemInnerSpacing.
x) * (components-1)));
9428 const char* ids[4] = {
"##X",
"##Y",
"##Z",
"##W" };
9429 const char* fmt_table_int[3][4] =
9431 {
"%3.0f",
"%3.0f",
"%3.0f",
"%3.0f" },
9432 {
"R:%3.0f",
"G:%3.0f",
"B:%3.0f",
"A:%3.0f" },
9433 {
"H:%3.0f",
"S:%3.0f",
"V:%3.0f",
"A:%3.0f" }
9435 const char* fmt_table_float[3][4] =
9437 {
"%0.3f",
"%0.3f",
"%0.3f",
"%0.3f" },
9438 {
"R:%0.3f",
"G:%0.3f",
"B:%0.3f",
"A:%0.3f" },
9439 {
"H:%0.3f",
"S:%0.3f",
"V:%0.3f",
"A:%0.3f" }
9444 for (
int n = 0; n < components; n++)
9448 if (n + 1 == components)
9450 if (flags & ImGuiColorEditFlags_Float)
9451 value_changed |= value_changed_as_float |=
DragFloat(ids[n], &f[n], 1.0f/255.0f, 0.0f, hdr ? 0.0f : 1.0f, fmt_table_float[fmt_idx][n]);
9453 value_changed |=
DragInt(ids[n], &i[n], 1.0f, 0, hdr ? 0 : 255, fmt_table_int[fmt_idx][n]);
9465 ImFormatString(buf,
IM_ARRAYSIZE(buf),
"#%02X%02X%02X%02X", ImClamp(i[0],0,255), ImClamp(i[1],0,255), ImClamp(i[2],0,255), ImClamp(i[3],0,255));
9467 ImFormatString(buf,
IM_ARRAYSIZE(buf),
"#%02X%02X%02X", ImClamp(i[0],0,255), ImClamp(i[1],0,255), ImClamp(i[2],0,255));
9471 value_changed |=
true;
9473 while (*p ==
'#' || ImCharIsSpace(*p))
9475 i[0] = i[1] = i[2] = i[3] = 0;
9477 sscanf(p,
"%02X%02X%02X%02X", (
unsigned int*)&i[0], (
unsigned int*)&i[1], (
unsigned int*)&i[2], (
unsigned int*)&i[3]);
9479 sscanf(p,
"%02X%02X%02X", (
unsigned int*)&i[0], (
unsigned int*)&i[1], (
unsigned int*)&i[2]);
9486 bool picker_active =
false;
9489 if (!(flags & ImGuiColorEditFlags_NoInputs))
9492 const ImVec4 col_v4(col[0], col[1], col[2], alpha ? col[3] : 1.0f);
9508 picker_active =
true;
9509 if (label != label_display_end)
9532 if (!value_changed_as_float)
9533 for (
int n = 0; n < 4; n++)
9534 f[n] = i[n] / 255.0f;
9535 if (flags & ImGuiColorEditFlags_HSV)
9550 return value_changed;
9555 float col4[4] = { col[0], col[1], col[2], 1.0f };
9558 col[0] = col4[0]; col[1] = col4[1]; col[2] = col4[2];
9585 ImVec2 gradient_extent = gradient_p1 - gradient_p0;
9586 float gradient_inv_length2 = 1.0f / ImLengthSqr(gradient_extent);
9587 for (
ImDrawVert* vert = vert_start; vert < vert_end; vert++)
9589 float d = ImDot(vert->pos - gradient_p0, gradient_extent);
9590 float t = ImClamp(d * gradient_inv_length2, 0.0f, 1.0f);
9618 ColorPickerOptionsPopup(flags, col);
9623 IM_ASSERT(ImIsPowerOfTwo((
int)(flags & ImGuiColorEditFlags__PickerMask)));
9624 if (!(flags & ImGuiColorEditFlags_NoOptions))
9630 float square_sz = SmallSquareSize();
9631 float bars_width = square_sz;
9635 float bars_triangles_half_sz = (float)(
int)(bars_width * 0.20f);
9637 float wheel_thickness = sv_picker_size * 0.08f;
9638 float wheel_r_outer = sv_picker_size * 0.50f;
9639 float wheel_r_inner = wheel_r_outer - wheel_thickness;
9640 ImVec2 wheel_center(picker_pos.
x + (sv_picker_size + bars_width)*0.5f, picker_pos.
y + sv_picker_size*0.5f);
9643 float triangle_r = wheel_r_inner - (int)(sv_picker_size * 0.027f);
9645 ImVec2 triangle_pb =
ImVec2(triangle_r * -0.5f, triangle_r * -0.866025f);
9646 ImVec2 triangle_pc =
ImVec2(triangle_r * -0.5f, triangle_r * +0.866025f);
9651 bool value_changed =
false, value_changed_h =
false, value_changed_sv =
false;
9661 float initial_dist2 = ImLengthSqr(initial_off);
9662 if (initial_dist2 >= (wheel_r_inner-1)*(wheel_r_inner-1) && initial_dist2 <= (wheel_r_outer+1)*(wheel_r_outer+1))
9665 H = atan2f(current_off.
y, current_off.
x) /
IM_PI*0.5f;
9668 value_changed = value_changed_h =
true;
9670 float cos_hue_angle = cosf(-H * 2.0f *
IM_PI);
9671 float sin_hue_angle = sinf(-H * 2.0f * IM_PI);
9672 if (
ImTriangleContainsPoint(triangle_pa, triangle_pb, triangle_pc, ImRotate(initial_off, cos_hue_angle, sin_hue_angle)))
9675 ImVec2 current_off_unrotated = ImRotate(current_off, cos_hue_angle, sin_hue_angle);
9677 current_off_unrotated =
ImTriangleClosestPoint(triangle_pa, triangle_pb, triangle_pc, current_off_unrotated);
9680 V = ImClamp(1.0f - vv, 0.0001f, 1.0f);
9681 S = ImClamp(uu / V, 0.0001f, 1.0f);
9682 value_changed = value_changed_sv =
true;
9694 S = ImSaturate((io.
MousePos.
x - picker_pos.
x) / (sv_picker_size-1));
9695 V = 1.0f - ImSaturate((io.
MousePos.
y - picker_pos.
y) / (sv_picker_size-1));
9696 value_changed = value_changed_sv =
true;
9706 H = ImSaturate((io.
MousePos.
y - picker_pos.
y) / (sv_picker_size-1));
9707 value_changed = value_changed_h =
true;
9718 col[3] = 1.0f - ImSaturate((io.
MousePos.
y - picker_pos.
y) / (sv_picker_size-1));
9719 value_changed =
true;
9723 if (!(flags & ImGuiColorEditFlags_NoSidePreview))
9732 if (label != label_display_end)
9734 if ((flags & ImGuiColorEditFlags_NoSidePreview))
9740 if (!(flags & ImGuiColorEditFlags_NoSidePreview))
9742 ImVec4 col_v4(col[0], col[1], col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : col[3]);
9743 if ((flags & ImGuiColorEditFlags_NoLabel))
9746 if (ref_col != NULL)
9749 ImVec4 ref_col_v4(ref_col[0], ref_col[1], ref_col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : ref_col[3]);
9752 memcpy(col, ref_col, ((flags & ImGuiColorEditFlags_NoAlpha) ? 3 : 4) *
sizeof(
float));
9753 value_changed =
true;
9760 if (value_changed_h || value_changed_sv)
9761 ColorConvertHSVtoRGB(H >= 1.0f ? H - 10 * 1e-6f : H, S > 0.0f ? S : 10*1e-6f, V > 0.0f ? V : 1e-6f, col[0], col[1], col[2]);
9766 PushItemWidth((alpha_bar ? bar1_pos_x : bar0_pos_x) + bars_width - picker_pos.
x);
9781 float new_H, new_S, new_V;
9783 if (new_H <= 0 && H > 0)
9785 if (new_V <= 0 && V != new_V)
9787 else if (new_S <= 0)
9796 const ImU32 hue_colors[6+1] = {
IM_COL32(255,0,0,255),
IM_COL32(255,255,0,255),
IM_COL32(0,255,0,255),
IM_COL32(0,255,255,255),
IM_COL32(0,0,255,255),
IM_COL32(255,0,255,255),
IM_COL32(255,0,0,255) };
9799 if (flags & ImGuiColorEditFlags_PickerHueWheel)
9802 const float aeps = 1.5f / wheel_r_outer;
9803 const int segment_per_arc = ImMax(4, (
int)wheel_r_outer / 12);
9804 for (
int n = 0; n < 6; n++)
9806 const float a0 = (n) /6.0f * 2.0f *
IM_PI - aeps;
9807 const float a1 = (n+1.0f)/6.0f * 2.0f *
IM_PI + aeps;
9809 draw_list->
PathArcTo(wheel_center, (wheel_r_inner + wheel_r_outer)*0.5f, a0, a1, segment_per_arc);
9813 ImVec2 gradient_p0(wheel_center.
x + cosf(a0) * wheel_r_inner, wheel_center.
y + sinf(a0) * wheel_r_inner);
9814 ImVec2 gradient_p1(wheel_center.
x + cosf(a1) * wheel_r_inner, wheel_center.
y + sinf(a1) * wheel_r_inner);
9815 PaintVertsLinearGradientKeepAlpha(draw_list->
_VtxWritePtr - (draw_list->
_VtxCurrentIdx - vert_start_idx), draw_list->
_VtxWritePtr, gradient_p0, gradient_p1, hue_colors[n], hue_colors[n+1]);
9819 float cos_hue_angle = cosf(H * 2.0f *
IM_PI);
9820 float sin_hue_angle = sinf(H * 2.0f * IM_PI);
9821 ImVec2 hue_cursor_pos(wheel_center.
x + cos_hue_angle * (wheel_r_inner+wheel_r_outer)*0.5f, wheel_center.
y + sin_hue_angle * (wheel_r_inner+wheel_r_outer)*0.5f);
9822 float hue_cursor_rad = value_changed_h ? wheel_thickness * 0.65f : wheel_thickness * 0.55f;
9823 int hue_cursor_segments = ImClamp((
int)(hue_cursor_rad / 1.4f), 9, 32);
9824 draw_list->
AddCircleFilled(hue_cursor_pos, hue_cursor_rad, hue_color32, hue_cursor_segments);
9825 draw_list->
AddCircle(hue_cursor_pos, hue_cursor_rad+1,
IM_COL32(128,128,128,255), hue_cursor_segments);
9829 ImVec2 tra = wheel_center + ImRotate(triangle_pa, cos_hue_angle, sin_hue_angle);
9830 ImVec2 trb = wheel_center + ImRotate(triangle_pb, cos_hue_angle, sin_hue_angle);
9831 ImVec2 trc = wheel_center + ImRotate(triangle_pc, cos_hue_angle, sin_hue_angle);
9834 draw_list->
PrimVtx(tra, uv_white, hue_color32);
9835 draw_list->
PrimVtx(trb, uv_white, hue_color32);
9841 sv_cursor_pos = ImLerp(ImLerp(trc, tra, ImSaturate(S)), trb, ImSaturate(1 - V));
9843 else if (flags & ImGuiColorEditFlags_PickerHueBar)
9849 sv_cursor_pos.
x = ImClamp((
float)(
int)(picker_pos.
x + ImSaturate(S) * sv_picker_size + 0.5f), picker_pos.
x + 2, picker_pos.
x + sv_picker_size - 2);
9850 sv_cursor_pos.
y = ImClamp((
float)(
int)(picker_pos.
y + ImSaturate(1 - V) * sv_picker_size + 0.5f), picker_pos.
y + 2, picker_pos.
y + sv_picker_size - 2);
9853 for (
int i = 0; i < 6; ++i)
9854 draw_list->
AddRectFilledMultiColor(
ImVec2(bar0_pos_x, picker_pos.
y + i * (sv_picker_size / 6)),
ImVec2(bar0_pos_x + bars_width, picker_pos.
y + (i + 1) * (sv_picker_size / 6)), hue_colors[i], hue_colors[i], hue_colors[i + 1], hue_colors[i + 1]);
9855 float bar0_line_y = (float)(
int)(picker_pos.
y + H * sv_picker_size + 0.5f);
9857 RenderArrowsForVerticalBar(draw_list,
ImVec2(bar0_pos_x - 1, bar0_line_y),
ImVec2(bars_triangles_half_sz + 1, bars_triangles_half_sz), bars_width + 2.0f);
9861 float sv_cursor_rad = value_changed_sv ? 10.0f : 6.0f;
9862 draw_list->
AddCircleFilled(sv_cursor_pos, sv_cursor_rad, col32_no_alpha, 12);
9863 draw_list->
AddCircle(sv_cursor_pos, sv_cursor_rad+1,
IM_COL32(128,128,128,255), 12);
9869 float alpha = ImSaturate(col[3]);
9870 ImRect bar1_bb(bar1_pos_x, picker_pos.
y, bar1_pos_x + bars_width, picker_pos.
y + sv_picker_size);
9873 float bar1_line_y = (float)(
int)(picker_pos.
y + (1.0f - alpha) * sv_picker_size + 0.5f);
9875 RenderArrowsForVerticalBar(draw_list,
ImVec2(bar1_pos_x - 1, bar1_line_y),
ImVec2(bars_triangles_half_sz + 1, bars_triangles_half_sz), bars_width + 2.0f);
9881 return value_changed;
9906 float x1 = window->
Pos.
x;
9907 float x2 = window->
Pos.
x + window->
Size.
x;
9923 LogRenderedText(NULL,
IM_NEWLINE "--------------------------------");
10017 group_bb.
Max = ImMax(group_bb.
Min, group_bb.
Max);
10019 window->
DC.
CursorPos = group_data.BackupCursorPos;
10023 window->
DC.
IndentX = group_data.BackupIndentX;
10027 if (group_data.AdvanceCursor)
10030 ItemSize(group_bb.
GetSize(), group_data.BackupCurrentLineTextBaseOffset);
10037 if (active_id_within_group)
10060 if (spacing_w < 0.0f) spacing_w = 0.0f;
10135 static float OffsetNormToPixels(
ImGuiWindow* window,
float offset_norm)
10140 static float PixelsToOffsetNorm(
ImGuiWindow* window,
float offset)
10145 static float GetDraggedColumnOffset(
int column_index)
10165 if (column_index < 0)
10178 IM_ASSERT(column_index < window->DC.ColumnsData.Size);
10179 const float t = window->
DC.
ColumnsData[column_index].OffsetNorm;
10188 if (column_index < 0)
10191 IM_ASSERT(column_index < window->DC.ColumnsData.Size);
10194 const float width = preserve_width ?
GetColumnWidth(column_index) : 0.0f;
10198 const float offset_norm = PixelsToOffsetNorm(window, offset);
10202 window->
DC.
ColumnsData[column_index].OffsetNorm = offset_norm;
10204 if (preserve_width)
10211 if (column_index < 0)
10214 return OffsetNormToPixels(window, window->
DC.
ColumnsData[column_index+1].OffsetNorm - window->
DC.
ColumnsData[column_index].OffsetNorm);
10220 if (column_index < 0)
10229 if (column_index < 0)
10245 PushID(0x11223347 + (
id ? 0 : columns_count));
10266 for (
int column_index = 0; column_index < columns_count + 1; column_index++)
10270 const float default_t = column_index / (float)window->
DC.
ColumnsCount;
10278 for (
int column_index = 0; column_index < columns_count; column_index++)
10281 float clip_x2 = ImFloor(0.5f + window->
Pos.
x +
GetColumnOffset(column_index + 1) - 1.0f);
10282 window->
DC.
ColumnsData[column_index].ClipRect =
ImRect(clip_x1, -FLT_MAX, clip_x2, +FLT_MAX);
10310 int dragging_column = -1;
10315 const float column_w = 4.0f;
10320 bool hovered =
false, held =
false;
10324 if (hovered || held)
10329 dragging_column = i;
10334 const float xi = (float)(
int)x;
10339 if (dragging_column != -1)
10341 float x = GetDraggedColumnOffset(dragging_column);
10366 if (columns_count != 1)
10391 PushID(str_id ? str_id :
"#TreePush");
10399 PushID(ptr_id ? ptr_id : (
const void*)
"#TreePush");
10420 Text(
"%s: %s", prefix, (b ?
"true" :
"false"));
10425 Text(
"%s: %d", prefix, v);
10430 Text(
"%s: %d", prefix, v);
10439 Text(fmt, prefix, v);
10443 Text(
"%s: %.3f", prefix, v);
10451 #if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS)) 10452 #undef WIN32_LEAN_AND_MEAN 10453 #define WIN32_LEAN_AND_MEAN 10454 #include <windows.h> 10458 #if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS) 10461 #pragma comment(lib, "user32") 10464 static const char* GetClipboardTextFn_DefaultImpl(
void*)
10468 if (!OpenClipboard(NULL))
10470 HANDLE wbuf_handle = GetClipboardData(CF_UNICODETEXT);
10471 if (wbuf_handle == NULL)
10479 buf_local.
resize(buf_len);
10482 GlobalUnlock(wbuf_handle);
10484 return buf_local.
Data;
10487 static void SetClipboardTextFn_DefaultImpl(
void*,
const char* text)
10489 if (!OpenClipboard(NULL))
10492 HGLOBAL wbuf_handle = GlobalAlloc(GMEM_MOVEABLE, (SIZE_T)wbuf_length *
sizeof(
ImWchar));
10493 if (wbuf_handle == NULL)
10497 GlobalUnlock(wbuf_handle);
10499 SetClipboardData(CF_UNICODETEXT, wbuf_handle);
10506 static const char* GetClipboardTextFn_DefaultImpl(
void*)
10513 static void SetClipboardTextFn_DefaultImpl(
void*,
const char* text)
10517 const char* text_end = text + strlen(text);
10526 #if defined(_WIN32) && !defined(__GNUC__) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS) 10530 #pragma comment(lib, "imm32") 10533 static void ImeSetInputScreenPosFn_DefaultImpl(
int x,
int y)
10537 if (HIMC himc = ImmGetContext(hwnd))
10539 COMPOSITIONFORM cf;
10540 cf.ptCurrentPos.x = x;
10541 cf.ptCurrentPos.y = y;
10542 cf.dwStyle = CFS_FORCE_POSITION;
10543 ImmSetCompositionWindow(himc, &cf);
10549 static void ImeSetInputScreenPosFn_DefaultImpl(
int,
int) {}
10565 static bool show_clip_rects =
true;
10566 ImGui::Checkbox(
"Show clipping rectangles when hovering an ImDrawCmd", &show_clip_rects);
10571 static void NodeDrawList(
ImDrawList* draw_list,
const char* label)
10586 int elem_offset = 0;
10589 if (pcmd->UserCallback)
10591 ImGui::BulletText(
"Callback %p, user_data %p", pcmd->UserCallback, pcmd->UserCallbackData);
10595 bool pcmd_node_open =
ImGui::TreeNode((
void*)(pcmd - draw_list->
CmdBuffer.
begin()),
"Draw %-4d %s vtx, tex = %p, clip_rect = (%.0f,%.0f)..(%.0f,%.0f)", pcmd->ElemCount, draw_list->
IdxBuffer.
Size > 0 ?
"indexed" :
"non-indexed", pcmd->TextureId, pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);
10598 ImRect clip_rect = pcmd->ClipRect;
10600 for (
int i = elem_offset; i < elem_offset + (int)pcmd->ElemCount; i++)
10601 vtxs_rect.
Add(draw_list->
VtxBuffer[idx_buffer ? idx_buffer[i] : i].pos);
10605 if (!pcmd_node_open)
10608 while (clipper.
Step())
10611 char buf[300], *buf_p = buf;
10612 ImVec2 triangles_pos[3];
10613 for (
int n = 0; n < 3; n++, vtx_i++)
10616 triangles_pos[n] = v.
pos;
10617 buf_p += sprintf(buf_p,
"%s %04d { pos = (%8.2f,%8.2f), uv = (%.6f,%.6f), col = %08X }\n", (n == 0) ?
"vtx" :
" ", vtx_i, v.
pos.
x, v.
pos.
y, v.
uv.
x, v.
uv.
y, v.
col);
10621 overlay_draw_list->
AddPolyline(triangles_pos, 3,
IM_COL32(255,255,0,255),
true, 1.0f,
false);
10633 for (
int i = 0; i < windows.
Size; i++)
10634 Funcs::NodeWindow(windows[i],
"Window");
10638 static void NodeWindow(
ImGuiWindow* window,
const char* label)
10642 NodeDrawList(window->
DrawList,
"DrawList");
10655 Funcs::NodeWindows(g.
Windows,
"Windows");
10689 #ifdef IMGUI_INCLUDE_IMGUI_USER_INL 10690 #include "imgui_user.inl"
IMGUI_API bool BeginCombo(const char *label, const char *preview_value, ImVec2 popup_size=ImVec2(0.0f, 0.0f))
void SetNextWindowPosCenter(ImGuiCond cond=0)
void Add(const ImVec2 &rhs)
IMGUI_API void PushStyleVar(ImGuiStyleVar idx, float val)
IMGUI_API void SetNextWindowSize(const ImVec2 &size, ImGuiCond cond=0)
ImRect SetNextWindowSizeConstraintRect
IMGUI_API bool ColorPicker3(const char *label, float col[3], ImGuiColorEditFlags flags=0)
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 0), const ImVec2 &uv1=ImVec2(1, 1), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1), const ImVec4 &border_col=ImVec4(0, 0, 0, 0))
IMGUI_API bool SliderBehavior(const ImRect &frame_bb, ImGuiID id, float *v, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags=0)
ImGuiWindow * RootNonPopupWindow
IMGUI_API void TextColoredV(const ImVec4 &col, const char *fmt, va_list args) IM_FMTLIST(2)
const char *(* GetClipboardTextFn)(void *user_data)
ImGuiCond SetNextWindowCollapsedCond
int FocusIdxTabRequestNext
IMGUI_API float GetCursorPosX()
bool HasSelection() const
void PathStroke(ImU32 col, bool closed, float thickness=1.0f)
IMGUI_API bool IsAnyWindowHovered()
IMGUI_API float * GetFloatRef(ImGuiID key, float default_val=0.0f)
IMGUI_API ImVec2 GetCursorStartPos()
IMGUI_API void SetTooltip(const char *fmt,...) IM_FMTARGS(1)
IMGUI_API void RenderText(ImVec2 pos, const char *text, const char *text_end=NULL, bool hide_text_after_hash=true)
IMGUI_API bool IsMouseReleased(int button)
IMGUI_API void SetNextTreeNodeOpen(bool is_open, ImGuiCond cond=0)
IMGUI_API bool BeginChildFrame(ImGuiID id, const ImVec2 &size, ImGuiWindowFlags extra_flags=0)
IMGUI_API bool RadioButton(const char *label, bool active)
#define STB_TEXTEDIT_K_LINESTART
IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiCond cond=0)
IMGUI_API ImVec2 GetCursorPos()
void(* MemFreeFn)(void *ptr)
ImGuiCond SetWindowPosAllowFlags
IMGUI_API bool BeginPopupContextItem(const char *str_id, int mouse_button=1)
IMGUI_API void SetScrollFromPosY(float pos_y, float center_y_ratio=0.5f)
bool ActiveIdIsJustActivated
IMGUI_API float GetFontSize()
IMGUI_API void AddCircle(const ImVec2 ¢re, float radius, ImU32 col, int num_segments=12, float thickness=1.0f)
ImRect TitleBarRect() const
int ImTextCharFromUtf8(unsigned int *out_char, const char *in_text, const char *in_text_end)
ImGuiCond SetNextTreeNodeOpenCond
IMGUI_API void AddRectFilledMultiColor(const ImVec2 &a, const ImVec2 &b, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left)
IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 0), const ImVec2 &uv1=ImVec2(1, 1), int frame_padding=-1, const ImVec4 &bg_col=ImVec4(0, 0, 0, 0), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1))
IMGUI_API void SetVoidPtr(ImGuiID key, void *val)
float ModalWindowDarkeningRatio
ImGuiWindow * ParentWindow
IMGUI_API void PushColumnClipRect(int column_index=-1)
IMGUI_API void PopTextureID()
ImVec2 ActiveIdClickOffset
IMGUI_API void ColorEditOptionsPopup(const float *col, ImGuiColorEditFlags flags)
IMGUI_API void ProgressBar(float fraction, const ImVec2 &size_arg=ImVec2(-1, 0), const char *overlay=NULL)
IMGUI_API float RoundScalar(float value, int decimal_precision)
IMGUI_API void AddInputCharacter(ImWchar c)
IMGUI_API void SetColumnWidth(int column_index, float width)
IMGUI_API ImGuiStorage * GetStateStorage()
IMGUI_API void PopClipRect()
void OnKeyPressed(int key)
void(* SetClipboardTextFn)(void *user_data, const char *text)
IMGUI_API void DeleteChars(int pos, int bytes_count)
IMGUI_API bool InputTextMultiline(const char *label, char *buf, size_t buf_size, const ImVec2 &size=ImVec2(0, 0), ImGuiInputTextFlags flags=0, ImGuiTextEditCallback callback=NULL, void *user_data=NULL)
IMGUI_API const char * FindRenderedTextEnd(const char *text, const char *text_end=NULL)
int WantCaptureMouseNextFrame
IMGUI_API bool IsRootWindowFocused()
IMGUI_API void ChannelsSetCurrent(int channel_index)
IMGUI_API void PopItemFlag()
IMGUI_API bool IsWindowFocused()
void PathFillConvex(ImU32 col)
IMGUI_API bool InputInt3(const char *label, int v[3], ImGuiInputTextFlags extra_flags=0)
IMGUI_API void SetCursorPos(const ImVec2 &local_pos)
bool ImTriangleContainsPoint(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, const ImVec2 &p)
ImGuiLayoutType LayoutType
void resize(int new_size)
int ImTextStrToUtf8(char *buf, int buf_size, const ImWchar *in_text, const ImWchar *in_text_end)
ImVec2 SetNextWindowContentSizeVal
int ImStrlenW(const ImWchar *str)
IMGUI_API bool IsMouseClicked(int button, bool repeat=false)
IMGUI_API bool IsItemClicked(int mouse_button=0)
IMGUI_API bool IsKeyPressed(int user_key_index, bool repeat=true)
bool SetNextWindowCollapsedVal
float CurveTessellationTol
IMGUI_API void PushMultiItemsWidths(int components, float width_full=0.0f)
IMGUI_API void RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding=0.0f)
bool ActiveIdAllowOverlap
IMGUI_API void Initialize()
IMGUI_API void PopTextWrapPos()
ImVec2 ScrollbarClickDeltaToGrabCenter
ImGuiInputTextFlags Flags
IMGUI_API const ImFontGlyph * FindGlyph(ImWchar c) const
IMGUI_API void CalcListClipping(int items_count, float items_height, int *out_items_display_start, int *out_items_display_end)
IMGUI_API bool IsMouseDown(int button)
ImVector< ImFontGlyph > Glyphs
int FramerateSecPerFrameIdx
IMGUI_API void ClearFreeMemory()
IMGUI_API void AddInputCharactersUTF8(const char *utf8_chars)
IMGUI_API ImVec2 GetItemRectMin()
IMGUI_API bool IsItemActive()
IMGUI_API bool ColorPicker4(const char *label, float col[4], ImGuiColorEditFlags flags=0, const float *ref_col=NULL)
IMGUI_API void * MemAlloc(size_t sz)
IMGUI_API void SetHoveredID(ImGuiID id)
IMGUI_API void append(const char *fmt,...) IM_FMTARGS(2)
ImDrawList OverlayDrawList
int FocusIdxAllRequestCurrent
IMGUI_API void SetNextWindowFocus()
IMGUI_API ImVec2 GetMouseDragDelta(int button=0, float lock_threshold=-1.0f)
IMGUI_API void NewFrame()
IMGUI_API bool IsRootWindowOrAnyChildHovered()
float CalcExtraSpace(float avail_w)
bool BackupActiveIdIsAlive
void ImStrncpy(char *dst, const char *src, int count)
IMGUI_API void EndTooltip()
IMGUI_API bool FocusableItemRegister(ImGuiWindow *window, ImGuiID id, bool tab_stop=true)
IMGUI_API bool InputInt4(const char *label, int v[4], ImGuiInputTextFlags extra_flags=0)
ImVector< ImGuiIniData > Settings
IMGUI_API void LogButtons()
ImGuiID MovedWindowMoveId
float TitleBarHeight() const
IMGUI_API void CaptureMouseFromApp(bool capture=true)
IMGUI_API void PushTextureID(const ImTextureID &texture_id)
int(* ImGuiTextEditCallback)(ImGuiTextEditCallbackData *data)
IMGUI_API void SetScrollHere(float center_y_ratio=0.5f)
float FramerateSecPerFrameAccum
float MouseClickedTime[5]
IMGUI_API void PopAllowKeyboardFocus()
IMGUI_API bool SmallButton(const char *label)
ImVector< ImGuiItemFlags > ItemFlagsStack
IMGUI_API bool IsMouseHoveringRect(const ImVec2 &r_min, const ImVec2 &r_max, bool clip=true)
#define IM_F32_TO_INT8_SAT(_VAL)
IMGUI_API void PushClipRect(const ImVec2 &clip_rect_min, const ImVec2 &clip_rect_max, bool intersect_with_current_clip_rect)
IMGUI_API bool BeginChild(const char *str_id, const ImVec2 &size=ImVec2(0, 0), bool border=false, ImGuiWindowFlags extra_flags=0)
IMGUI_API void PathArcToFast(const ImVec2 ¢re, float radius, int a_min_of_12, int a_max_of_12)
IMGUI_API void ShowMetricsWindow(bool *p_open=NULL)
IMGUI_API bool Draw(const char *label="Filter (inc,-exc)", float width=0.0f)
IMGUI_API void BeginTooltip()
IMGUI_API bool TreeNodeEx(const char *label, ImGuiTreeNodeFlags flags=0)
ImVec2 SetNextWindowSizeVal
IMGUI_API bool IsWindowAppearing()
IMGUI_API bool IsWindowRectHovered()
float KeysDownDuration[512]
#define STB_TEXTEDIT_K_UNDO
void swap(ImVector< T > &rhs)
IMGUI_API bool * GetBoolRef(ImGuiID key, bool default_val=false)
IMGUI_API void Indent(float indent_w=0.0f)
const ImFontGlyph * FallbackGlyph
#define STB_TEXTEDIT_K_TEXTEND
ImGuiColumnsFlags ColumnsFlags
IMGUI_API void AddTriangleFilled(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, ImU32 col)
float BackupCurrentLineTextBaseOffset
#define IM_OFFSETOF(_TYPE, _ELM)
IMGUI_API void PushTextWrapPos(float wrap_pos_x=0.0f)
IMGUI_API void PushButtonRepeat(bool repeat)
ImVec2 SetNextWindowPosVal
ImGuiStorage StateStorage
ImVec2 MouseClickedPos[5]
IMGUI_API void ResetMouseDragDelta(int button=0)
IMGUI_API bool IsWindowHovered()
ImVector< ImDrawList * > RenderDrawLists[3]
bool MouseDoubleClicked[5]
IMGUI_API void BulletTextV(const char *fmt, va_list args) IM_FMTLIST(1)
int ImStricmp(const char *str1, const char *str2)
char * ImStrdup(const char *str)
IMGUI_API ImGuiMouseCursor GetMouseCursor()
IMGUI_API float GetColumnOffset(int column_index=-1)
int ImTextCountUtf8BytesFromStr(const ImWchar *in_text, const ImWchar *in_text_end)
#define STB_TEXTEDIT_K_SHIFT
ImVec2 ImTriangleClosestPoint(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, const ImVec2 &p)
IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char *label, const char *label_end=NULL)
void *(* MemAllocFn)(size_t sz)
IMGUI_API void SetStateStorage(ImGuiStorage *tree)
IMGUI_API void AddLine(const ImVec2 &a, const ImVec2 &b, ImU32 col, float thickness=1.0f)
IMGUI_API void AddPolyline(const ImVec2 *points, const int num_points, ImU32 col, bool closed, float thickness, bool anti_aliased)
IMGUI_API void PushClipRect(ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect=false)
IMGUI_API bool InputText(const char *label, char *buf, size_t buf_size, ImGuiInputTextFlags flags=0, ImGuiTextEditCallback callback=NULL, void *user_data=NULL)
void * GetVarPtr(ImGuiStyle *style) const
bool LastItemRectHoveredRect
IMGUI_API bool TreeNodeV(const char *str_id, const char *fmt, va_list args) IM_FMTLIST(2)
ImVector< ImFont * > Fonts
IMGUI_API ImVec2 GetItemRectSize()
IMGUI_API float GetWindowWidth()
IMGUI_API void ** GetVoidPtrRef(ImGuiID key, void *default_val=NULL)
ImGuiColorEditFlags ColorEditOptions
IMGUI_API void ClosePopup(ImGuiID id)
IMGUI_API bool TreeNode(const char *label)
IMGUI_API ImVec2 GetContentRegionMax()
#define STB_TEXTEDIT_K_REDO
ImVector< ImGuiWindow * > CurrentWindowStack
int KeyMap[ImGuiKey_COUNT]
IMGUI_API bool CheckboxFlags(const char *label, unsigned int *flags, unsigned int flags_value)
ImVector< ImFont * > FontStack
void(* ImeSetInputScreenPosFn)(int x, int y)
IMGUI_API bool ColorEdit4(const char *label, float col[4], ImGuiColorEditFlags flags=0)
IMGUI_API void SetWindowPos(const ImVec2 &pos, ImGuiCond cond=0)
IMGUI_API bool DragBehavior(const ImRect &frame_bb, ImGuiID id, float *v, float v_speed, float v_min, float v_max, int decimal_precision, float power)
IMGUI_API bool BeginMenuBar()
IMGUI_API ImGuiTextFilter(const char *default_filter="")
IMGUI_API void AlignFirstTextHeightToWidgets()
#define STB_TEXTEDIT_K_DOWN
IMGUI_API void PlotHistogram(const char *label, const float *values, int values_count, int values_offset=0, const char *overlay_text=NULL, float scale_min=FLT_MAX, float scale_max=FLT_MAX, ImVec2 graph_size=ImVec2(0, 0), int stride=sizeof(float))
IMGUI_API void MemFree(void *ptr)
IMGUI_API ImGuiContext * CreateContext(void *(*malloc_fn)(size_t)=NULL, void(*free_fn)(void *)=NULL)
IMGUI_API void TextWrappedV(const char *fmt, va_list args) IM_FMTLIST(1)
#define STB_TEXTEDIT_K_LINEEND
#define STB_TEXTEDIT_GETWIDTH_NEWLINE
IMGUI_API bool IsMousePosValid(const ImVec2 *mouse_pos=NULL)
IMGUI_API ImVec2 GetMousePos()
IMGUI_API void BeginColumns(const char *id, int count, ImGuiColumnsFlags flags=0)
ImGuiTextBuffer * LogClipboard
IMGUI_API bool InputFloat3(const char *label, float v[3], int decimal_precision=-1, ImGuiInputTextFlags extra_flags=0)
IMGUI_API bool PassFilter(const char *text, const char *text_end=NULL) const
IMGUI_API bool IsClippedEx(const ImRect &bb, const ImGuiID *id, bool clip_even_when_logged)
IMGUI_API bool BeginPopup(const char *str_id)
ImGuiID GetIDNoKeepAlive(const char *str, const char *str_end=NULL)
ImGuiMouseCursorData MouseCursorData[ImGuiMouseCursor_Count_]
IMGUI_API void SameLine(float pos_x=0.0f, float spacing_w=-1.0f)
ImDrawData RenderDrawData
IMGUI_API void SetMouseCursor(ImGuiMouseCursor type)
IMGUI_API bool SliderFloat2(const char *label, float v[2], float v_min, float v_max, const char *display_format="%.3f", float power=1.0f)
IMGUI_API ImVec2 GetContentRegionAvail()
ImRect MenuBarRect() const
ImGuiCond SetNextWindowSizeCond
ImGuiSimpleColumns MenuColumns
IMGUI_API void CaptureKeyboardFromApp(bool capture=true)
IMGUI_API void RenderRectFilledRangeH(ImDrawList *draw_list, const ImRect &rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding)
bool SetNextTreeNodeOpenVal
float CurrentLineTextBaseOffset
IMGUI_API void SetFloat(ImGuiID key, float val)
ImGuiInputTextFlags EventFlag
float DragSpeedDefaultRatio
IMGUI_API float GetScrollMaxY()
IMGUI_API void SetCurrentContext(ImGuiContext *ctx)
ImFontAtlas * ContainerAtlas
IMGUI_API ImDrawList * GetWindowDrawList()
IMGUI_API bool ItemAdd(const ImRect &bb, const ImGuiID *id)
ImVector< ImGuiWindow * > Windows
IMGUI_API bool Begin(const char *name, bool *p_open=NULL, ImGuiWindowFlags flags=0)
IMGUI_API bool InputInt2(const char *label, int v[2], ImGuiInputTextFlags extra_flags=0)
int WantTextInputNextFrame
IMGUI_API bool IsKeyDown(int user_key_index)
IMGUI_API void PopStyleVar(int count=1)
IMGUI_API void SetScrollY(float scroll_y)
ImVec2 SizeContentsExplicit
IMGUI_API void SetTooltipV(const char *fmt, va_list args) IM_FMTLIST(1)
ImGuiID GetID(const char *str, const char *str_end=NULL)
IMGUI_API ImVec2 CalcTextSize(const char *text, const char *text_end=NULL, bool hide_text_after_double_hash=false, float wrap_width=-1.0f)
IMGUI_API bool CollapsingHeader(const char *label, ImGuiTreeNodeFlags flags=0)
ImGuiStb::STB_TexteditState StbState
IMGUI_API ImVec2 GetWindowContentRegionMin()
IMGUI_API void AddTriangle(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, ImU32 col, float thickness=1.0f)
IMGUI_API bool BeginPopupContextWindow(const char *str_id=NULL, int mouse_button=1, bool also_over_items=true)
IMGUI_API bool ListBoxHeader(const char *label, const ImVec2 &size=ImVec2(0, 0))
IMGUI_API void Dummy(const ImVec2 &size)
IMGUI_API void KeepAliveID(ImGuiID id)
void Expand(const float amount)
IMGUI_API void BulletText(const char *fmt,...) IM_FMTARGS(1)
IMGUI_API bool IsAnyItemHovered()
ImVector< char > TempTextBuffer
int ImTextStrFromUtf8(ImWchar *buf, int buf_size, const char *in_text, const char *in_text_end, const char **in_text_remaining)
const char * ImStristr(const char *haystack, const char *haystack_end, const char *needle, const char *needle_end)
ImFont InputTextPasswordFont
IMGUI_API const char * GetStyleColorName(ImGuiCol idx)
IMGUI_API bool IsMouseDragging(int button=0, float lock_threshold=-1.0f)
void * ImFileLoadToMemory(const char *filename, const char *file_open_mode, int *out_file_size, int padding_bytes)
IMGUI_API ImVec2 GetWindowContentRegionMax()
IMGUI_API bool IsRectVisible(const ImVec2 &size)
IMGUI_API bool SliderIntN(const char *label, int *v, int components, int v_min, int v_max, const char *display_format)
ImGuiTextEditState InputTextState
IMGUI_API void ColorTooltip(const char *text, const float *col, ImGuiColorEditFlags flags)
IMGUI_API void TextUnformatted(const char *text, const char *text_end=NULL)
IMGUI_API void TreePushRawID(ImGuiID id)
IMGUI_API bool DragFloat4(const char *label, float v[4], float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *display_format="%.3f", float power=1.0f)
IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled)
ImU32 ImHash(const void *data, int data_size, ImU32 seed)
float MouseDownDuration[5]
ImVector< ImGuiColMod > ColorModifiers
ImGuiWindow * MovedWindow
IMGUI_API void SetColumnOffset(int column_index, float offset_x)
IMGUI_API void SetNextWindowContentWidth(float width)
IMGUI_API void Unindent(float indent_w=0.0f)
IMGUI_API int GetColumnsCount()
void ClipWith(const ImRect &clip)
IMGUI_API bool InputIntN(const char *label, int *v, int components, ImGuiInputTextFlags extra_flags)
#define IM_COL32(R, G, B, A)
IMGUI_API bool SliderAngle(const char *label, float *v_rad, float v_degrees_min=-360.0f, float v_degrees_max=+360.0f)
IMGUI_API void FocusWindow(ImGuiWindow *window)
ImVector< ImDrawCmd > CmdBuffer
IMGUI_API bool ColorEdit3(const char *label, float col[3], ImGuiColorEditFlags flags=0)
ImGuiWindow * ActiveIdWindow
ImVector< ImGuiStyleMod > StyleModifiers
IMGUI_API void AddText(const ImVec2 &pos, ImU32 col, const char *text_begin, const char *text_end=NULL)
bool Contains(const ImVec2 &p) const
ImRect ContentsRegionRect
ImGuiID HoveredIdPreviousFrame
IMGUI_API bool SliderFloat3(const char *label, float v[3], float v_min, float v_max, const char *display_format="%.3f", float power=1.0f)
IMGUI_API ImVec2 GetMousePosOnOpeningCurrentPopup()
float MouseDoubleClickTime
void(* ImGuiSizeConstraintCallback)(ImGuiSizeConstraintCallbackData *data)
float KeysDownDurationPrev[512]
IMGUI_API ImGuiIO & GetIO()
void ImTriangleBarycentricCoords(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, const ImVec2 &p, float &out_u, float &out_v, float &out_w)
IMGUI_API bool InputScalarAsWidgetReplacement(const ImRect &aabb, const char *label, ImGuiDataType data_type, void *data_ptr, ImGuiID id, int decimal_precision)
IMGUI_API bool DragInt4(const char *label, int v[4], float v_speed=1.0f, int v_min=0, int v_max=0, const char *display_format="%.0f")
IMGUI_API bool InputFloat2(const char *label, float v[2], int decimal_precision=-1, ImGuiInputTextFlags extra_flags=0)
IMGUI_API void LabelTextV(const char *label, const char *fmt, va_list args) IM_FMTLIST(2)
IMGUI_API bool IsRootWindowOrAnyChildFocused()
IMGUI_API bool InputFloat4(const char *label, float v[4], int decimal_precision=-1, ImGuiInputTextFlags extra_flags=0)
IMGUI_API bool IsItemRectHovered()
IMGUI_API ImFont * GetFont()
IMGUI_API void EndGroup()
IMGUI_API float GetTime()
IMGUI_API int GetColumnIndex()
#define IM_F32_TO_INT8_UNBOUND(_VAL)
IMGUI_API void ChannelsMerge()
IMGUI_API bool IsKeyReleased(int user_key_index)
IMGUI_API void LogToFile(int max_depth=-1, const char *filename=NULL)
ImGuiID ActiveIdPreviousFrame
IMGUI_API void VerticalSeparator()
IMGUI_API void SetNextWindowSizeConstraints(const ImVec2 &size_min, const ImVec2 &size_max, ImGuiSizeConstraintCallback custom_callback=NULL, void *custom_callback_data=NULL)
IMGUI_API bool InputFloat(const char *label, float *v, float step=0.0f, float step_fast=0.0f, int decimal_precision=-1, ImGuiInputTextFlags extra_flags=0)
IMGUI_API ImGuiContext * GetCurrentContext()
ImGuiCond SetNextWindowContentSizeCond
void reserve(int new_capacity)
IMGUI_API void SetWindowFocus()
IMGUI_API void EndCombo()
IMGUI_API bool IsWindowCollapsed()
IMGUI_API void SetCursorPosX(float x)
IMGUI_API float GetContentRegionAvailWidth()
IMGUI_API int GetInt(ImGuiID key, int default_val=0) const
int ImTextCountCharsFromUtf8(const char *in_text, const char *in_text_end)
float CalcFontSize() const
IMGUI_API void AddImage(ImTextureID user_texture_id, const ImVec2 &a, const ImVec2 &b, const ImVec2 &uv_a=ImVec2(0, 0), const ImVec2 &uv_b=ImVec2(1, 1), ImU32 col=0xFFFFFFFF)
IMGUI_API void PushItemWidth(float item_width)
IMGUI_API bool Button(const char *label, const ImVec2 &size=ImVec2(0, 0))
ImVec2 ScrollTargetCenterRatio
IMGUI_API void Value(const char *prefix, bool b)
IMGUI_API float GetItemsLineHeightWithSpacing()
ImGuiWindow * HoveredRootWindow
int FocusIdxTabRequestCurrent
IMGUI_API ImGuiWindow * GetParentWindow()
IMGUI_API void Separator()
#define STB_TEXTEDIT_K_DELETE
IMGUI_API void FocusableItemUnregister(ImGuiWindow *window)
IMGUI_API void ItemSize(const ImVec2 &size, float text_offset_y=0.0f)
IMGUI_API void BeginGroup()
bool FontAllowUserScaling
IMGUI_API bool DragFloatRange2(const char *label, float *v_current_min, float *v_current_max, float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *display_format="%.3f", const char *display_format_max=NULL, float power=1.0f)
IMGUI_API bool SliderFloat4(const char *label, float v[4], float v_min, float v_max, const char *display_format="%.3f", float power=1.0f)
IMGUI_API void AddCircleFilled(const ImVec2 ¢re, float radius, ImU32 col, int num_segments=12)
const ImWchar * ImStrbolW(const ImWchar *buf_mid_line, const ImWchar *buf_begin)
ImVector< ImGuiColumnData > ColumnsData
IMGUI_API float GetScrollX()
IMGUI_API void Begin(int items_count, float items_height=-1.0f)
IMGUI_API void RenderCollapseTriangle(ImVec2 pos, bool is_open, float scale=1.0f)
float GetCharAdvance(ImWchar c) const
ImGuiID ScalarAsInputTextId
IMGUI_API bool SliderInt4(const char *label, int v[4], int v_min, int v_max, const char *display_format="%.0f")
IMGUI_API bool DragFloat(const char *label, float *v, float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *display_format="%.3f", float power=1.0f)
#define va_copy(dest, src)
IMGUI_API bool BeginPopupContextVoid(const char *str_id=NULL, int mouse_button=1)
unsigned int _VtxCurrentIdx
IMGUI_API float GetColumnWidth(int column_index=-1)
IMGUI_API ImVec2 GetWindowSize()
IMGUI_API void RenderColorRectWithAlphaCheckerboard(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, float grid_step, ImVec2 grid_off, float rounding=0.0f, int rounding_corners_flags=~0)
float PrevLineTextBaseOffset
void Update(int count, float spacing, bool clear)
IMGUI_API void EndPopup()
IMGUI_API void appendv(const char *fmt, va_list args) IM_FMTLIST(2)
ImVec2 ImLineClosestPoint(const ImVec2 &a, const ImVec2 &b, const ImVec2 &p)
IMGUI_API void RenderCheckMark(ImVec2 pos, ImU32 col)
IMGUI_API float GetTreeNodeToLabelSpacing()
IMGUI_API ImVec2 GetFontTexUvWhitePixel()
#define STB_TEXTEDIT_K_BACKSPACE
IMGUI_API void RenderTextWrapped(ImVec2 pos, const char *text, const char *text_end, float wrap_width)
IMGUI_API void TextV(const char *fmt, va_list args) IM_FMTLIST(1)
IMGUI_API void RenderBullet(ImVec2 pos)
IMGUI_API void NextColumn()
IMGUI_API bool ColorButton(const char *desc_id, const ImVec4 &col, ImGuiColorEditFlags flags=0, ImVec2 size=ImVec2(0, 0))
ImVector< ImGuiPopupRef > OpenPopupStack
float DeclColumns(float w0, float w1, float w2)
IMGUI_API float GetWindowHeight()
float ColumnsStartMaxPosX
IMGUI_API bool ButtonEx(const char *label, const ImVec2 &size_arg=ImVec2(0, 0), ImGuiButtonFlags flags=0)
ImVector< char > PrivateClipboard
#define STB_TEXTEDIT_K_WORDLEFT
IMGUI_API bool DragFloat2(const char *label, float v[2], float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *display_format="%.3f", float power=1.0f)
ImGuiPlotArrayGetterData(const float *values, int stride)
IMGUI_API bool BeginMainMenuBar()
IMGUI_API ImU32 ColorConvertFloat4ToU32(const ImVec4 &in)
ImVec2 DisplaySafeAreaPadding
ImGuiCond SetWindowCollapsedAllowFlags
IMGUI_API bool SliderFloatN(const char *label, float *v, int components, float v_min, float v_max, const char *display_format, float power)
IMGUI_API void PushFont(ImFont *font)
ImGuiWindow * CurrentWindow
IMGUI_API void SetNextWindowPos(const ImVec2 &pos, ImGuiCond cond=0, const ImVec2 &pivot=ImVec2(0, 0))
ImVec2 DisplayWindowPadding
IMGUI_API void SetClipboardText(const char *text)
IMGUI_API bool InvisibleButton(const char *str_id, const ImVec2 &size)
ImGuiWindow(const char *name)
IMGUI_API void SetBool(ImGuiID key, bool val)
int MetricsRenderVertices
IMGUI_API void EndChild()
IMGUI_API float GetWindowContentRegionWidth()
IMGUI_API float GetScrollMaxX()
ImGuiSizeConstraintCallback SetNextWindowSizeConstraintCallback
IMGUI_API bool BeginMenu(const char *label, bool enabled=true)
IMGUI_API float GetTextLineHeightWithSpacing()
IMGUI_API void TextWrapped(const char *fmt,...) IM_FMTARGS(1)
ImGuiCond SetNextWindowPosCond
iterator insert(const_iterator it, const value_type &v)
int LogAutoExpandMaxDepth
bool SetNextWindowSizeConstraint
IMGUI_API void ListBoxFooter()
IMGUI_API void TextColored(const ImVec4 &col, const char *fmt,...) IM_FMTARGS(2)
float FramerateSecPerFrame[120]
ImVec4 Colors[ImGuiCol_COUNT]
IMGUI_API void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border=true, float rounding=0.0f)
void PrimVtx(const ImVec2 &pos, const ImVec2 &uv, ImU32 col)
IMGUI_API float CalcItemWidth()
IMGUI_API void SetInt(ImGuiID key, int val)
ImDrawCallback UserCallback
IMGUI_API int GetKeyPressedAmount(int key_index, float repeat_delay, float rate)
IMGUI_API void Text(const char *fmt,...) IM_FMTARGS(1)
IMGUI_API void DestroyContext(ImGuiContext *ctx)
IMGUI_API void LogToTTY(int max_depth=-1)
float MouseDoubleClickMaxDist
ImDrawVert * _VtxWritePtr
IMGUI_API ImVec2 GetCursorScreenPos()
IMGUI_API ImGuiWindow * FindWindowByName(const char *name)
ImVec2 SetNextWindowPosPivot
IMGUI_API bool DragIntN(const char *label, int *v, int components, float v_speed, int v_min, int v_max, const char *display_format)
int ImFormatStringV(char *buf, int buf_size, const char *fmt, va_list args)
IMGUI_API void Shutdown()
#define STB_TEXTEDIT_K_WORDRIGHT
void(* RenderDrawListsFn)(ImDrawData *data)
IMGUI_API void EndChildFrame()
IMGUI_API bool SliderInt3(const char *label, int v[3], int v_min, int v_max, const char *display_format="%.0f")
IMGUI_API bool SliderInt(const char *label, int *v, int v_min, int v_max, const char *display_format="%.0f")
void push_back(const value_type &v)
ImVector< ImGuiWindow * > WindowsSortBuffer
IMGUI_API void PopItemWidth()
#define STB_TEXTEDIT_K_RIGHT
iterator erase(const_iterator it)
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)
IMGUI_API void PathArcTo(const ImVec2 ¢re, float radius, float a_min, float a_max, int num_segments=10)
IMGUI_API void EndColumns()
int FocusIdxAllRequestNext
IMGUI_API bool InputScalarEx(const char *label, ImGuiDataType data_type, void *data_ptr, void *step_ptr, void *step_fast_ptr, const char *scalar_format, ImGuiInputTextFlags extra_flags)
IMGUI_API void LogText(const char *fmt,...) IM_FMTARGS(1)
IMGUI_API bool IsItemVisible()
IMGUI_API int * GetIntRef(ImGuiID key, int default_val=0)
IMGUI_API bool ButtonBehavior(const ImRect &bb, ImGuiID id, bool *out_hovered, bool *out_held, ImGuiButtonFlags flags=0)
#define STB_TEXTEDIT_STRING
ImVector< float > TextWrapPosStack
ImWchar InputCharacters[16+1]
IMGUI_API void EndFrame()
IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate)
IMGUI_API float GetTextLineHeight()
IMGUI_API bool ItemHoverable(const ImRect &bb, ImGuiID id)
IMGUI_API bool SliderInt2(const char *label, int v[2], int v_min, int v_max, const char *display_format="%.0f")
IMGUI_API void PushStyleColor(ImGuiCol idx, ImU32 col)
IMGUI_API void LabelText(const char *label, const char *fmt,...) IM_FMTARGS(2)
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)
int ImFormatString(char *buf, int buf_size, const char *fmt,...)
IMGUI_API void TreePush(const char *str_id=NULL)
IMGUI_API void SetActiveID(ImGuiID id, ImGuiWindow *window)
IMGUI_API bool MenuItem(const char *label, const char *shortcut=NULL, bool selected=false, bool enabled=true)
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2 &pos, float radius)
IMGUI_API bool GetBool(ImGuiID key, bool default_val=false) const
void PathLineTo(const ImVec2 &pos)
IMGUI_API int GetFrameCount()
#define STB_TEXTEDIT_K_UP
bool HoveredIdAllowOverlap
IMGUI_API bool BeginPopupModal(const char *name, bool *p_open=NULL, ImGuiWindowFlags extra_flags=0)
int WantCaptureKeyboardNextFrame
IMGUI_API const char * GetClipboardText()
IMGUI_API bool Selectable(const char *label, bool selected=false, ImGuiSelectableFlags flags=0, const ImVec2 &size=ImVec2(0, 0))
IMGUI_API void SetNextWindowContentSize(const ImVec2 &size)
ImVec2 GetClosestPoint(ImVec2 p, bool on_edge) const
IMGUI_API int GetKeyIndex(ImGuiKey imgui_key)
IMGUI_API void PopButtonRepeat()
IMGUI_API bool Checkbox(const char *label, bool *v)
IMGUI_API float GetFloat(ImGuiID key, float default_val=0.0f) const
ImVector< ImDrawVert > VtxBuffer
IMGUI_API bool TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags=0)
IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiCond cond=0)
IMGUI_API bool VSliderInt(const char *label, const ImVec2 &size, int *v, int v_min, int v_max, const char *display_format="%.0f")
IMGUI_API float CalcWrapWidthForPos(const ImVec2 &pos, float wrap_pos_x)
IMGUI_API ImVec2 GetItemRectMax()
float MouseDragMaxDistanceSqr[5]
IMGUI_API void * GetVoidPtr(ImGuiID key) const
IMGUI_API float GetScrollY()
IMGUI_API void SetCursorScreenPos(const ImVec2 &pos)
IMGUI_API bool InputFloatN(const char *label, float *v, int components, int decimal_precision, ImGuiInputTextFlags extra_flags)
IMGUI_API void LogToClipboard(int max_depth=-1)
float MenuBarHeight() const
#define STB_TEXTEDIT_K_TEXTSTART
const char * begin() const
IMGUI_API void EndMenuBar()
#define IM_COL32_BLACK_TRANS
IMGUI_API const char * GetVersion()
int ImStrnicmp(const char *str1, const char *str2, int count)
ImVector< ImGuiGroupData > GroupStack
IMGUI_API void PushID(const char *str_id)
IMGUI_API bool DragIntRange2(const char *label, int *v_current_min, int *v_current_max, float v_speed=1.0f, int v_min=0, int v_max=0, const char *display_format="%.0f", const char *display_format_max=NULL)
IMGUI_API ImGuiID GetID(const char *str_id)
IMGUI_API bool InputTextEx(const char *label, char *buf, int buf_size, const ImVec2 &size_arg, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback=NULL, void *user_data=NULL)
IMGUI_API void PushAllowKeyboardFocus(bool allow_keyboard_focus)
ImVector< ImGuiID > IDStack
ImGuiMouseCursor MouseCursor
ImVector< float > IndexAdvanceX
bool SelectedAllMouseLock
IMGUI_API bool ListBox(const char *label, int *current_item, const char *const *items, int items_count, int height_in_items=-1)
IMGUI_API void RenderTextClipped(const ImVec2 &pos_min, const ImVec2 &pos_max, const char *text, const char *text_end, const ImVec2 *text_size_if_known, const ImVec2 &align=ImVec2(0, 0), const ImRect *clip_rect=NULL)
ImGuiWindow * GetCurrentWindow()
IMGUI_API void SetAllInt(int val)
IMGUI_API ImVec2 GetWindowPos()
IMGUI_API bool DragInt2(const char *label, int v[2], float v_speed=1.0f, int v_min=0, int v_max=0, const char *display_format="%.0f")
IMGUI_API ImGuiStyle & GetStyle()
IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, float &out_h, float &out_s, float &out_v)
IMGUI_API bool Combo(const char *label, int *current_item, const char *const *items, int items_count, int height_in_items=-1)
IMGUI_API void SetItemAllowOverlap()
IMGUI_API void CloseCurrentPopup()
IMGUI_API void PushClipRectFullScreen()
IMGUI_API void PopClipRect()
IMGUI_API bool TreeNodeExV(const char *str_id, ImGuiTreeNodeFlags flags, const char *fmt, va_list args) IM_FMTLIST(3)
float MouseDownDurationPrev[5]
IMGUI_API void OpenPopup(const char *str_id)
IMGUI_API ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, const char *text_begin, const char *text_end=NULL, const char **remaining=NULL) const
void * SetNextWindowSizeConstraintCallbackUserData
IMGUI_API bool DragInt3(const char *label, int v[3], float v_speed=1.0f, int v_min=0, int v_max=0, const char *display_format="%.0f")
IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_x, float default_y)
IMGUI_API bool DragFloat3(const char *label, float v[3], float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *display_format="%.3f", float power=1.0f)
IMGUI_API bool SliderFloat(const char *label, float *v, float v_min, float v_max, const char *display_format="%.3f", float power=1.0f)
ImVector< char > InitialText
FILE * ImFileOpen(const char *filename, const char *mode)
IMGUI_API void SetCursorPosY(float y)
IMGUI_API void AddRectFilled(const ImVec2 &a, const ImVec2 &b, ImU32 col, float rounding=0.0f, int rounding_corners_flags=~0)
IMGUI_API void AddRect(const ImVec2 &a, const ImVec2 &b, ImU32 col, float rounding=0.0f, int rounding_corners_flags=~0, float thickness=1.0f)
ImVec2 DragLastMouseDelta
ImVec2 BackupCursorMaxPos
ImVector< ImDrawIdx > IdxBuffer
IMGUI_API void TextDisabled(const char *fmt,...) IM_FMTARGS(1)
IMGUI_API ImDrawData * GetDrawData()
IMGUI_API void OpenPopupEx(ImGuiID id, bool reopen_existing)
IMGUI_API void ClearActiveID()
IMGUI_API const ImVec4 & GetStyleColorVec4(ImGuiCol idx)
IMGUI_API void Columns(int count=1, const char *id=NULL, bool border=true)
ImGuiStorage * StateStorage
IMGUI_API void SetWindowFontScale(float scale)
#define IM_ARRAYSIZE(_ARR)
IMGUI_API void InsertChars(int pos, const char *text, const char *text_end=NULL)
IMGUI_API bool DragInt(const char *label, int *v, float v_speed=1.0f, int v_min=0, int v_max=0, const char *display_format="%.0f")
IMGUI_API bool IsMouseDoubleClicked(int button)
ImVec2 FontTexUvWhitePixel
IMGUI_API void StyleColorsClassic(ImGuiStyle *dst=NULL)
ImGuiWindow * HoveredWindow
IMGUI_API bool IsAnyItemActive()
float ChildWindowRounding
bool Overlaps(const ImRect &r) const
float BackupCurrentLineHeight
IMGUI_API void PrimReserve(int idx_count, int vtx_count)
IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float &out_r, float &out_g, float &out_b)
IMGUI_API void PlotLines(const char *label, const float *values, int values_count, int values_offset=0, const char *overlay_text=NULL, float scale_min=FLT_MAX, float scale_max=FLT_MAX, ImVec2 graph_size=ImVec2(0, 0), int stride=sizeof(float))
IMGUI_API void ChannelsSplit(int channels_count)
IMGUI_API float GetCursorPosY()
IMGUI_API void SetColorEditOptions(ImGuiColorEditFlags flags)
IMGUI_API bool IsItemHovered()
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags)
IMGUI_API void SetKeyboardFocusHere(int offset=0)
IMGUI_API void LogFinish()
IMGUI_API int ParseFormatPrecision(const char *fmt, int default_value)
ImGuiWindow * GetCurrentWindowRead()
IMGUI_API void SetScrollX(float scroll_x)
ImVector< ImGuiPopupRef > CurrentPopupStack
ImVector< float > ItemWidthStack
IMGUI_API void TreeAdvanceToLabelPos()
#define STB_TEXTEDIT_K_LEFT
IMGUI_API bool InputInt(const char *label, int *v, int step=1, int step_fast=100, ImGuiInputTextFlags extra_flags=0)
ImGuiCond SetWindowSizeAllowFlags
IMGUI_API ImVec4 ColorConvertU32ToFloat4(ImU32 in)
IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul=1.0f)
IMGUI_API void PopStyleColor(int count=1)
ImVector< ImGuiWindow * > ChildWindows
char TempBuffer[1024 *3+1]
ImVector< unsigned short > IndexLookup
ImVector< ImVec4 > _ClipRectStack
IMGUI_API void EndMainMenuBar()
IMGUI_API bool VSliderFloat(const char *label, const ImVec2 &size, float *v, float v_min, float v_max, const char *display_format="%.3f", float power=1.0f)
IMGUI_API void TextDisabledV(const char *fmt, va_list args) IM_FMTLIST(1)
IMGUI_API ImVec2 CalcItemRectClosestPoint(const ImVec2 &pos, bool on_edge=false, float outward=+0.0f)
IMGUI_API bool IsPopupOpen(const char *str_id)
IMGUI_API void SetWindowSize(const ImVec2 &size, ImGuiCond cond=0)