603 #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) 604 #define _CRT_SECURE_NO_WARNINGS 608 #define IMGUI_DEFINE_MATH_OPERATORS 609 #define IMGUI_DEFINE_PLACEMENT_NEW 617 #if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier 624 #pragma warning (disable: 4127) // condition expression is constant 625 #pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff) 626 #pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen 631 #pragma clang diagnostic ignored "-Wold-style-cast" // warning : use of old-style cast // yes, they are more terse. 632 #pragma clang diagnostic ignored "-Wfloat-equal" // warning : comparing floating point with == or != is unsafe // storing and comparing against same constants ok. 633 #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. 634 #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. 635 #pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it. 636 #pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness // 637 #pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int' // 638 #elif defined(__GNUC__) 639 #pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used 640 #pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size 641 #pragma GCC diagnostic ignored "-Wformat" // warning: format '%p' expects argument of type 'void*', but argument 6 has type 'ImGuiWindow*' 642 #pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function 643 #pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value 798 memset(
this, 0,
sizeof(*
this));
801 DeltaTime = 1.0f/60.0f;
802 IniSavingRate = 5.0f;
803 IniFilename =
"imgui.ini";
804 LogFilename =
"imgui_log.txt";
806 FontGlobalScale = 1.0f;
807 DisplayFramebufferScale =
ImVec2(1.0
f, 1.0
f);
809 MousePosPrev =
ImVec2(-1,-1);
810 MouseDoubleClickTime = 0.30f;
811 MouseDoubleClickMaxDist = 6.0f;
812 MouseDragThreshold = 6.0f;
814 MouseDownDuration[
i] = MouseDownDurationPrev[
i] = -1.0
f;
816 KeysDownDuration[
i] = KeysDownDurationPrev[
i] = -1.0
f;
819 KeyRepeatDelay = 0.250f;
820 KeyRepeatRate = 0.050f;
824 RenderDrawListsFn =
NULL;
833 WordMovementUsesAltKey =
true;
834 ShortcutsUseSuperKey =
true;
835 DoubleClickSelectsWord =
true;
836 MultiSelectUsesSuperKey =
true;
848 InputCharacters[
n] =
c;
849 InputCharacters[n+1] =
'\0';
857 ImWchar wchars[wchars_buf_len];
859 for (
int i = 0;
i < wchars_buf_len && wchars[
i] != 0;
i++)
860 AddInputCharacter(wchars[
i]);
867 #define IM_F32_TO_INT8(_VAL) ((int)((_VAL) * 255.0f + 0.5f)) 871 #define IM_NEWLINE "\r\n" 873 #define IM_NEWLINE "\n" 878 bool b1 = ((p.
x - b.
x) * (a.
y - b.
y) - (p.
y - b.
y) * (a.
x - b.
x)) < 0.0
f;
879 bool b2 = ((p.
x - c.
x) * (b.
y - c.
y) - (p.
y - c.
y) * (b.
x - c.
x)) < 0.0
f;
880 bool b3 = ((p.
x - a.
x) * (c.
y - a.
y) - (p.
y - a.
y) * (c.
x - a.
x)) < 0.0
f;
881 return ((b1 == b2) && (b2 == b3));
887 while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; }
894 while (count > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; count--; }
900 size_t len = strlen(str) + 1;
902 return (
char*)memcpy(buff, (
const void*)str, len);
914 while (buf_mid_line > buf_begin && buf_mid_line[-1] !=
'\n')
919 const char*
ImStristr(
const char* haystack,
const char* haystack_end,
const char* needle,
const char* needle_end)
922 needle_end = needle + strlen(needle);
924 const char un0 = (char)toupper(*needle);
925 while ((!haystack_end && *haystack) || (haystack_end && haystack < haystack_end))
927 if (toupper(*haystack) == un0)
929 const char*
b = needle + 1;
930 for (
const char*
a = haystack + 1; b < needle_end;
a++, b++)
931 if (toupper(*
a) != toupper(*b))
945 int w = vsnprintf(buf, buf_size, fmt, args);
948 return (w == -1) ? buf_size :
w;
953 int w = vsnprintf(buf, buf_size, fmt, args);
955 return (w == -1) ? buf_size :
w;
962 static ImU32 crc32_lut[256] = { 0 };
965 const ImU32 polynomial = 0xEDB88320;
970 crc = (crc >> 1) ^ (
ImU32(-
int(crc & 1)) & polynomial);
977 const unsigned char* current = (
const unsigned char*)data;
983 crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ *current++];
988 while (
unsigned char c = *current++)
994 if (
c ==
'#' && current[0] ==
'#' && current[1] ==
'#')
997 crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^
c];
1012 unsigned int c = (
unsigned int)-1;
1013 const unsigned char*
str = (
const unsigned char*)in_text;
1016 c = (
unsigned int)(*str++);
1020 if ((*str & 0xe0) == 0xc0)
1023 if (in_text_end && in_text_end - (
const char*)str < 2)
return 1;
1024 if (*str < 0xc2)
return 2;
1025 c = (
unsigned int)((*str++ & 0x1f) << 6);
1026 if ((*str & 0xc0) != 0x80)
return 2;
1027 c += (*str++ & 0x3f);
1031 if ((*str & 0xf0) == 0xe0)
1034 if (in_text_end && in_text_end - (
const char*)str < 3)
return 1;
1035 if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf))
return 3;
1036 if (*str == 0xed && str[1] > 0x9f)
return 3;
1037 c = (
unsigned int)((*str++ & 0x0f) << 12);
1038 if ((*str & 0xc0) != 0x80)
return 3;
1039 c += (
unsigned int)((*str++ & 0x3f) << 6);
1040 if ((*str & 0xc0) != 0x80)
return 3;
1041 c += (*str++ & 0x3f);
1045 if ((*str & 0xf8) == 0xf0)
1048 if (in_text_end && in_text_end - (
const char*)str < 4)
return 1;
1049 if (*str > 0xf4)
return 4;
1050 if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf))
return 4;
1051 if (*str == 0xf4 && str[1] > 0x8f)
return 4;
1052 c = (
unsigned int)((*str++ & 0x07) << 18);
1053 if ((*str & 0xc0) != 0x80)
return 4;
1054 c += (
unsigned int)((*str++ & 0x3f) << 12);
1055 if ((*str & 0xc0) != 0x80)
return 4;
1056 c += (
unsigned int)((*str++ & 0x3f) << 6);
1057 if ((*str & 0xc0) != 0x80)
return 4;
1058 c += (*str++ & 0x3f);
1060 if ((c & 0xFFFFF800) == 0xD800)
return 4;
1071 ImWchar* buf_end = buf + buf_size;
1072 while (buf_out < buf_end-1 && (!in_text_end || in_text < in_text_end) && *in_text)
1082 if (in_text_remaining)
1083 *in_text_remaining = in_text;
1084 return (
int)(buf_out -
buf);
1090 while ((!in_text_end || in_text < in_text_end) && *in_text)
1112 if (buf_size < 2)
return 0;
1113 buf[0] = (char)(0xc0 + (c >> 6));
1114 buf[1] = (char)(0x80 + (c & 0x3f));
1117 if (c >= 0xdc00 && c < 0xe000)
1121 if (c >= 0xd800 && c < 0xdc00)
1123 if (buf_size < 4)
return 0;
1124 buf[0] = (char)(0xf0 + (c >> 18));
1125 buf[1] = (char)(0x80 + ((c >> 12) & 0x3f));
1126 buf[2] = (char)(0x80 + ((c >> 6) & 0x3f));
1127 buf[3] = (char)(0x80 + ((c ) & 0x3f));
1132 if (buf_size < 3)
return 0;
1133 buf[0] = (char)(0xe0 + (c >> 12));
1134 buf[1] = (char)(0x80 + ((c>> 6) & 0x3f));
1135 buf[2] = (char)(0x80 + ((c ) & 0x3f));
1142 if (c < 0x80)
return 1;
1143 if (c < 0x800)
return 2;
1144 if (c >= 0xdc00 && c < 0xe000)
return 0;
1145 if (c >= 0xd800 && c < 0xdc00)
return 4;
1151 char* buf_out =
buf;
1152 const char* buf_end = buf + buf_size;
1153 while (buf_out < buf_end-1 && (!in_text_end || in_text < in_text_end) && *in_text)
1155 unsigned int c = (
unsigned int)(*in_text++);
1157 *buf_out++ = (char)c;
1162 return (
int)(buf_out -
buf);
1167 int bytes_count = 0;
1168 while ((!in_text_end || in_text < in_text_end) && *in_text)
1170 unsigned int c = (
unsigned int)(*in_text++);
1181 float s = 1.0f/255.0f;
1182 return ImVec4((in & 0xFF) * s, ((in >> 8) & 0xFF) * s, ((in >> 16) & 0xFF) * s, (in >> 24) * s);
1202 const float tmp =
g; g =
b; b =
tmp;
1207 const float tmp =
r; r =
g; g =
tmp;
1211 const float chroma = r - (g < b ? g :
b);
1212 out_h = fabsf(K + (g - b) / (6.
f * chroma + 1
e-20
f));
1213 out_s = chroma / (r + 1
e-20
f);
1224 out_r = out_g = out_b =
v;
1228 h = fmodf(h, 1.0
f) / (60.0f/360.0f);
1230 float f = h - (float)i;
1231 float p = v * (1.0f -
s);
1232 float q = v * (1.0f - s *
f);
1233 float t = v * (1.0f - s * (1.0f -
f));
1237 case 0: out_r =
v; out_g =
t; out_b =
p;
break;
1238 case 1: out_r =
q; out_g =
v; out_b =
p;
break;
1239 case 2: out_r =
p; out_g =
v; out_b =
t;
break;
1240 case 3: out_r =
p; out_g =
q; out_b =
v;
break;
1241 case 4: out_r =
t; out_g =
p; out_b =
v;
break;
1242 case 5:
default: out_r =
v; out_g =
p; out_b =
q;
break;
1255 if ((f = fopen(filename, file_open_mode)) ==
NULL)
1258 long file_size_signed;
1259 if (fseek(f, 0, SEEK_END) || (file_size_signed = ftell(f)) == -1 || fseek(f, 0, SEEK_SET))
1265 int file_size = (int)file_size_signed;
1267 if (file_data ==
NULL)
1272 if (fread(file_data, 1, (
size_t)file_size, f) != (
size_t)file_size)
1278 if (padding_bytes > 0)
1279 memset((
void *)(((
char*)file_data) + file_size), 0, padding_bytes);
1283 *out_file_size = file_size;
1303 int count = (int)(last - first);
1306 int count2 = count / 2;
1311 count -= count2 + 1;
1324 if (it == Data.
end() || it->key !=
key)
1331 return GetInt(key, default_val ? 1 : 0) != 0;
1337 if (it == Data.
end() || it->key !=
key)
1345 if (it == Data.
end() || it->key !=
key)
1354 if (it == Data.
end() || it->key !=
key)
1355 it = Data.
insert(it,
Pair(key, default_val));
1361 return (
bool*)GetIntRef(key, default_val ? 1 : 0);
1367 if (it == Data.
end() || it->key !=
key)
1368 it = Data.
insert(it,
Pair(key, default_val));
1375 if (it == Data.
end() || it->key !=
key)
1376 it = Data.
insert(it,
Pair(key, default_val));
1384 if (it == Data.
end() || it->key !=
key)
1386 Data.insert(it,
Pair(key, val));
1394 SetInt(key, val ? 1 : 0);
1400 if (it == Data.
end() || it->key !=
key)
1402 Data.insert(it,
Pair(key, val));
1411 if (it == Data.
end() || it->key !=
key)
1413 Data.insert(it,
Pair(key, val));
1421 for (
int i = 0;
i < Data.Size;
i++)
1453 return value_changed;
1460 const char* we = wb;
1463 if (*we == separator)
1477 TextRange input_range(InputBuf, InputBuf+strlen(InputBuf));
1478 input_range.
split(
',', Filters);
1481 for (
int i = 0;
i != Filters.Size;
i++)
1483 Filters[
i].trim_blanks();
1484 if (Filters[
i].empty())
1486 if (Filters[
i].front() !=
'-')
1493 if (Filters.empty())
1499 for (
int i = 0;
i != Filters.Size;
i++)
1504 if (f.
front() ==
'-')
1532 #define va_copy(dest, src) (dest = src) 1541 int len = vsnprintf(
NULL, 0, fmt, args);
1545 const int write_off = Buf.Size;
1546 const int needed_sz = write_off +
len;
1547 if (write_off + len >= Buf.Capacity)
1549 int double_capacity = Buf.Capacity * 2;
1550 Buf.reserve(needed_sz > double_capacity ? needed_sz : double_capacity);
1553 Buf.resize(needed_sz);
1560 va_start(args, fmt);
1572 Spacing = Width = NextWidth = 0.0f;
1573 memset(Pos, 0,
sizeof(Pos));
1574 memset(NextWidths, 0,
sizeof(NextWidths));
1581 Width = NextWidth = 0.0f;
1583 if (clear) memset(NextWidths, 0,
sizeof(NextWidths));
1584 for (
int i = 0;
i < Count;
i++)
1586 if (
i > 0 && NextWidths[
i] > 0.0f)
1588 Pos[
i] = (float)(
int)Width;
1589 Width += NextWidths[
i];
1590 NextWidths[
i] = 0.0f;
1597 NextWidths[0] =
ImMax(NextWidths[0], w0);
1598 NextWidths[1] =
ImMax(NextWidths[1], w1);
1599 NextWidths[2] =
ImMax(NextWidths[2], w2);
1600 for (
int i = 0;
i < 3;
i++)
1601 NextWidth += NextWidths[
i] + ((
i > 0 && NextWidths[
i] > 0.0f) ?
Spacing : 0.0f);
1602 return ImMax(Width, NextWidth);
1607 return ImMax(0.0f, avail_w - Width);
1630 ItemsHeight = items_height;
1633 DisplayEnd = DisplayStart = -1;
1634 if (ItemsHeight > 0.0f)
1637 if (DisplayStart > 0)
1648 if (ItemsCount < INT_MAX)
1671 if (ItemsCount == 1) { ItemsCount = -1;
return false; }
1675 Begin(ItemsCount, items_height);
1681 IM_ASSERT(DisplayStart >= 0 && DisplayEnd >= 0);
1698 IDStack.push_back(ID);
1699 MoveID =
GetID(
"#MOVE");
1702 IndexWithinParent = 0;
1703 PosFloat = Pos =
ImVec2(0.0f, 0.0f);
1704 Size = SizeFull =
ImVec2(0.0f, 0.0f);
1705 SizeContents = SizeContentsExplicit =
ImVec2(0.0f, 0.0f);
1707 Scroll =
ImVec2(0.0f, 0.0f);
1708 ScrollTarget =
ImVec2(FLT_MAX, FLT_MAX);
1709 ScrollTargetCenterRatio =
ImVec2(0.5f, 0.5f);
1710 ScrollbarX = ScrollbarY =
false;
1711 ScrollbarSizes =
ImVec2(0.0f, 0.0f);
1713 Active = WasActive =
false;
1719 AutoFitFramesX = AutoFitFramesY = -1;
1720 AutoFitOnlyGrows =
false;
1721 AutoPosLastDirection = -1;
1724 SetWindowPosCenterWanted =
false;
1726 LastFrameActive = -1;
1727 ItemWidthDefault = 0.0f;
1728 FontWindowScale = 1.0f;
1732 DrawList->_OwnerName = Name;
1734 RootNonPopupWindow =
NULL;
1735 ParentWindow =
NULL;
1737 FocusIdxAllCounter = FocusIdxTabCounter = -1;
1738 FocusIdxAllRequestCurrent = FocusIdxTabRequestCurrent = INT_MAX;
1739 FocusIdxAllRequestNext = FocusIdxTabRequestNext = INT_MAX;
1744 DrawList->~ImDrawList();
1753 ImGuiID seed = IDStack.back();
1754 ImGuiID id =
ImHash(str, str_end ? (
int)(str_end - str) : 0, seed);
1761 ImGuiID seed = IDStack.back();
1871 if (!
id || *
id != GImGui->
ActiveId)
1898 if (allow_keyboard_focus)
1912 if (allow_keyboard_focus)
1929 if (size.
x < 0.0f || size.
y < 0.0f)
1940 if (wrap_pos_x < 0.0f)
1944 if (wrap_pos_x == 0.0f)
1946 else if (wrap_pos_x > 0.0f)
1949 const float wrap_width = wrap_pos_x > 0.0f ?
ImMax(wrap_pos_x - pos.
x, 0.00001f) : 0.0f;
1997 if (!malloc_fn) malloc_fn = malloc;
2008 ctx->~ImGuiContext();
2021 return GImGui->
Style;
2032 return GImGui->
Time;
2182 while (window && window != modal_window)
2194 int mouse_earliest_button_down = -1;
2195 bool mouse_any_down =
false;
2203 mouse_earliest_button_down =
i;
2205 bool mouse_avail_to_imgui = (mouse_earliest_button_down == -1) || g.
IO.
MouseDownOwned[mouse_earliest_button_down];
2217 if (!mouse_avail_to_imgui)
2377 const char* buf_end = file_data + file_size;
2378 for (
const char* line_start = file_data; line_start < buf_end; )
2380 const char* line_end = line_start;
2381 while (line_end < buf_end && *line_end !=
'\n' && *line_end !=
'\r')
2384 if (line_start[0] ==
'[' && line_end > line_start && line_end[-1] ==
']')
2396 if (sscanf(line_start,
"Pos=%f,%f", &x, &y) == 2)
2398 else if (sscanf(line_start,
"Size=%f,%f", &x, &y) == 2)
2400 else if (sscanf(line_start,
"Collapsed=%d", &i) == 1)
2404 line_start = line_end+1;
2424 settings->
Pos = window->
Pos;
2431 FILE* f = fopen(filename,
"wt");
2437 if (settings->
Pos.
x == FLT_MAX)
2440 if (
const char*
p = strstr(name,
"###"))
2442 fprintf(f,
"[%s]\n", name);
2443 fprintf(f,
"Pos=%d,%d\n", (
int)settings->
Pos.
x, (
int)settings->
Pos.
y);
2444 fprintf(f,
"Size=%d,%d\n", (
int)settings->
Size.
x, (
int)settings->
Size.
y);
2445 fprintf(f,
"Collapsed=%d\n", settings->
Collapsed);
2536 window->
DrawList->
PushClipRect(clip_rect_min, clip_rect_max, intersect_with_current_clip_rect);
2654 int flattened_size =
n;
2699 const char* text_display_end = text;
2701 text_end = (
const char*)-1;
2703 while (text_display_end < text_end && *text_display_end !=
'\0' && (text_display_end[0] !=
'#' || text_display_end[1] !=
'#'))
2705 return text_display_end;
2716 va_start(args, fmt);
2719 vfprintf(g.
LogFile, fmt, args);
2741 const char* text_remaining = text;
2748 const char* line_end = text_remaining;
2749 while (line_end < text_end)
2750 if (*line_end ==
'\n')
2754 if (line_end >= text_end)
2757 const bool is_first_line = (text == text_remaining);
2758 bool is_last_line =
false;
2759 if (line_end ==
NULL)
2761 is_last_line =
true;
2762 line_end = text_end;
2764 if (line_end !=
NULL && !(is_last_line && (line_end - text_remaining)==0))
2766 const int char_count = (int)(line_end - text_remaining);
2767 if (log_new_line || !is_first_line)
2775 text_remaining = line_end + 1;
2787 const char* text_display_end;
2788 if (hide_text_after_hash)
2795 text_end = text + strlen(text);
2796 text_display_end = text_end;
2799 const int text_len = (int)(text_display_end - text);
2814 text_end = text + strlen(text);
2816 const int text_len = (int)(text_end - text);
2830 const int text_len = (int)(text_display_end - text);
2839 const ImVec2 text_size = text_size_if_known ? *text_size_if_known :
CalcTextSize(text, text_display_end,
false, 0.0f);
2841 if (!clip_max) clip_max = &pos_max;
2842 bool need_clipping = (pos.
x + text_size.
x >= clip_max->
x) || (pos.
y + text_size.
y >= clip_max->
y);
2843 if (!clip_min) clip_min = &pos_min;
else need_clipping |= (pos.
x < clip_min->
x) || (pos.
y < clip_min->
y);
2853 ImVec4 fine_clip_rect(clip_min->
x, clip_min->
y, clip_max->
x, clip_max->
y);
2883 const float h = g.
FontSize * 1.00f;
2884 const float r = h * 0.40f *
scale;
2885 ImVec2 center = p_min +
ImVec2(h*0.50f, h*0.50f*scale);
2890 center.
y -= r*0.25f;
2891 a = center + ImVec2(0,1)*
r;
2892 b = center + ImVec2(-0.866f,-0.5f)*
r;
2893 c = center + ImVec2(0.866f,-0.5f)*
r;
2897 a = center + ImVec2(1,0)*
r;
2898 b = center + ImVec2(-0.500f,0.866f)*
r;
2899 c = center + ImVec2(-0.500f,-0.866f)*
r;
2919 float start_x = (float)(
int)(g.
FontSize * 0.307f + 0.5f);
2920 float rem_third = (float)(
int)((g.
FontSize - start_x) / 3.0f);
2921 a.
x = pos.
x + 0.5f + start_x;
2922 b.
x = a.
x + rem_third;
2923 c.
x = a.
x + rem_third * 3.0f;
2925 a.
y = b.
y - rem_third;
2926 c.
y = b.
y - rem_third * 2.0f;
2940 const char* text_display_end;
2941 if (hide_text_after_double_hash)
2944 text_display_end = text_end;
2947 const float font_size = g.
FontSize;
2948 if (text == text_display_end)
2949 return ImVec2(0.0f, font_size);
2953 const float font_scale = font_size / font->
FontSize;
2954 const float character_spacing_x = 1.0f * font_scale;
2955 if (text_size.
x > 0.0f)
2956 text_size.
x -= character_spacing_x;
2957 text_size.
x = (float)(
int)(text_size.
x + 0.95f);
2972 *out_items_display_start = 0;
2973 *out_items_display_end = items_count;
2978 *out_items_display_start = *out_items_display_end = 0;
2985 start =
ImClamp(start, 0, items_count);
2986 end =
ImClamp(end + 1, start, items_count);
2987 *out_items_display_start =
start;
2988 *out_items_display_end =
end;
3023 ImRect rect_clipped(r_min, r_max);
3063 if (key_index < 0)
return false;
3071 if (key_index < 0)
return false;
3089 if (key_index < 0)
return false;
3141 if (lock_threshold < 0.0f)
3164 if (lock_threshold < 0.0f)
3169 return ImVec2(0.0f, 0.0f);
3291 va_start(args, fmt);
3336 else if (reopen_existing || g.
OpenPopupStack[current_stack_size].PopupID !=
id)
3368 bool has_focus =
false;
3385 return front_most_popup;
3478 if (!is_open || (p_open && !*p_open))
3516 if (!str_id) str_id =
"window_context_menu";
3525 if (!str_id) str_id =
"void_context_menu";
3542 size.
x =
ImMax(content_avail.
x, 4.0f) - fabsf(size.
x);
3548 size.
y =
ImMax(content_avail.
y, 4.0f) - fabsf(size.
y);
3552 flags |= extra_flags;
3624 {
int current = window->
IDStack.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"PushID/PopID Mismatch!"); p_backup++; }
3625 {
int current = window->
DC.
GroupStack.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"BeginGroup/EndGroup Mismatch!"); p_backup++; }
3626 {
int current = g.
CurrentPopupStack.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"BeginMenu/EndMenu or BeginPopup/EndPopup Mismatch"); p_backup++; }
3627 {
int current = g.
ColorModifiers.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"PushStyleColor/PopStyleColor Mismatch!"); p_backup++; }
3628 {
int current = g.
StyleModifiers.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"PushStyleVar/PopStyleVar Mismatch!"); p_backup++; }
3629 {
int current = g.
FontStack.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"PushFont/PopFont Mismatch!"); p_backup++; }
3640 r_outer.
Reduce(
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));
3643 for (
int n = (*last_dir != -1) ? -1 : 0;
n < 4;
n++)
3645 const int dir = (
n == -1) ? *last_dir :
n;
3650 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);
3705 if (settings->
Pos.
x != FLT_MAX)
3713 size = settings->
Size;
3724 if (window->
Size.
x <= 0.0f)
3726 if (window->
Size.
y <= 0.0f)
3789 bool window_is_new =
false;
3794 window_is_new =
true;
3798 const bool first_begin_of_the_frame = (window->
LastFrameActive != current_frame);
3799 if (first_begin_of_the_frame)
3802 flags = window->
Flags;
3811 bool window_was_active = (window->
LastFrameActive == current_frame - 1);
3816 window_was_active &= (window == popup_ref.
Window);
3822 const bool window_appearing_after_being_hidden = (window->
HiddenFrames == 1);
3825 bool window_pos_set_by_api =
false, window_size_set_by_api =
false;
3855 else if (first_begin_of_the_frame)
3872 int root_idx, root_non_popup_idx;
3876 for (root_non_popup_idx = root_idx; root_non_popup_idx > 0; root_non_popup_idx--)
3877 if (!(g.
CurrentWindowStack[root_non_popup_idx]->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)))
3884 if (first_begin_of_the_frame)
3903 if (!window_was_active)
3912 if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api)
3948 if (!window_size_set_by_api)
3971 if (size_auto_fit.
y < window->
SizeContents.
y && !(flags & ImGuiWindowFlags_NoScrollbar))
4011 if (flags & ImGuiWindowFlags_ChildWindow)
4016 if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup))
4022 bool window_pos_center =
false;
4024 window_pos_center |= ((flags &
ImGuiWindowFlags_Modal) && !window_pos_set_by_api && window_appearing_after_being_hidden);
4025 if (window_pos_center)
4040 else if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api && window_appearing_after_being_hidden)
4047 if ((flags & ImGuiWindowFlags_Tooltip) != 0 && !window_pos_set_by_api)
4056 if (!(flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Tooltip))
4109 ImU32 resize_col = 0;
4110 const float resize_corner_size =
ImMax(g.
FontSize * 1.35f, window_rounding + 1.0f + g.
FontSize * 0.2f);
4115 const ImRect resize_rect(br -
ImVec2(resize_corner_size * 0.75f, resize_corner_size * 0.75f), br);
4121 if (hovered || held)
4157 else if ((flags & ImGuiWindowFlags_ChildWindow) != 0)
4160 if (bg_alpha >= 0.0f)
4161 bg_color.
w = bg_alpha;
4162 bg_color.
w *= style.
Alpha;
4163 if (bg_color.
w > 0.0f)
4167 if (!(flags & ImGuiWindowFlags_NoTitleBar))
4187 if (!(flags & ImGuiWindowFlags_NoResize))
4201 if (!(flags & ImGuiWindowFlags_NoTitleBar))
4250 if (!(flags & ImGuiWindowFlags_NoTitleBar))
4254 const float pad = 2.0f;
4261 if (!(flags & ImGuiWindowFlags_NoCollapse))
4268 bool pad_right = (p_open !=
NULL);
4293 const float border_size = window->
BorderSize;
4302 if (first_begin_of_the_frame)
4309 if (flags & ImGuiWindowFlags_ChildWindow)
4322 if (style.
Alpha <= 0.0f)
4360 const ImGuiID id = window->
GetID(horizontal ?
"#SCROLLX" :
"#SCROLLY");
4364 float other_scrollbar_size_w = other_scrollbar ? style.
ScrollbarSize : 0.0f;
4366 const float border_size = window->
BorderSize;
4369 : 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);
4374 int window_rounding_corners;
4376 window_rounding_corners = 8 | (other_scrollbar ? 0 : 4);
4384 float scroll_v = horizontal ? window->
Scroll.
x : window->
Scroll.
y;
4385 float win_size_avail_v = (horizontal ? window->
Size.
x : window->
Size.
y) - other_scrollbar_size_w;
4391 const float grab_h_norm = grab_h_pixels / scrollbar_size_v;
4395 bool hovered =
false;
4396 const bool previously_held = (g.
ActiveId ==
id);
4399 float scroll_max =
ImMax(1.0f, win_size_contents_v - win_size_avail_v);
4400 float scroll_ratio =
ImSaturate(scroll_v / scroll_max);
4401 float grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v;
4402 if (held && grab_h_norm < 1.0f)
4404 float scrollbar_pos_v = horizontal ? bb.
Min.
x : bb.
Min.
y;
4409 const float clicked_v_norm =
ImSaturate((mouse_pos_v - scrollbar_pos_v) / scrollbar_size_v);
4412 bool seek_absolute =
false;
4413 if (!previously_held)
4416 if (clicked_v_norm >= grab_v_norm && clicked_v_norm <= grab_v_norm + grab_h_norm)
4418 *click_delta_to_grab_center_v = clicked_v_norm - grab_v_norm - grab_h_norm*0.5f;
4422 seek_absolute =
true;
4423 *click_delta_to_grab_center_v = 0.0f;
4429 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));
4430 scroll_v = (float)(
int)(0.5f + scroll_v_norm * scroll_max);
4437 scroll_ratio =
ImSaturate(scroll_v / scroll_max);
4438 grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v;
4442 *click_delta_to_grab_center_v = clicked_v_norm - grab_v_norm - grab_h_norm*0.5f;
4499 const float w_item_one =
ImMax(1.0f, (
float)(
int)((w_full - (style.
ItemInnerSpacing.
x) * (components-1)) / (
float)components));
4500 const float w_item_last =
ImMax(1.0f, (
float)(
int)(w_full - (w_item_one + style.
ItemInnerSpacing.
x) * (components-1)));
4502 for (
int i = 0;
i < components-1;
i++)
4522 w =
ImMax(1.0f, width_to_right_edge + w);
4776 return window->
Size.
x;
4782 return window->
Size.
y;
4795 window->
Scroll.
y = new_scroll_y;
4831 return window->
Size;
5053 return GImGui->
Font;
5173 IM_ASSERT(center_y_ratio >= 0.0f && center_y_ratio <= 1.0f);
5175 if (center_y_ratio <= 0.0f && window->ScrollTarget.y <= window->
WindowPadding.
y)
5226 va_start(args, fmt);
5241 va_start(args, fmt);
5256 va_start(args, fmt);
5271 va_start(args, fmt);
5284 const char* text_begin = text;
5285 if (text_end ==
NULL)
5286 text_end = text + strlen(text);
5289 const bool wrap_enabled = wrap_pos_x >= 0.0f;
5290 if (text_end - text > 2000 && !wrap_enabled)
5296 const char*
line = text;
5302 if (text_pos.
y <= clip_rect.
Max.
y)
5309 int lines_skippable = (int)((clip_rect.
Min.
y - text_pos.
y) / line_height);
5310 if (lines_skippable > 0)
5312 int lines_skipped = 0;
5313 while (line < text_end && lines_skipped < lines_skippable)
5315 const char* line_end = strchr(line,
'\n');
5317 line_end = text_end;
5318 line = line_end + 1;
5321 pos.
y += lines_skipped * line_height;
5326 if (line < text_end)
5329 while (line < text_end)
5331 const char* line_end = strchr(line,
'\n');
5336 text_size.
x =
ImMax(text_size.
x, line_size.
x);
5339 line_end = text_end;
5340 line = line_end + 1;
5341 line_rect.
Min.
y += line_height;
5342 line_rect.
Max.
y += line_height;
5343 pos.
y += line_height;
5347 int lines_skipped = 0;
5348 while (line < text_end)
5350 const char* line_end = strchr(line,
'\n');
5352 line_end = text_end;
5353 line = line_end + 1;
5356 pos.
y += lines_skipped * line_height;
5359 text_size.
y += (pos - text_pos).
y;
5362 ImRect bb(text_pos, text_pos + text_size);
5375 ImRect bb(text_pos, text_pos + text_size);
5416 const char* value_text_begin = &g.
TempBuffer[0];
5419 if (label_size.
x > 0.0f)
5426 va_start(args, fmt);
5450 if (out_hovered) *out_hovered =
false;
5451 if (out_held) *out_held =
false;
5459 bool pressed =
false;
5515 hovered = pressed = held =
false;
5517 if (out_hovered) *out_hovered = hovered;
5518 if (out_held) *out_held = held;
5539 const ImRect bb(pos, pos + size);
5556 if (hovered || held)
5560 if (hovered || held)
5563 if (button_disabled)
5575 return ButtonEx(label, size_arg, 0);
5625 const float cross_extent = (radius * 0.7071f) - 1.0f;
5642 if (border_col.
w > 0.0f)
5648 if (border_col.
w > 0.0f)
5674 PushID((
void *)user_texture_id);
5678 const ImVec2 padding = (frame_padding >= 0) ?
ImVec2((
float)frame_padding, (float)frame_padding) : style.
FramePadding;
5691 if (bg_col.
w > 0.0f)
5728 g.
LogFile = fopen(filename,
"ab");
5787 const bool log_to_clipboard =
Button(
"Log To Clipboard");
SameLine();
5800 if (log_to_clipboard)
5820 storage->
SetInt(
id, is_open);
5825 const int stored_value = storage->
GetInt(
id, -1);
5826 if (stored_value == -1)
5829 storage->
SetInt(
id, is_open);
5833 is_open = stored_value != 0;
5877 const float text_offset_x = (g.
FontSize + (display_frame ? padding.
x*3 : padding.
x*2));
5878 const float text_width = g.
FontSize + (label_size.
x > 0.0f ? label_size.
x + padding.
x*2 : 0.0f);
5885 if (!
ItemAdd(interact_bb, &
id))
5900 bool hovered, held, pressed =
ButtonBehavior(interact_bb,
id, &hovered, &held, button_flags);
5906 if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick)
5919 const ImVec2 text_pos = bb.
Min +
ImVec2(text_offset_x, padding.
y + text_base_offset_y);
5928 const char log_prefix[] =
"\n##";
5929 const char log_suffix[] =
"##";
5947 else if (!(flags & ImGuiTreeNodeFlags_Leaf))
5951 RenderText(text_pos, label, label_end,
false);
5976 if (p_open && !*p_open)
5985 float button_sz = g.
FontSize * 0.5f;
6037 va_start(args, fmt);
6038 bool is_open =
TreeNodeExV(str_id, flags, fmt, args);
6046 va_start(args, fmt);
6047 bool is_open =
TreeNodeExV(ptr_id, flags, fmt, args);
6055 va_start(args, fmt);
6064 va_start(args, fmt);
6118 const void* ptr_id = (
void*)(
intptr_t)int_id;
6194 va_start(args, fmt);
6204 ImFormatString(buf, buf_size, display_format, *(
float*)data_ptr);
6211 if (decimal_precision < 0)
6214 ImFormatString(buf, buf_size,
"%.*d", decimal_precision, *(
int*)data_ptr);
6218 if (decimal_precision < 0)
6221 ImFormatString(buf, buf_size,
"%.*f", decimal_precision, *(
float*)data_ptr);
6230 *(
int*)value1 = *(
int*)value1 + *(
const int*)value2;
6232 *(
int*)value1 = *(
int*)value1 - *(
const int*)value2;
6237 *(
float*)value1 = *(
float*)value1 + *(
const float*)value2;
6239 *(
float*)value1 = *(
float*)value1 - *(
const float*)value2;
6252 if (op ==
'+' || op ==
'*' || op ==
'/')
6268 scalar_format =
"%d";
6269 int* v = (
int*)data_ptr;
6270 const int old_v = *
v;
6272 if (op && sscanf(initial_value_buf, scalar_format, &arg0) < 1)
6277 if (op ==
'+') {
if (sscanf(buf,
"%f", &arg1) == 1) *v = (
int)(arg0 +
arg1); }
6278 else if (op ==
'*') {
if (sscanf(buf,
"%f", &arg1) == 1) *v = (
int)(arg0 *
arg1); }
6279 else if (op ==
'/') {
if (sscanf(buf,
"%f", &arg1) == 1 && arg1 != 0.0f) *v = (
int)(arg0 /
arg1); }
6280 else {
if (sscanf(buf, scalar_format, &arg0) == 1) *v = arg0; }
6281 return (old_v != *v);
6286 scalar_format =
"%f";
6287 float* v = (
float*)data_ptr;
6288 const float old_v = *
v;
6290 if (op && sscanf(initial_value_buf, scalar_format, &arg0) < 1)
6294 if (sscanf(buf, scalar_format, &arg1) < 1)
6296 if (op ==
'+') { *v = arg0 +
arg1; }
6297 else if (op ==
'*') { *v = arg0 *
arg1; }
6298 else if (op ==
'/') {
if (arg1 != 0.0f) *v = arg0 /
arg1; }
6300 return (old_v != *v);
6332 if (text_value_changed)
6341 while ((fmt = strchr(fmt,
'%')) !=
NULL)
6344 if (fmt[0] ==
'%') { fmt++;
continue; }
6345 while (*fmt >=
'0' && *fmt <=
'9')
6349 precision = atoi(fmt + 1);
6351 precision = default_precision;
6363 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 };
6364 float min_step = (decimal_precision >= 0 && decimal_precision < 10) ? min_steps[decimal_precision] : powf(10.0f, (
float)-decimal_precision);
6365 bool negative = value < 0.0f;
6366 value = fabsf(value);
6367 float remainder = fmodf(value, min_step);
6368 if (remainder <= min_step*0.5f)
6371 value += (min_step - remainder);
6372 return negative ? -value :
value;
6381 const bool is_non_linear = fabsf(power - 1.0f) > 0.0001f;
6392 const float grab_padding = 2.0f;
6393 const float slider_sz = is_horizontal ? (frame_bb.
GetWidth() - grab_padding * 2.0f) : (frame_bb.
GetHeight() - grab_padding * 2.0f);
6395 if (decimal_precision > 0)
6399 const float slider_usable_sz = slider_sz - grab_sz;
6400 const float slider_usable_pos_min = (is_horizontal ? frame_bb.
Min.
x : frame_bb.
Min.
y) + grab_padding + grab_sz*0.5f;
6401 const float slider_usable_pos_max = (is_horizontal ? frame_bb.
Max.
x : frame_bb.
Max.
y) - grab_padding - grab_sz*0.5f;
6404 float linear_zero_pos = 0.0f;
6405 if (v_min * v_max < 0.0f)
6408 const float linear_dist_min_to_0 = powf(fabsf(0.0f - v_min), 1.0f/power);
6409 const float linear_dist_max_to_0 = powf(fabsf(v_max - 0.0f), 1.0f/power);
6410 linear_zero_pos = linear_dist_min_to_0 / (linear_dist_min_to_0+linear_dist_max_to_0);
6415 linear_zero_pos = v_min < 0.0f ? 1.0f : 0.0f;
6419 bool value_changed =
false;
6425 float normalized_pos =
ImClamp((mouse_abs_pos - slider_usable_pos_min) / slider_usable_sz, 0.0f, 1.0f);
6427 normalized_pos = 1.0f - normalized_pos;
6433 if (normalized_pos < linear_zero_pos)
6436 float a = 1.0f - (normalized_pos / linear_zero_pos);
6444 if (fabsf(linear_zero_pos - 1.0f) > 1.
e-6f)
6445 a = (normalized_pos - linear_zero_pos) / (1.0f - linear_zero_pos);
6455 new_value =
ImLerp(v_min, v_max, normalized_pos);
6459 new_value =
RoundScalar(new_value, decimal_precision);
6460 if (*v != new_value)
6463 value_changed =
true;
6476 float v_clamped =
ImClamp(*v, v_min, v_max);
6477 if (v_clamped < 0.0f)
6479 const float f = 1.0f - (v_clamped - v_min) / (
ImMin(0.0f,v_max) - v_min);
6480 grab_t = (1.0f - powf(f, 1.0f/power)) * linear_zero_pos;
6484 const float f = (v_clamped -
ImMax(0.0f,v_min)) / (v_max -
ImMax(0.0f,v_min));
6485 grab_t = linear_zero_pos + powf(f, 1.0f/power) * (1.0f - linear_zero_pos);
6491 grab_t = (
ImClamp(*v, v_min, v_max) - v_min) / (v_max - v_min);
6496 grab_t = 1.0f - grab_t;
6497 const float grab_pos =
ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t);
6500 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));
6502 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));
6507 ImRect fill_br = frame_bb;
6508 auto slider_height = bb.
Max.
y - bb.Min.y;
6509 auto slider_width = bb.Max.x - bb.Min.x;
6516 bb.Min.
y = bb.Min.y + (slider_height / 3);
6517 bb.Max.y = bb.Max.y - (slider_height / 3);
6518 if (bb.Max.y - bb.Min.y < 1.0f)
6523 float grab_paddingl = 2.0f;
6525 fill_br.
Min = bb.Min;
6526 fill_br.
Max =
ImVec2(
ImLerp(bb.Min.x, bb.Max.x - grab_paddingl, *v / 100), bb.Max.y);
6527 graber_size = { grab_bb.
Max.
x - (width / 2.0f) , grab_bb.
Max.
y - (height / 2.0f) };
6528 radius = height / 2.5f;
6532 bb.Min.x = bb.Min.x + (slider_width / 3);
6533 bb.Max.x = bb.Max.x - (slider_width / 3);
6534 if (bb.Max.x - bb.Min.x < 1.0f)
6540 fill_br.
Min = bb.Min;
6542 fill_br.
Max = bb.Max;
6543 graber_size = { grab_bb.
Max.
x - (width / 2.0f) , grab_bb.
Max.
y - (height / 2.0f) };
6556 return value_changed;
6561 return SliderInt(label, v, 0, 100, display_format,
true);
6570 bool ImGui::SliderFloat(
const char*
label,
float* v,
float v_min,
float v_max,
const char* display_format,
float power,
bool render_bg)
6592 const bool hovered =
IsHovered(frame_bb,
id);
6596 if (!display_format)
6597 display_format =
"%.3f";
6601 bool start_text_input =
false;
6608 if (tab_focus_requested || g.
IO.
KeyCtrl)
6610 start_text_input =
true;
6620 const bool value_changed =
SliderBehavior(frame_bb,
id, v, v_min, v_max, power, decimal_precision, 0, render_bg);
6627 if (label_size.
x > 0.0f)
6630 return value_changed;
6651 const bool hovered =
IsHovered(frame_bb,
id);
6655 if (!display_format)
6656 display_format =
"%.3f";
6673 if (label_size.
x > 0.0f)
6676 return value_changed;
6681 float v_deg = (*v_rad) * 360.0f / (2*
IM_PI);
6682 bool value_changed =
SliderFloat(label, &v_deg, v_degrees_min, v_degrees_max,
"%.0f deg", 1.0f);
6683 *v_rad = v_deg * (2*
IM_PI) / 360.0f;
6684 return value_changed;
6689 if (!display_format)
6690 display_format =
"%.0f";
6691 float v_f = (float)*v;
6692 bool value_changed =
SliderFloat(label, &v_f, (
float)v_min, (
float)v_max, display_format, 1.0f, render_bg);
6694 return value_changed;
6699 if (!display_format)
6700 display_format =
"%.0f";
6701 float v_f = (float)*v;
6702 bool value_changed =
VSliderFloat(label, size, &v_f, (
float)v_min, (
float)v_max, display_format, 1.0f);
6704 return value_changed;
6715 bool value_changed =
false;
6722 value_changed |=
SliderFloat(
"##v", &v[
i], v_min, v_max, display_format, power);
6732 return value_changed;
6737 return SliderFloatN(label, v, 2, v_min, v_max, display_format, power);
6742 return SliderFloatN(label, v, 3, v_min, v_max, display_format, power);
6747 return SliderFloatN(label, v, 4, v_min, v_max, display_format, power);
6757 bool value_changed =
false;
6764 value_changed |=
SliderInt(
"##v", &v[
i], v_min, v_max, display_format);
6774 return value_changed;
6779 return SliderIntN(label, v, 2, v_min, v_max, display_format);
6784 return SliderIntN(label, v, 3, v_min, v_max, display_format);
6789 return SliderIntN(label, v, 4, v_min, v_max, display_format);
6795 if (!display_format)
6796 display_format =
"%d";
6799 bool value_changed =
ImGui::SliderInt(label, &tmp_val, v_min, v_max, display_format);
6803 tmp_val -= (tmp_val - v_min) % v_step;
6806 return value_changed;
6818 bool value_changed =
false;
6836 float speed = v_speed;
6837 if (speed == 0.0f && (v_max - v_min) != 0.0f && (v_max - v_min) < FLT_MAX)
6845 if (fabsf(power - 1.0f) > 0.001f)
6848 float v0_abs = v_cur >= 0.0f ? v_cur : -v_cur;
6849 float v0_sign = v_cur >= 0.0f ? 1.0f : -1.0f;
6850 float v1 = powf(v0_abs, 1.0f / power) + (delta * v0_sign);
6851 float v1_abs = v1 >= 0.0f ? v1 : -
v1;
6852 float v1_sign = v1 >= 0.0f ? 1.0f : -1.0f;
6853 v_cur = powf(v1_abs, power) * v0_sign * v1_sign;
6863 v_cur =
ImClamp(v_cur, v_min, v_max);
6872 value_changed =
true;
6881 return value_changed;
6884 bool ImGui::DragFloat(
const char*
label,
float* v,
float v_speed,
float v_min,
float v_max,
const char* display_format,
float power)
6907 const bool hovered =
IsHovered(frame_bb,
id);
6911 if (!display_format)
6912 display_format =
"%.3f";
6916 bool start_text_input =
false;
6925 start_text_input =
true;
6934 const bool value_changed =
DragBehavior(frame_bb,
id, v, v_speed, v_min, v_max, decimal_precision, power);
6941 if (label_size.
x > 0.0f)
6944 return value_changed;
6954 bool value_changed =
false;
6961 value_changed |=
DragFloat(
"##v", &v[
i], v_speed, v_min, v_max, display_format, power);
6971 return value_changed;
6974 bool ImGui::DragFloat2(
const char*
label,
float v[2],
float v_speed,
float v_min,
float v_max,
const char* display_format,
float power)
6976 return DragFloatN(label, v, 2, v_speed, v_min, v_max, display_format, power);
6979 bool ImGui::DragFloat3(
const char*
label,
float v[3],
float v_speed,
float v_min,
float v_max,
const char* display_format,
float power)
6981 return DragFloatN(label, v, 3, v_speed, v_min, v_max, display_format, power);
6984 bool ImGui::DragFloat4(
const char*
label,
float v[4],
float v_speed,
float v_min,
float v_max,
const char* display_format,
float power)
6986 return DragFloatN(label, v, 4, v_speed, v_min, v_max, display_format, power);
6989 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)
7000 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);
7003 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);
7011 return value_changed;
7015 bool ImGui::DragInt(
const char*
label,
int* v,
float v_speed,
int v_min,
int v_max,
const char* display_format)
7017 if (!display_format)
7018 display_format =
"%.0f";
7019 float v_f = (float)*v;
7020 bool value_changed =
DragFloat(label, &v_f, v_speed, (
float)v_min, (
float)v_max, display_format);
7022 return value_changed;
7032 bool value_changed =
false;
7039 value_changed |=
DragInt(
"##v", &v[
i], v_speed, v_min, v_max, display_format);
7049 return value_changed;
7054 return DragIntN(label, v, 2, v_speed, v_min, v_max, display_format);
7059 return DragIntN(label, v, 3, v_speed, v_min, v_max, display_format);
7064 return DragIntN(label, v, 4, v_speed, v_min, v_max, display_format);
7067 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)
7078 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);
7081 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);
7089 return value_changed;
7092 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)
7102 if (graph_size.
x == 0.0f)
7104 if (graph_size.
y == 0.0f)
7115 if (scale_min == FLT_MAX || scale_max == FLT_MAX)
7117 float v_min = FLT_MAX;
7118 float v_max = -FLT_MAX;
7119 for (
int i = 0;
i < values_count;
i++)
7121 const float v = values_getter(data,
i);
7122 v_min =
ImMin(v_min, v);
7123 v_max =
ImMax(v_max, v);
7125 if (scale_min == FLT_MAX)
7127 if (scale_max == FLT_MAX)
7141 const int v_idx = (int)(t * item_count);
7142 IM_ASSERT(v_idx >= 0 && v_idx < values_count);
7144 const float v0 = values_getter(data, (v_idx + values_offset) % values_count);
7145 const float v1 = values_getter(data, (v_idx + 1 + values_offset) % values_count);
7147 SetTooltip(
"%d: %8.4g\n%d: %8.4g", v_idx, v0, v_idx+1, v1);
7153 const float t_step = 1.0f / (float)res_w;
7155 float v0 = values_getter(data, (0 + values_offset) % values_count);
7162 for (
int n = 0;
n < res_w;
n++)
7164 const float t1 = t0 + t_step;
7165 const int v1_idx = (int)(t0 * item_count + 0.5f);
7166 IM_ASSERT(v1_idx >= 0 && v1_idx < values_count);
7167 const float v1 = values_getter(data, (v1_idx + values_offset + 1) % values_count);
7175 window->
DrawList->
AddLine(pos0, pos1, v_hovered == v1_idx ? col_hovered : col_base);
7179 if (pos1.
x >= pos0.
x + 2.0f)
7192 if (label_size.
x > 0.0f)
7207 const float v = *(
float*)(
void*)((
unsigned char*)plot_data->
Values + (
size_t)idx * plot_data->
Stride);
7211 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)
7217 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)
7219 PlotEx(
ImGuiPlotType_Lines, label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);
7228 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)
7257 char overlay_buf[32];
7261 overlay = overlay_buf;
7265 if (overlay_size.
x > 0.0f)
7266 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,
ImGuiAlign_Left|
ImGuiAlign_VCenter, &bb.
Min, &bb.
Max);
7283 ImRect total_bb = check_bb;
7284 if (label_size.
x > 0)
7287 if (label_size.
x > 0)
7305 const float pad =
ImMax(1.0f, (
float)(
int)(check_sz / 6.0f));
7311 if (label_size.
x > 0.0f)
7319 bool v = ((*flags & flags_value) == flags_value);
7320 bool pressed =
Checkbox(label, &v);
7324 *flags |= flags_value;
7326 *flags &= ~flags_value;
7346 ImRect total_bb = check_bb;
7347 if (label_size.
x > 0)
7350 if (label_size.
x > 0)
7353 total_bb.
Add(text_bb);
7360 center.
x = (float)(
int)center.
x + 0.5f;
7361 center.
y = (float)(
int)center.
y + 0.5f;
7362 const float radius = check_bb.
GetHeight() * 0.5f;
7371 const float pad =
ImMax(1.0f, (
float)(
int)(check_sz / 6.0f));
7383 if (label_size.
x > 0.0f)
7391 const bool pressed =
RadioButton(label, *v == v_button);
7402 const char* s = text_begin;
7403 while (
char c = *s++)
7407 if (s[0] !=
'\n' && s[0] !=
'\r')
7416 const float line_height = GImGui->
FontSize;
7420 float line_width = 0.0f;
7422 const ImWchar* s = text_begin;
7423 while (s < text_end)
7425 unsigned int c = (
unsigned int)(*s++);
7428 text_size.
x =
ImMax(text_size.
x, line_width);
7429 text_size.
y += line_height;
7431 if (stop_on_new_line)
7439 line_width += char_width;
7442 if (text_size.
x < line_width)
7443 text_size.
x = line_width;
7446 *out_offset =
ImVec2(line_width, text_size.
y + line_height);
7448 if (line_width > 0 || text_size.
y == 0.0f)
7449 text_size.
y += line_height;
7468 const ImWchar* text = obj->Text.Data;
7476 r->
num_chars = (int)(text_remaining - (text + line_start_idx));
7479 static bool is_separator(
unsigned int c) {
return ImCharIsSpace(c) || c==
',' || c==
';' || c==
'(' || c==
')' || c==
'{' || c==
'}' || c==
'[' || c==
']' || c==
'|'; }
7482 #ifdef __APPLE__ // FIXME: Move setting to IO structure 7488 #define STB_TEXTEDIT_MOVEWORDLEFT STB_TEXTEDIT_MOVEWORDLEFT_IMPL // They need to be #define for stb_textedit.h 7489 #define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_IMPL 7508 const int text_len = obj->CurLenW;
7509 if (new_text_len + text_len + 1 > obj->Text.Size)
7513 if (new_text_len_utf8 + obj->CurLenA + 1 > obj->BufSizeA)
7516 ImWchar* text = obj->Text.Data;
7517 if (pos != text_len)
7518 memmove(text + pos + new_text_len, text + pos, (
size_t)(text_len - pos) *
sizeof(
ImWchar));
7519 memcpy(text + pos, new_text, (
size_t)new_text_len *
sizeof(
ImWchar));
7521 obj->CurLenW += new_text_len;
7522 obj->CurLenA += new_text_len_utf8;
7523 obj->Text[obj->CurLenW] =
'\0';
7529 #define STB_TEXTEDIT_K_LEFT 0x10000 // keyboard input to move cursor left 7530 #define STB_TEXTEDIT_K_RIGHT 0x10001 // keyboard input to move cursor right 7531 #define STB_TEXTEDIT_K_UP 0x10002 // keyboard input to move cursor up 7532 #define STB_TEXTEDIT_K_DOWN 0x10003 // keyboard input to move cursor down 7533 #define STB_TEXTEDIT_K_LINESTART 0x10004 // keyboard input to move cursor to start of line 7534 #define STB_TEXTEDIT_K_LINEEND 0x10005 // keyboard input to move cursor to end of line 7535 #define STB_TEXTEDIT_K_TEXTSTART 0x10006 // keyboard input to move cursor to start of text 7536 #define STB_TEXTEDIT_K_TEXTEND 0x10007 // keyboard input to move cursor to end of text 7537 #define STB_TEXTEDIT_K_DELETE 0x10008 // keyboard input to delete selection or character under cursor 7538 #define STB_TEXTEDIT_K_BACKSPACE 0x10009 // keyboard input to delete selection or character left of cursor 7539 #define STB_TEXTEDIT_K_UNDO 0x1000A // keyboard input to perform undo 7540 #define STB_TEXTEDIT_K_REDO 0x1000B // keyboard input to perform redo 7541 #define STB_TEXTEDIT_K_WORDLEFT 0x1000C // keyboard input to move cursor left one word 7542 #define STB_TEXTEDIT_K_WORDRIGHT 0x1000D // keyboard input to move cursor right one word 7543 #define STB_TEXTEDIT_K_SHIFT 0x20000 7545 #define STB_TEXTEDIT_IMPLEMENTATION 7553 CursorFollow =
true;
7562 IM_ASSERT(pos + bytes_count <= BufTextLen);
7564 const char*
src = Buf + pos + bytes_count;
7565 while (
char c = *src++)
7569 if (CursorPos + bytes_count >= pos)
7570 CursorPos -= bytes_count;
7571 else if (CursorPos >= pos)
7573 SelectionStart = SelectionEnd = CursorPos;
7575 BufTextLen -= bytes_count;
7580 const int new_text_len = new_text_end ? (int)(new_text_end - new_text) : (int)strlen(new_text);
7581 if (new_text_len + BufTextLen + 1 >= BufSize)
7584 if (BufTextLen != pos)
7585 memmove(Buf + pos + new_text_len, Buf + pos, (
size_t)(BufTextLen - pos));
7586 memcpy(Buf + pos, new_text, (
size_t)new_text_len *
sizeof(
char));
7587 Buf[BufTextLen + new_text_len] =
'\0';
7589 if (CursorPos >= pos)
7590 CursorPos += new_text_len;
7591 SelectionStart = SelectionEnd = CursorPos;
7593 BufTextLen += new_text_len;
7599 unsigned int c = *p_char;
7601 if (c < 128 && c !=
' ' && !isprint((
int)(c & 0xFF)))
7610 if (c >= 0xE000 && c <= 0xF8FF)
7616 if (!(c >=
'0' && c <=
'9') && (c !=
'.') && (c !=
'-') && (c !=
'+') && (c !=
'*') && (c !=
'/'))
7624 if (c >=
'a' && c <=
'z')
7625 *p_char = (c += (
unsigned int)(
'A'-
'a'));
7639 callback_data.
UserData = user_data;
7716 const bool is_ctrl_down = io.
KeyCtrl;
7717 const bool is_shift_down = io.
KeyShift;
7718 const bool is_alt_down = io.
KeyAlt;
7719 const bool is_super_down = io.
KeySuper;
7720 const bool focus_requested =
FocusableItemRegister(window, g.
ActiveId ==
id, (flags & (ImGuiInputTextFlags_CallbackCompletion|ImGuiInputTextFlags_AllowTabInput)) == 0);
7722 const bool focus_requested_by_tab = focus_requested && !focus_requested_by_code;
7724 const bool hovered =
IsHovered(frame_bb,
id);
7730 const bool user_clicked = hovered && io.
MouseClicked[0];
7734 if (focus_requested || user_clicked || user_scrolled)
7741 const int prev_len_w = edit_state.
CurLenW;
7745 const char* buf_end =
NULL;
7747 edit_state.
CurLenA = (int)(buf_end - buf);
7752 const bool recycle_state = (edit_state.
Id ==
id) && (prev_len_w == edit_state.
CurLenW);
7764 if (!is_multiline && focus_requested_by_code)
7769 if (!is_multiline && (focus_requested_by_tab || (user_clicked && is_ctrl_down)))
7782 bool value_changed =
false;
7783 bool enter_pressed =
false;
7791 const char* buf_end =
NULL;
7793 edit_state.
CurLenA = (int)(buf_end - buf);
7836 if (!(is_ctrl_down && !is_alt_down) && is_editable)
7853 bool cancel_edit =
false;
7855 const bool is_shortcutkey_only = (io.
ShortcutsUseSuperKey ? (is_super_down && !is_alt_down && !is_shift_down && !is_ctrl_down) : (is_ctrl_down && !is_alt_down && !is_shift_down && !is_super_down));
7869 if (!is_multiline || (ctrl_enter_for_new_line && !is_ctrl_down) || (!ctrl_enter_for_new_line && is_ctrl_down))
7872 enter_pressed =
true;
7874 else if (is_editable)
7876 unsigned int c =
'\n';
7881 else if ((flags & ImGuiInputTextFlags_AllowTabInput) &&
IsKeyPressedMap(
ImGuiKey_Tab) && !is_ctrl_down && !is_shift_down && !is_alt_down && is_editable)
7883 unsigned int c =
'\t';
7921 const int clipboard_len = (int)strlen(clipboard);
7923 int clipboard_filtered_len = 0;
7924 for (
const char* s = clipboard; *
s; )
7932 clipboard_filtered[clipboard_filtered_len++] = (
ImWchar)c;
7934 clipboard_filtered[clipboard_filtered_len] = 0;
7935 if (clipboard_filtered_len > 0)
7951 value_changed =
true;
7998 callback_data.
UserData = user_data;
7999 callback_data.
ReadOnly = !is_editable;
8001 callback_data.
EventKey = event_key;
8037 value_changed =
true;
8048 ImVec2 text_size(0.f, 0.f);
8049 if (g.
ActiveId ==
id || (edit_state.
Id ==
id && is_multiline && g.
ActiveId == draw_window->
GetID(
"#SCROLLY")))
8059 ImVec2 cursor_offset, select_start_offset;
8063 const ImWchar* searches_input_ptr[2];
8065 searches_input_ptr[1] =
NULL;
8066 int searches_remaining = 1;
8067 int searches_result_line_number[2] = { -1, -999 };
8071 searches_result_line_number[1] = -1;
8072 searches_remaining++;
8077 searches_remaining += is_multiline ? 1 : 0;
8079 for (
const ImWchar* s = text_begin; *s != 0; s++)
8083 if (searches_result_line_number[0] == -1 && s >= searches_input_ptr[0]) { searches_result_line_number[0] = line_count;
if (--searches_remaining <= 0)
break; }
8084 if (searches_result_line_number[1] == -1 && s >= searches_input_ptr[1]) { searches_result_line_number[1] = line_count;
if (--searches_remaining <= 0)
break; }
8087 if (searches_result_line_number[0] == -1) searches_result_line_number[0] = line_count;
8088 if (searches_result_line_number[1] == -1) searches_result_line_number[1] = line_count;
8092 cursor_offset.
y = searches_result_line_number[0] * g.
FontSize;
8093 if (searches_result_line_number[1] >= 0)
8096 select_start_offset.
y = searches_result_line_number[1] * g.
FontSize;
8110 const float scroll_increment_x = size.
x * 0.25f;
8111 if (cursor_offset.
x < edit_state.
ScrollX)
8112 edit_state.
ScrollX = (float)(
int)
ImMax(0.0f, cursor_offset.
x - scroll_increment_x);
8113 else if (cursor_offset.
x - size.
x >= edit_state.
ScrollX)
8114 edit_state.
ScrollX = (float)(
int)(cursor_offset.
x - size.
x + scroll_increment_x);
8124 float scroll_y = draw_window->
Scroll.
y;
8125 if (cursor_offset.
y - g.
FontSize < scroll_y)
8127 else if (cursor_offset.
y - size.
y >= scroll_y)
8128 scroll_y = cursor_offset.
y - size.
y;
8130 draw_window->
Scroll.
y = scroll_y;
8143 float bg_offy_up = is_multiline ? 0.0f : -1.0f;
8144 float bg_offy_dn = is_multiline ? 0.0f : 2.0f;
8146 ImVec2 rect_pos = render_pos + select_start_offset - render_scroll;
8147 for (
const ImWchar*
p = text_selected_begin;
p < text_selected_end; )
8151 if (rect_pos.
y < clip_rect.
y)
8153 while (
p < text_selected_end)
8160 if (rect_size.
x <= 0.0f) rect_size.
x = (float)(
int)(g.
Font->
GetCharAdvance((
unsigned short)
' ') * 0.50f);
8162 rect.
Clip(clip_rect);
8166 rect_pos.
x = render_pos.
x - render_scroll.x;
8175 ImVec2 cursor_screen_pos = render_pos + cursor_offset - render_scroll;
8176 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);
8177 if (cursor_is_visible && cursor_screen_rect.
Overlaps(clip_rect))
8187 const char* buf_end =
NULL;
8207 if (label_size.
x > 0)
8211 return enter_pressed;
8213 return value_changed;
8219 bool ret =
InputTextEx(label, buf, (
int)buf_size,
ImVec2(0,0), flags, callback, user_data);
8249 bool value_changed =
false;
8264 value_changed =
true;
8270 value_changed =
true;
8275 if (label_size.
x > 0)
8283 return value_changed;
8288 char display_format[16];
8289 if (decimal_precision < 0)
8290 strcpy(display_format,
"%f");
8300 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);
8310 bool value_changed =
false;
8317 value_changed |=
InputFloat(
"##v", &v[
i], 0, 0, decimal_precision, extra_flags);
8328 return value_changed;
8333 return InputFloatN(label, v, 2, decimal_precision, extra_flags);
8338 return InputFloatN(label, v, 3, decimal_precision, extra_flags);
8343 return InputFloatN(label, v, 4, decimal_precision, extra_flags);
8353 bool value_changed =
false;
8360 value_changed |=
InputInt(
"##v", &v[
i], 0, 0, extra_flags);
8371 return value_changed;
8376 return InputIntN(label, v, 2, extra_flags);
8381 return InputIntN(label, v, 3, extra_flags);
8386 return InputIntN(label, v, 4, extra_flags);
8391 const char** items = (
const char**)data;
8393 *out_text = items[
idx];
8400 const char* items_separated_by_zeros = (
const char*)data;
8401 int items_count = 0;
8402 const char*
p = items_separated_by_zeros;
8405 if (idx == items_count)
8418 bool ImGui::Combo(
const char* label,
int* current_item,
const char** items,
int items_count,
int height_in_items,
bool show_arrow_down)
8420 const bool value_changed =
Combo(label, current_item,
Items_ArrayGetter, (
void*)items, items_count, height_in_items);
8421 return value_changed;
8425 bool ImGui::Combo(
const char* label,
int* current_item,
const char* items_separated_by_zeros,
int height_in_items,
bool show_arrow_down)
8427 int items_count = 0;
8428 const char*
p = items_separated_by_zeros;
8434 bool value_changed =
Combo(label, current_item,
Items_SingleStringGetter, (
void*)items_separated_by_zeros, items_count, height_in_items, show_arrow_down);
8435 return value_changed;
8439 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,
bool show_arrow_down)
8458 const bool hovered =
IsHovered(frame_bb,
id);
8460 bool popup_opened_now =
false;
8463 if (show_arrow_down)
8469 if (*current_item >= 0 && *current_item < items_count)
8471 const char* item_text;
8472 if (items_getter(data, *current_item, &item_text))
8476 if (label_size.
x > 0)
8493 popup_open = popup_opened_now =
true;
8498 bool value_changed =
false;
8502 if (height_in_items < 0)
8503 height_in_items = 7;
8506 float popup_y1 = frame_bb.
Max.
y;
8512 popup_y2 = frame_bb.
Min.
y;
8524 for (
int i = 0;
i < items_count;
i++)
8527 const bool item_selected = (i == *current_item);
8528 const char* item_text;
8529 if (!items_getter(data, i, &item_text))
8530 item_text =
"*Unknown item*";
8534 value_changed =
true;
8537 if (item_selected && popup_opened_now)
8545 return value_changed;
8564 ImVec2 size(size_arg.
x != 0.0f ? size_arg.
x : label_size.
x, size_arg.
y != 0.0f ? size_arg.
y : label_size.
y);
8567 ImRect bb(pos, pos + size);
8575 ImRect bb_with_spacing(pos, pos + size_draw);
8576 if (size_arg.
x == 0.0f || (flags & ImGuiSelectableFlags_DrawFillAvailWidth))
8577 bb_with_spacing.
Max.
x += window_padding.
x;
8580 float spacing_L = (float)(
int)(style.
ItemSpacing.
x * 0.5f);
8581 float spacing_U = (float)(
int)(style.
ItemSpacing.
y * 0.5f);
8584 bb_with_spacing.
Min.
x -= spacing_L;
8585 bb_with_spacing.
Min.
y -= spacing_U;
8586 bb_with_spacing.
Max.
x += spacing_R;
8587 bb_with_spacing.
Max.
y += spacing_D;
8588 if (!
ItemAdd(bb_with_spacing, &
id))
8590 if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->
DC.
ColumnsCount > 1)
8601 bool pressed =
ButtonBehavior(bb_with_spacing,
id, &hovered, &held, button_flags);
8602 if (flags & ImGuiSelectableFlags_Disabled)
8606 if (hovered || selected)
8612 if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->
DC.
ColumnsCount > 1)
8632 if (
Selectable(label, *p_selected, flags, size_arg))
8634 *p_selected = !*p_selected;
8660 if (label_size.
x > 0)
8672 if (height_in_items < 0)
8673 height_in_items =
ImMin(items_count, 7);
8674 float height_in_items_f = height_in_items < items_count ? (height_in_items + 0.40f) : (height_in_items + 0.00f);
8699 bool ImGui::ListBox(
const char* label,
int* current_item,
const char** items,
int items_count,
int height_items)
8701 const bool value_changed =
ListBox(label, current_item,
Items_ArrayGetter, (
void*)items, items_count, height_items);
8702 return value_changed;
8705 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)
8711 bool value_changed =
false;
8713 while (clipper.
Step())
8716 const bool item_selected = (
i == *current_item);
8717 const char* item_text;
8718 if (!items_getter(data,
i, &item_text))
8719 item_text =
"*Unknown item*";
8725 value_changed =
true;
8730 return value_changed;
8747 if (shortcut_size.
x > 0.0f)
8762 if (
MenuItem(label, shortcut, p_selected ? *p_selected :
false, enabled))
8765 *p_selected = !*p_selected;
8849 if (menuset_is_open)
8858 float w = label_size.
x;
8876 if (menuset_is_open)
8879 bool want_open =
false, want_close =
false;
8883 bool moving_within_opened_triangle =
false;
8888 ImRect next_window_rect = next_window->Rect();
8890 ImVec2 tb = (window->
Pos.
x < next_window->Pos.x) ? next_window_rect.
GetTL() : next_window_rect.
GetTR();
8892 float extra =
ImClamp(fabsf(ta.
x - tb.
x) * 0.30f, 5.0f, 30.0f);
8893 ta.
x += (window->
Pos.
x < next_window->Pos.x) ? -0.5f : +0.5f;
8894 tb.
y = ta.
y +
ImMax((tb.
y - extra) - ta.
y, -100.0f);
8895 tc.
y = ta.
y +
ImMin((tc.
y + extra) - ta.
y, +100.0f);
8902 want_open = (!menu_is_open && hovered && !moving_within_opened_triangle) || (!menu_is_open && hovered && pressed);
8904 else if (menu_is_open && pressed && menuset_is_open)
8907 want_open = menu_is_open =
false;
8909 else if (pressed || (hovered && menuset_is_open && !menu_is_open))
8923 menu_is_open |= want_open;
8934 return menu_is_open;
8953 const float square_size = g.
FontSize;
8964 SetTooltip(
"Color:\n(%.2f,%.2f,%.2f,%.2f)\n#%02X%02X%02X%02X", col.
x, col.
y, col.
z, col.
w,
IM_F32_TO_INT8(col.
x),
IM_F32_TO_INT8(col.
y),
IM_F32_TO_INT8(col.
z),
IM_F32_TO_INT8(col.
z));
8976 const bool value_changed =
ColorEdit4(label, col4,
false);
8980 return value_changed;
9001 float f[4] = { col[0], col[1], col[2], col[3] };
9008 bool value_changed =
false;
9013 const bool hsv = (edit_mode == 1);
9021 const float w_item_one =
ImMax(1.0f, (
float)(
int)((w_items_all - (style.
ItemInnerSpacing.
x) * (components-1)) / (
float)components));
9022 const float w_item_last =
ImMax(1.0f, (
float)(
int)(w_items_all - (w_item_one + style.
ItemInnerSpacing.
x) * (components-1)));
9024 const bool hide_prefix = (w_item_one <=
CalcTextSize(
"M:999").
x);
9025 const char*
ids[4] = {
"##X",
"##Y",
"##Z",
"##W" };
9026 const char* fmt_table[3][4] =
9028 {
"%3.0f",
"%3.0f",
"%3.0f",
"%3.0f" },
9029 {
"R:%3.0f",
"G:%3.0f",
"B:%3.0f",
"A:%3.0f" },
9030 {
"H:%3.0f",
"S:%3.0f",
"V:%3.0f",
"A:%3.0f" }
9032 const char**
fmt = hide_prefix ? fmt_table[0] : hsv ? fmt_table[2] : fmt_table[1];
9039 if (
n + 1 == components)
9041 value_changed |=
DragInt(ids[
n], &i[n], 1.0f, 0, 255, fmt[n]);
9050 const float w_slider_all = w_full - square_sz;
9059 value_changed |=
true;
9063 i[0] = i[1] = i[2] = i[3] = 0;
9065 sscanf(p,
"%02X%02X%02X%02X", (
unsigned int*)&i[0], (
unsigned int*)&i[1], (
unsigned int*)&i[2], (
unsigned int*)&i[3]);
9067 sscanf(p,
"%02X%02X%02X", (
unsigned int*)&i[0], (
unsigned int*)&i[1], (
unsigned int*)&i[2]);
9076 const ImVec4 col_display(col[0], col[1], col[2], 1.0f);
9082 SetTooltip(
"Color:\n(%.2f,%.2f,%.2f,%.2f)\n#%02X%02X%02X%02X", col[0], col[1], col[2], col[3],
IM_F32_TO_INT8(col[0]),
IM_F32_TO_INT8(col[1]),
IM_F32_TO_INT8(col[2]),
IM_F32_TO_INT8(col[3]));
9087 const char* button_titles[3] = {
"RGB",
"HSV",
"HEX" };
9093 if (label != label_display_end)
9100 for (
int n = 0;
n < 4;
n++)
9101 f[
n] = i[
n] / 255.0f;
9117 return value_changed;
9136 float x1 = window->
Pos.
x;
9222 window->
DC.
CursorPos = group_data.BackupCursorPos;
9226 window->
DC.
IndentX = group_data.BackupIndentX;
9229 if (group_data.AdvanceCursor)
9232 ItemSize(group_bb.
GetSize(), group_data.BackupCurrentLineTextBaseOffset);
9255 if (spacing_w < 0.0f) spacing_w = 0.0f;
9340 return (
float)(int)x;
9347 if (column_index < 0)
9357 IM_ASSERT(column_index < window->DC.ColumnsData.Size);
9360 return (
float)(int)x_offset;
9366 if (column_index < 0)
9369 IM_ASSERT(column_index < window->DC.ColumnsData.Size);
9380 if (column_index < 0)
9390 if (column_index < 0)
9431 if (hovered || held)
9436 const float xi = (float)(
int)
x;
9451 PushID(0x11223347 + (
id ? 0 : columns_count));
9472 for (
int column_index = 0; column_index < columns_count + 1; column_index++)
9476 const float default_t = column_index / (float)window->
DC.
ColumnsCount;
9511 PushID(str_id ? str_id :
"#TreePush");
9519 PushID(ptr_id ? ptr_id : (
const void*)
"#TreePush");
9540 Text(
"%s: %s", prefix, (b ?
"true" :
"false"));
9545 Text(
"%s: %d", prefix, v);
9550 Text(
"%s: %d", prefix, v);
9559 Text(fmt, prefix, v);
9563 Text(
"%s: %.3f", prefix, v);
9570 Text(
"%s: (%.2f,%.2f,%.2f,%.2f)", prefix, v.
x, v.
y, v.
z, v.
w);
9577 Text(
"%s: %08X", prefix, v);
9581 col.
x = (float)((v >> 0) & 0xFF) / 255.0f;
9582 col.
y = (float)((v >> 8) & 0xFF) / 255.0f;
9583 col.
z = (float)((v >> 16) & 0xFF) / 255.0f;
9584 col.
w = (float)((v >> 24) & 0xFF) / 255.0f;
9592 #if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS)) 9593 #undef WIN32_LEAN_AND_MEAN 9594 #define WIN32_LEAN_AND_MEAN 9595 #include <windows.h> 9599 #if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS) 9602 #pragma comment(lib, "user32") 9607 static char* buf_local =
NULL;
9613 if (!OpenClipboard(
NULL))
9615 HANDLE wbuf_handle = GetClipboardData(CF_UNICODETEXT);
9616 if (wbuf_handle ==
NULL)
9624 GlobalUnlock(wbuf_handle);
9631 if (!OpenClipboard(
NULL))
9635 HGLOBAL wbuf_handle = GlobalAlloc(GMEM_MOVEABLE, (SIZE_T)wbuf_length *
sizeof(
ImWchar));
9636 if (wbuf_handle ==
NULL)
9640 GlobalUnlock(wbuf_handle);
9642 SetClipboardData(CF_UNICODETEXT, wbuf_handle);
9663 const char* text_end = text + strlen(text);
9672 #if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS) 9676 #pragma comment(lib, "imm32") 9683 if (HIMC himc = ImmGetContext(hwnd))
9686 cf.ptCurrentPos.x =
x;
9687 cf.ptCurrentPos.y =
y;
9688 cf.dwStyle = CFS_FORCE_POSITION;
9689 ImmSetCompositionWindow(himc, &cf);
9711 static bool show_clip_rects =
true;
9712 ImGui::Checkbox(
"Show clipping rectangles when hovering a ImDrawCmd", &show_clip_rects);
9717 static void NodeDrawList(
ImDrawList* draw_list,
const char* label)
9732 int elem_offset = 0;
9735 if (pcmd->UserCallback)
9737 ImGui::BulletText(
"Callback %p, user_data %p", pcmd->UserCallback, pcmd->UserCallbackData);
9741 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);
9744 ImRect clip_rect = pcmd->ClipRect;
9746 for (
int i = elem_offset;
i < elem_offset + (int)pcmd->ElemCount;
i++)
9747 vtxs_rect.
Add(draw_list->
VtxBuffer[idx_buffer ? idx_buffer[
i] :
i].pos);
9751 if (!pcmd_node_open)
9754 while (clipper.
Step())
9757 char buf[300], *buf_p =
buf;
9759 for (
int n = 0;
n < 3;
n++, vtx_i++)
9762 triangles_pos[
n] = v.
pos;
9763 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);
9767 overlay_draw_list->
AddPolyline(triangles_pos, 3,
IM_COL32(255,255,0,255),
true, 1.0f,
false);
9779 for (
int i = 0;
i < windows.
Size;
i++)
9780 Funcs::NodeWindow(windows[
i],
"Window");
9788 NodeDrawList(window->
DrawList,
"DrawList");
9797 Funcs::NodeWindows(g.
Windows,
"Windows");
9830 #ifdef IMGUI_INCLUDE_IMGUI_USER_INL 9831 #include "imgui_user.inl"
void Add(const ImVec2 &rhs)
static bool InputTextFilterCharacter(unsigned int *p_char, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void *user_data)
IMGUI_API void PushStyleVar(ImGuiStyleVar idx, float val)
static void Scrollbar(ImGuiWindow *window, bool horizontal)
ImRect SetNextWindowSizeConstraintRect
static int ImMax(int lhs, int rhs)
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, ImGuiAlign align=ImGuiAlign_Default, const ImVec2 *clip_min=NULL, const ImVec2 *clip_max=NULL)
ImGuiSetCond SetNextTreeNodeOpenCond
IMGUI_API bool FocusableItemRegister(ImGuiWindow *window, bool is_active, bool tab_stop=true)
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))
ImGuiWindow * RootNonPopupWindow
int FocusIdxTabRequestNext
IMGUI_API float GetCursorPosX()
IMGUI_API void AddRectFilled(const ImVec2 &a, const ImVec2 &b, ImU32 col, float rounding=0.0f, int rounding_corners=0x0F)
bool HasSelection() const
void PathStroke(ImU32 col, bool closed, float thickness=1.0f)
IMGUI_API bool IsKeyPressed(int key_index, bool repeat=true)
IMGUI_API float * GetFloatRef(ImGuiID key, float default_val=0.0f)
static int ChildWindowComparer(const void *lhs, const void *rhs)
IMGUI_API ImVec2 GetCursorStartPos()
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 bool BeginChildFrame(ImGuiID id, const ImVec2 &size, ImGuiWindowFlags extra_flags=0)
GLboolean GLboolean GLboolean b
static int stb_textedit_cut(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
void Clip(const ImRect &clip)
static const char * GetClipboardTextFn_DefaultImpl()
IMGUI_API bool RadioButton(const char *label, bool active)
#define STB_TEXTEDIT_K_LINESTART
IMGUI_API void OpenPopupEx(const char *str_id, bool reopen_existing)
IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiSetCond cond=0)
IMGUI_API ImVec2 GetCursorPos()
static ImVector< ImGuiStorage::Pair >::iterator LowerBound(ImVector< ImGuiStorage::Pair > &data, ImU32 key)
void(* MemFreeFn)(void *ptr)
IMGUI_API bool BeginPopupContextItem(const char *str_id, int mouse_button=1)
IMGUI_API void SetTooltip(const char *fmt,...) IM_PRINTFARGS(1)
IMGUI_API void BulletText(const char *fmt,...) IM_PRINTFARGS(1)
IMGUI_API void SetScrollFromPosY(float pos_y, float center_y_ratio=0.5f)
static ImGuiWindow * FindHoveredWindow(ImVec2 pos, bool excluding_childs)
typedef void(APIENTRY *GLDEBUGPROC)(GLenum source
static ImWchar STB_TEXTEDIT_NEWLINE
GLuint const GLchar * name
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)
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))
bool DoubleClickSelectsWord
IMGUI_API void SetVoidPtr(ImGuiID key, void *val)
float ModalWindowDarkeningRatio
ImGuiWindow * ParentWindow
ImGuiWindow * FocusedWindow
IMGUI_API void PopTextureID()
IMGUI_API bool TreeNodeExV(const char *str_id, ImGuiTreeNodeFlags flags, const char *fmt, va_list args)
ImVec2 ActiveIdClickOffset
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 LabelTextV(const char *label, const char *fmt, va_list args)
static void SetWindowScrollY(ImGuiWindow *window, float new_scroll_y)
static void SetCursorPosYAndSetupDummyPrevLine(float pos_y, float line_height)
IMGUI_API ImGuiStorage * GetStateStorage()
IMGUI_API void PopClipRect()
void OnKeyPressed(int key)
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)
#define IM_F32_TO_INT8(_VAL)
IMGUI_API const char * FindRenderedTextEnd(const char *text, const char *text_end=NULL)
IMGUI_API void Icon(const char *icon)
IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiSetCond cond=0)
IMGUI_API bool IsRootWindowFocused()
IMGUI_API void ChannelsSetCurrent(int channel_index)
IMGUI_API bool IsWindowFocused()
static void stb_textedit_initialize_state(STB_TexteditState *state, int is_single_line)
IMGUI_API bool InputInt3(const char *label, int v[3], ImGuiInputTextFlags extra_flags=0)
IMGUI_API void SetCursorPos(const ImVec2 &local_pos)
ImGuiLayoutType LayoutType
static bool is_separator(unsigned int c)
void resize(int new_size)
ImGuiSetCond SetNextWindowPosCond
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
int ImTextStrToUtf8(char *buf, int buf_size, const ImWchar *in_text, const ImWchar *in_text_end)
ImVec2 SetNextWindowContentSizeVal
GLenum GLenum GLenum GLenum GLenum scale
unsigned char insert_mode
IMGUI_API void ValueColor(const char *prefix, const ImVec4 &v)
static GLFWwindow * window
int ImStrlenW(const ImWchar *str)
IMGUI_API bool IsMouseClicked(int button, bool repeat=false)
IMGUI_API bool IsItemClicked(int mouse_button=0)
bool SetNextWindowCollapsedVal
float CurveTessellationTol
GLdouble GLdouble GLdouble y2
IMGUI_API void SetWindowPos(const ImVec2 &pos, ImGuiSetCond cond=0)
bool ActiveIdAllowOverlap
IMGUI_API void PopTextWrapPos()
ImGuiStorage ColorEditModeStorage
int CaptureKeyboardNextFrame
ImVec2 ScrollbarClickDeltaToGrabCenter
static void stb_textedit_click(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y)
ImGuiInputTextFlags Flags
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)
int FramerateSecPerFrameIdx
IMGUI_API void ClearFreeMemory()
IMGUI_API void AddInputCharactersUTF8(const char *utf8_chars)
static ImFontAtlas GImDefaultFontAtlas
IMGUI_API ImVec2 GetItemRectMin()
IMGUI_API bool IsItemActive()
static bool Items_SingleStringGetter(void *data, int idx, const char **out_text)
IMGUI_API void * MemAlloc(size_t sz)
IMGUI_API void SetHoveredID(ImGuiID id)
ImDrawList OverlayDrawList
int FocusIdxAllRequestCurrent
IMGUI_API void SetNextWindowFocus()
IMGUI_API ImVec2 GetMouseDragDelta(int button=0, float lock_threshold=-1.0f)
static float * GetStyleVarFloatAddr(ImGuiStyleVar idx)
IMGUI_API void NewFrame()
IMGUI_API const char * GetStyleColName(ImGuiCol idx)
IMGUI_API bool IsRootWindowOrAnyChildHovered()
float CalcExtraSpace(float avail_w)
static const textual_icon repeat
static bool IsWindowContentHoverable(ImGuiWindow *window)
IMGUI_API void SetNextWindowPos(const ImVec2 &pos, ImGuiSetCond cond=0)
IMGUI_API void EndTooltip()
IMGUI_API bool InputInt4(const char *label, int v[4], ImGuiInputTextFlags extra_flags=0)
ImVector< ImGuiIniData > Settings
IMGUI_API void LogButtons()
IMGUI_API int GetKeyIndex(ImGuiKey key)
IMGUI_API bool BeginPopupContextWindow(bool also_over_items=true, const char *str_id=NULL, int mouse_button=1)
ImGuiID MovedWindowMoveId
float TitleBarHeight() const
IMGUI_API void CaptureMouseFromApp(bool capture=true)
static const char * log_to_file
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
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)
static ImWchar STB_TEXTEDIT_GETCHAR(const STB_TEXTEDIT_STRING *obj, int idx)
IMGUI_API bool IsMouseHoveringRect(const ImVec2 &r_min, const ImVec2 &r_max, bool clip=true)
ImGuiSetCond SetNextWindowContentSizeCond
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)
IMGUI_API void PushClipRect(const ImVec2 &clip_rect_min, const ImVec2 &clip_rect_max, bool intersect_with_current_clip_rect)
GLenum GLuint GLint GLint layer
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)
static void LoadSettings()
IMGUI_API void ShowMetricsWindow(bool *p_open=NULL)
bool Draw(const char *label="Filter (inc,-exc)", float width=0.0f)
static ImGuiWindow * CreateNewWindow(const char *name, ImVec2 size, ImGuiWindowFlags flags)
static void SetCurrentFont(ImFont *font)
IMGUI_API void BeginTooltip()
IMGUI_API void BulletTextV(const char *fmt, va_list args)
IMGUI_API bool TreeNodeEx(const char *label, ImGuiTreeNodeFlags flags=0)
static int STB_TEXTEDIT_STRINGLEN(const STB_TEXTEDIT_STRING *obj)
ImVec2 SetNextWindowSizeVal
IMGUI_API bool IsMouseHoveringAnyWindow()
float KeysDownDuration[512]
#define STB_TEXTEDIT_K_UNDO
bool ShortcutsUseSuperKey
void swap(ImVector< T > &rhs)
bool LastItemHoveredAndUsable
GLdouble GLdouble GLdouble w
IMGUI_API bool * GetBoolRef(ImGuiID key, bool default_val=false)
static void ApplySizeFullWithConstraint(ImGuiWindow *window, ImVec2 new_size)
static void stb_textedit_key(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int key)
static void SetWindowSize(ImGuiWindow *window, const ImVec2 &size, ImGuiSetCond cond)
IMGUI_API void Indent(float indent_w=0.0f)
#define STB_TEXTEDIT_K_TEXTEND
IMGUI_API void AddTriangleFilled(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, ImU32 col)
float BackupCurrentLineTextBaseOffset
IMGUI_API void PushTextWrapPos(float wrap_pos_x=0.0f)
IMGUI_API void PushButtonRepeat(bool repeat)
ImVec2 SetNextWindowPosVal
static float ImFloor(float f)
ImGuiStorage StateStorage
ImVec2 MouseClickedPos[5]
IMGUI_API void ResetMouseDragDelta(int button=0)
IMGUI_API bool IsWindowHovered()
ImVector< ImDrawList * > RenderDrawLists[3]
bool MouseDoubleClicked[5]
int ImStricmp(const char *str1, const char *str2)
ImGuiAlign WindowTitleAlign
char * ImStrdup(const char *str)
IMGUI_API bool IsItemHoveredRect()
GLfloat GLfloat GLfloat GLfloat h
IMGUI_API ImGuiMouseCursor GetMouseCursor()
IMGUI_API float GetColumnOffset(int column_index=-1)
ImGuiColorEditMode ColorEditMode
IMGUI_API bool ColorButton(const ImVec4 &col, bool small_height=false, bool outline_border=true)
int ImTextCountUtf8BytesFromStr(const ImWchar *in_text, const ImWchar *in_text_end)
#define STB_TEXTEDIT_K_SHIFT
#define IM_ARRAYSIZE(_ARR)
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 void TextDisabled(const char *fmt,...) IM_PRINTFARGS(1)
IMGUI_API bool InputText(const char *label, char *buf, size_t buf_size, ImGuiInputTextFlags flags=0, ImGuiTextEditCallback callback=NULL, void *user_data=NULL)
ImVector< ImFont * > Fonts
IMGUI_API ImVec2 GetItemRectSize()
static void CloseInactivePopups()
IMGUI_API float GetWindowWidth()
IMGUI_API void ** GetVoidPtrRef(ImGuiID key, void *default_val=NULL)
IMGUI_API bool SliderInt(const char *label, int *v, int v_min, int v_max, const char *display_format="%.0f", bool render_bg=false)
static bool BeginPopupEx(const char *str_id, ImGuiWindowFlags extra_flags)
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)
IMGUI_API void TextDisabledV(const char *fmt, va_list args)
ImVector< ImFont * > FontStack
void(* ImeSetInputScreenPosFn)(int x, int y)
IMGUI_API bool TreeNodeV(const char *str_id, const char *fmt, va_list args)
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()
ImGuiTextFilter(const char *default_filter="")
IMGUI_API void AlignFirstTextHeightToWidgets()
#define STB_TEXTEDIT_K_DOWN
GLboolean GLboolean GLboolean GLboolean a
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))
ImGuiSetCond SetNextWindowCollapsedCond
IMGUI_API void MemFree(void *ptr)
IMGUI_API ImGuiContext * CreateContext(void *(*malloc_fn)(size_t)=NULL, void(*free_fn)(void *)=NULL)
#define STB_TEXTEDIT_K_LINEEND
#define STB_TEXTEDIT_GETWIDTH_NEWLINE
GLenum GLuint GLenum GLsizei const GLchar * buf
static bool DataTypeApplyOpFromText(const char *buf, const char *initial_value_buf, ImGuiDataType data_type, void *data_ptr, const char *scalar_format)
IMGUI_API ImVec2 GetMousePos()
static void DataTypeFormatString(ImGuiDataType data_type, void *data_ptr, const char *display_format, char *buf, int buf_size)
static void ClosePopupToLevel(int remaining)
ImGuiTextBuffer * LogClipboard
IMGUI_API bool InputFloat3(const char *label, float v[3], int decimal_precision=-1, ImGuiInputTextFlags extra_flags=0)
GLuint GLuint GLuint GLuint arg1
IMGUI_API void PushAllowKeyboardFocus(bool v)
IMGUI_API void appendv(const char *fmt, va_list args)
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)
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()
static void AddWindowToRenderList(ImVector< ImDrawList * > &out_render_list, ImGuiWindow *window)
ImRect MenuBarRect() const
ImGuiSimpleColumns MenuColumns
static void LogRenderedText(const ImVec2 &ref_pos, const char *text, const char *text_end=NULL)
IMGUI_API void CaptureKeyboardFromApp(bool capture=true)
void * ImLoadFileToMemory(const char *filename, const char *file_open_mode, int *out_file_size, int padding_bytes)
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
GLfloat GLfloat GLfloat alpha
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)
IMGUI_API void PopStyleVar(int count=1)
IMGUI_API void SetScrollY(float scroll_y)
ImVec2 SizeContentsExplicit
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)
static void CheckStacksSize(ImGuiWindow *window, bool write)
ImGuiStb::STB_TexteditState StbState
IMGUI_API ImVec2 GetWindowContentRegionMin()
IMGUI_API void AddDrawCmd()
IMGUI_API bool IsPosHoveringAnyWindow(const ImVec2 &pos)
IMGUI_API bool ListBoxHeader(const char *label, const ImVec2 &size=ImVec2(0, 0))
IMGUI_API void Dummy(const ImVec2 &size)
IMGUI_API void SetNextWindowPosCenter(ImGuiSetCond cond=0)
IMGUI_API void KeepAliveID(ImGuiID id)
static bool ImCharIsSpace(int c)
const char * str_end(const char *s, const char *)
void Expand(const float amount)
IMGUI_API bool IsAnyItemHovered()
static bool STB_TEXTEDIT_INSERTCHARS(STB_TEXTEDIT_STRING *obj, int pos, const ImWchar *new_text, int new_text_len)
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 bool IsMouseDragging(int button=0, float lock_threshold=-1.0f)
static float ImLengthSqr(const ImVec2 &lhs)
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)
static float STB_TEXTEDIT_GETWIDTH(STB_TEXTEDIT_STRING *obj, int line_start_idx, int char_idx)
GLenum GLint GLint * precision
static ImGuiIniData * FindWindowSettings(const char *name)
ImGuiTextEditState InputTextState
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)
static void SetWindowCollapsed(ImGuiWindow *window, bool collapsed, ImGuiSetCond cond)
ImU32 ImHash(const void *data, int data_size, ImU32 seed)
float MouseDownDuration[5]
static bool Items_ArrayGetter(void *data, int idx, const char **out_text)
ImVector< ImGuiColMod > ColorModifiers
ImGuiWindow * MovedWindow
IMGUI_API bool ColorEdit3(const char *label, float col[3])
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)
static ImGuiIniData * AddWindowSettings(const char *name)
IMGUI_API int GetColumnsCount()
static ImRect GetVisibleRect()
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
ImGuiWindow * ActiveIdWindow
void(* SetClipboardTextFn)(const char *text)
ImVector< ImGuiStyleMod > StyleModifiers
IMGUI_API void LabelText(const char *label, const char *fmt,...) IM_PRINTFARGS(2)
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
static bool IsKeyPressedMap(ImGuiKey key, bool repeat=true)
void(* ImGuiSizeConstraintCallback)(ImGuiSizeConstraintCallbackData *data)
float KeysDownDurationPrev[512]
IMGUI_API ImGuiIO & GetIO()
GLint GLsizei GLsizei height
IMGUI_API bool InputScalarAsWidgetReplacement(const ImRect &aabb, const char *label, ImGuiDataType data_type, void *data_ptr, ImGuiID id, int decimal_precision)
IMGUI_API bool SeekSlider(const char *label, int *v, const char *display_format="%.0f%%")
IMGUI_API void SetNextWindowSize(const ImVec2 &size, ImGuiSetCond cond=0)
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 bool ListBox(const char *label, int *current_item, const char **items, int items_count, int height_in_items=-1)
IMGUI_API bool IsRootWindowOrAnyChildFocused()
IMGUI_API bool InputFloat4(const char *label, float v[4], int decimal_precision=-1, ImGuiInputTextFlags extra_flags=0)
static void STB_TEXTEDIT_DELETECHARS(STB_TEXTEDIT_STRING *obj, int pos, int n)
IMGUI_API ImFont * GetFont()
IMGUI_API void EndGroup()
static int ImTextCharToUtf8(char *buf, int buf_size, unsigned int c)
IMGUI_API float GetTime()
IMGUI_API void TextV(const char *fmt, va_list args)
IMGUI_API int GetColumnIndex()
IMGUI_API void ChannelsMerge()
IMGUI_API void LogToFile(int max_depth=-1, const char *filename=NULL)
ImGuiID ActiveIdPreviousFrame
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()
static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(STB_TEXTEDIT_STRING *obj, int idx)
void reserve(int new_capacity)
IMGUI_API void SetWindowFocus()
ImVector< bool > ButtonRepeatStack
IMGUI_API bool IsWindowCollapsed()
IMGUI_API void SetCursorPosX(float x)
GLenum GLenum GLsizei const GLuint GLboolean enabled
IMGUI_API float GetContentRegionAvailWidth()
GLint GLint GLsizei GLint border
IMGUI_API int GetInt(ImGuiID key, int default_val=0) const
IMGUI_API void ColorEditMode(ImGuiColorEditMode mode)
int ImTextCountCharsFromUtf8(const char *in_text, const char *in_text_end)
static int STB_TEXTEDIT_KEYTOTEXT(int key)
float CalcFontSize() const
ImVector< float > IndexXAdvance
GLdouble GLdouble GLint stride
IMGUI_API void PushItemWidth(float item_width)
static ImGuiContext GImDefaultContext
IMGUI_API void Text(const char *fmt,...) IM_PRINTFARGS(1)
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
static bool IsPopupOpen(ImGuiID id)
int FocusIdxTabRequestCurrent
IMGUI_API ImGuiWindow * GetParentWindow()
IMGUI_API void Separator()
#define STB_TEXTEDIT_K_DELETE
ImVector< bool > AllowKeyboardFocusStack
static int ImTextCountUtf8BytesFromChar(unsigned int c)
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 AddImage(ImTextureID user_texture_id, const ImVec2 &a, const ImVec2 &b, const ImVec2 &uv0=ImVec2(0, 0), const ImVec2 &uv1=ImVec2(1, 1), ImU32 col=0xFFFFFFFF)
IMGUI_API void Begin(int items_count, float items_height=-1.0f)
IMGUI_API bool IsKeyReleased(int key_index)
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)
static int is_word_boundary_from_right(STB_TEXTEDIT_STRING *obj, int idx)
unsigned int _VtxCurrentIdx
static int InputTextCalcTextLenAndLineCount(const char *text_begin, const char **out_text_end)
bool ImIsPointInTriangle(const ImVec2 &p, const ImVec2 &a, const ImVec2 &b, const ImVec2 &c)
IMGUI_API bool IsHovered(const ImRect &bb, ImGuiID id, bool flatten_childs=false)
IMGUI_API float GetColumnWidth(int column_index=-1)
IMGUI_API ImVec2 GetWindowSize()
GLenum GLenum GLuint components
float PrevLineTextBaseOffset
void Update(int count, float spacing, bool clear)
IMGUI_API void EndPopup()
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 RenderBullet(ImVec2 pos)
IMGUI_API void NextColumn()
ImVector< ImGuiPopupRef > OpenPopupStack
float DeclColumns(float w0, float w1, float w2)
IMGUI_API void RenderCollapseTriangle(ImVec2 pos, bool is_open, float scale=1.0f, bool shadow=false)
IMGUI_API void PushStyleColor(ImGuiCol idx, const ImVec4 &col)
IMGUI_API float GetWindowHeight()
static ImVec2 FindBestPopupWindowPos(const ImVec2 &base_pos, const ImVec2 &size, int *last_dir, const ImRect &rect_to_avoid)
static void MarkSettingsDirty()
IMGUI_API bool ButtonEx(const char *label, const ImVec2 &size_arg=ImVec2(0, 0), ImGuiButtonFlags flags=0)
#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 void SetNextTreeNodeOpen(bool is_open, ImGuiSetCond cond=0)
IMGUI_API ImU32 ColorConvertFloat4ToU32(const ImVec4 &in)
ImVec2 DisplaySafeAreaPadding
IMGUI_API bool SliderFloatN(const char *label, float *v, int components, float v_min, float v_max, const char *display_format, float power)
const Glyph * FallbackGlyph
IMGUI_API bool Combo(const char *label, int *current_item, const char **items, int items_count, int height_in_items=-1, bool show_arrow_down=true)
static int stb_textedit_paste(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE const *ctext, int len)
const char *(* GetClipboardTextFn)()
IMGUI_API void PushFont(ImFont *font)
ImGuiWindow * CurrentWindow
ImVec2 DisplayWindowPadding
IMGUI_API void SetClipboardText(const char *text)
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint GLdouble GLdouble w2
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 void SetTooltipV(const char *fmt, va_list args)
static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL(STB_TEXTEDIT_STRING *obj, int idx)
IMGUI_API bool BeginMenu(const char *label, bool enabled=true)
IMGUI_API float GetTextLineHeightWithSpacing()
GLsizei const GLfloat * values
iterator insert(const_iterator it, const value_type &v)
GLdouble GLdouble GLint GLint GLdouble v1
int LogAutoExpandMaxDepth
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, bool render_bg=false)
bool SetNextWindowSizeConstraint
IMGUI_API void ListBoxFooter()
float FramerateSecPerFrame[120]
ImVec4 Colors[ImGuiCol_COUNT]
IMGUI_API bool SliderIntWithSteps(const char *label, int *v, int v_min, int v_max, int v_step=1, const char *display_format="%.3f")
IMGUI_API void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border=true, float rounding=0.0f)
IMGUI_API void append(const char *fmt,...) IM_PRINTFARGS(2)
IMGUI_API float CalcItemWidth()
static int ImMin(int lhs, int rhs)
IMGUI_API void SetInt(ImGuiID key, int val)
static float Plot_ArrayGetter(void *data, int idx)
ImDrawCallback UserCallback
GLuint GLfloat GLfloat GLfloat x1
IMGUI_API bool SliderFloat(const char *label, float *v, float v_min, float v_max, const char *display_format="%.3f", float power=1.0f, bool render_bg=false)
int SetWindowSizeAllowFlags
IMGUI_API void DestroyContext(ImGuiContext *ctx)
static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow *r, STB_TEXTEDIT_STRING *obj, int line_start_idx)
IMGUI_API void LogToTTY(int max_depth=-1)
static void ClosePopup(ImGuiID id)
float MouseDoubleClickMaxDist
ImDrawVert * _VtxWritePtr
IMGUI_API ImVec2 GetCursorScreenPos()
IMGUI_API ImGuiWindow * FindWindowByName(const char *name)
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")
GLdouble GLdouble GLdouble q
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)
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)
static void SetCurrentWindow(ImGuiWindow *window)
IMGUI_API bool IsItemVisible()
static void SaveSettings()
IMGUI_API int * GetIntRef(ImGuiID key, int default_val=0)
static float ImSaturate(float f)
IMGUI_API bool ButtonBehavior(const ImRect &bb, ImGuiID id, bool *out_hovered, bool *out_held, ImGuiButtonFlags flags=0)
#define STB_TEXTEDIT_STRING
ImGuiSetCond SetNextWindowSizeCond
ImVector< float > TextWrapPosStack
IMGUI_API void TextColoredV(const ImVec4 &col, const char *fmt, va_list args)
ImWchar InputCharacters[16+1]
IMGUI_API void EndFrame()
GLuint GLsizei const GLchar * label
IMGUI_API float GetTextLineHeight()
IMGUI_API bool SliderInt2(const char *label, int v[2], int v_min, int v_max, const char *display_format="%.0f")
int SetWindowPosAllowFlags
IMGUI_API bool IsMouseHoveringWindow()
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,...)
static void AddWindowToSortedBuffer(ImVector< ImGuiWindow * > &out_sorted_windows, ImGuiWindow *window)
static void ImeSetInputScreenPosFn_DefaultImpl(int x, int y)
static void SetClipboardTextFn_DefaultImpl(const char *text)
static ImGuiWindow * GetFrontMostModalRootWindow()
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)
IMGUI_API const char * GetClipboardText()
ImVector< short > IndexLookup
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)
static void PushColumnClipRect(int column_index=-1)
ImVec2 GetClosestPoint(ImVec2 p, bool on_edge) const
IMGUI_API void PopButtonRepeat()
IMGUI_API bool ColorEdit4(const char *label, float col[4], bool show_alpha=true)
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 bool VSliderInt(const char *label, const ImVec2 &size, int *v, int v_min, int v_max, const char *display_format="%.0f")
IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul=1.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()
int SetWindowCollapsedAllowFlags
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
bool SetWindowPosCenterWanted
IMGUI_API void EndMenuBar()
IMGUI_API const char * GetVersion()
IMGUI_API void SetContentRegionWidth(float y)
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)
ImVector< ImGuiID > IDStack
ImGuiMouseCursor MouseCursor
bool SelectedAllMouseLock
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 TextWrappedV(const char *fmt, va_list args)
IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, float &out_h, float &out_s, float &out_v)
IMGUI_API void SetItemAllowOverlap()
IMGUI_API void CloseCurrentPopup()
IMGUI_API void PushClipRectFullScreen()
IMGUI_API bool IsKeyDown(int key_index)
static int ImClamp(int v, int mn, int mx)
IMGUI_API void PopClipRect()
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 void AddRect(const ImVec2 &a, const ImVec2 &b, ImU32 col, float rounding=0.0f, int rounding_corners=0x0F, float thickness=1.0f)
bool WordMovementUsesAltKey
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)
ImVector< char > InitialText
IMGUI_API void TextWrapped(const char *fmt,...) IM_PRINTFARGS(1)
IMGUI_API void SetCursorPosY(float y)
static void AddDrawListToRenderList(ImVector< ImDrawList * > &out_render_list, ImDrawList *draw_list)
ImVec2 DragLastMouseDelta
ImVec2 BackupCursorMaxPos
ImVector< ImDrawIdx > IdxBuffer
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, bool render_bg=false)
static void stb_textedit_drag(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y)
IMGUI_API ImDrawData * GetDrawData()
IMGUI_API void Columns(int count=1, const char *id=NULL, bool border=true)
ImGuiStorage * StateStorage
IMGUI_API void SetWindowFontScale(float scale)
static void DataTypeApplyOp(ImGuiDataType data_type, int op, void *value1, const void *value2)
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
static float ImLerp(float a, float b, float t)
ImGuiWindow * HoveredWindow
IMGUI_API bool IsAnyItemActive()
float ChildWindowRounding
static void SetWindowPos(ImGuiWindow *window, const ImVec2 &pos, ImGuiSetCond cond)
bool Overlaps(const ImRect &r) const
float BackupCurrentLineHeight
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 bool IsItemHovered()
IMGUI_API void SetKeyboardFocusHere(int offset=0)
int CaptureMouseNextFrame
static float GetDraggedColumnOffset(int column_index)
IMGUI_API void LogText(const char *fmt,...) IM_PRINTFARGS(1)
IMGUI_API void LogFinish()
IMGUI_API void SetWindowSize(const ImVec2 &size, ImGuiSetCond cond=0)
static void ClearSetNextWindowData()
static ImVec2 * GetStyleVarVec2Addr(ImGuiStyleVar idx)
IMGUI_API int ParseFormatPrecision(const char *fmt, int default_value)
ImGuiWindow * GetCurrentWindowRead()
IMGUI_API void SetScrollX(float scroll_x)
ImVector< ImGuiPopupRef > CurrentPopupStack
IMGUI_API const Glyph * FindGlyph(ImWchar c) const
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)
IMGUI_API ImVec4 ColorConvertU32ToFloat4(ImU32 in)
IMGUI_API void PopStyleColor(int count=1)
static void PushMultiItemsWidths(int components, float w_full=0.0f)
ImVector< ImGuiWindow * > ChildWindows
char TempBuffer[1024 *3+1]
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint GLdouble w1
ImVector< ImVec4 > _ClipRectStack
IMGUI_API void EndMainMenuBar()
IMGUI_API void TextColored(const ImVec4 &col, const char *fmt,...) IM_PRINTFARGS(2)
IMGUI_API ImVec2 CalcItemRectClosestPoint(const ImVec2 &pos, bool on_edge=false, float outward=+0.0f)
void Reduce(const ImVec2 &amount)