Browse Source

Updated imgui to v1.33

Thomas Buck 9 years ago
parent
commit
6f206c9af0
3 changed files with 250 additions and 148 deletions
  1. 3
    0
      ChangeLog.md
  2. 227
    128
      src/deps/imgui/imgui.cpp
  3. 20
    20
      src/deps/imgui/imgui.h

+ 3
- 0
ChangeLog.md View File

2
 
2
 
3
 ## OpenRaider (0.1.3) xythobuz <xythobuz@xythobuz.de>
3
 ## OpenRaider (0.1.3) xythobuz <xythobuz@xythobuz.de>
4
 
4
 
5
+    [ 20140222 ]
6
+    * Updated imgui to version 1.33
7
+
5
     [ 20140219 ]
8
     [ 20140219 ]
6
     * Started implementing ability to render into textures (mainly for debugging)
9
     * Started implementing ability to render into textures (mainly for debugging)
7
     * Started implementing camera movement room tracking
10
     * Started implementing camera movement room tracking

+ 227
- 128
src/deps/imgui/imgui.cpp View File

1
-// ImGui library v1.32
1
+// ImGui library v1.33
2
 // See ImGui::ShowTestWindow() for sample code.
2
 // See ImGui::ShowTestWindow() for sample code.
3
 // Read 'Programmer guide' below for notes on how to setup ImGui in your codebase.
3
 // Read 'Programmer guide' below for notes on how to setup ImGui in your codebase.
4
 // Get latest version at https://github.com/ocornut/imgui
4
 // Get latest version at https://github.com/ocornut/imgui
269
  - columns: declare column set (each column: fixed size, %, fill, distribute default size among fills)
269
  - columns: declare column set (each column: fixed size, %, fill, distribute default size among fills)
270
  - columns: columns header to act as button (~sort op) and allow resize/reorder
270
  - columns: columns header to act as button (~sort op) and allow resize/reorder
271
  - columns: user specify columns size
271
  - columns: user specify columns size
272
- - columns: tree node example actually has a small bug (opening node in right column extends the column different from opening node in left column) 
272
+ - columns: tree node example, removing the last NextColumn() makes a padding difference (it should not)
273
  - combo: turn child handling code into pop up helper
273
  - combo: turn child handling code into pop up helper
274
  - combo: contents should extends to fit label if combo widget is small
274
  - combo: contents should extends to fit label if combo widget is small
275
  - listbox: multiple selection
275
  - listbox: multiple selection
289
  - text edit: flag to disable live update of the user buffer. 
289
  - text edit: flag to disable live update of the user buffer. 
290
  - text edit: field resize behavior - field could stretch when being edited? hover tooltip shows more text?
290
  - text edit: field resize behavior - field could stretch when being edited? hover tooltip shows more text?
291
  - text edit: add multi-line text edit
291
  - text edit: add multi-line text edit
292
+ - tree: reformulate OpenNextNode() into SetNextWindowCollapsed() api
292
  - tree: add treenode/treepush int variants? because (void*) cast from int warns on some platforms/settings
293
  - tree: add treenode/treepush int variants? because (void*) cast from int warns on some platforms/settings
293
  - settings: write more decent code to allow saving/loading new fields
294
  - settings: write more decent code to allow saving/loading new fields
294
  - settings: api for per-tool simple persistent data (bool,int,float) in .ini file
295
  - settings: api for per-tool simple persistent data (bool,int,float) in .ini file
295
  ! style: store rounded corners in texture to use 1 quad per corner (filled and wireframe). so rounding have minor cost.
296
  ! style: store rounded corners in texture to use 1 quad per corner (filled and wireframe). so rounding have minor cost.
296
  - style: checkbox: padding for "active" color should be a multiplier of the 
297
  - style: checkbox: padding for "active" color should be a multiplier of the 
297
  - style: colorbox not always square?
298
  - style: colorbox not always square?
299
+ - text: simple markup language for color change?
298
  - log: LogButtons() options for specifying depth and/or hiding depth slider
300
  - log: LogButtons() options for specifying depth and/or hiding depth slider
299
  - log: have more control over the log scope (e.g. stop logging when leaving current tree node scope)
301
  - log: have more control over the log scope (e.g. stop logging when leaving current tree node scope)
300
  - log: be able to right-click and log a window or tree-node into tty/file/clipboard / generalized context menu?
302
  - log: be able to right-click and log a window or tree-node into tty/file/clipboard / generalized context menu?
530
     Colors[ImGuiCol_TooltipBg]              = ImVec4(0.05f, 0.05f, 0.10f, 0.90f);
532
     Colors[ImGuiCol_TooltipBg]              = ImVec4(0.05f, 0.05f, 0.10f, 0.90f);
531
 }
533
 }
532
 
534
 
533
-// Statically allocated font atlas. This is merely a maneuver to keep its definition at the bottom of the .H file.
534
-// Because we cannot new() at this point (before users may define IO.MemAllocFn)
535
+// Statically allocated font atlas. This is merely a maneuver to keep ImFontAtlas definition at the bottom of the .h file (otherwise it'd be inside ImGuiIO)
536
+// Also we wouldn't be able to new() one at this point, before users may define IO.MemAllocFn.
535
 static ImFontAtlas GDefaultFontAtlas;
537
 static ImFontAtlas GDefaultFontAtlas;
536
 
538
 
537
 ImGuiIO::ImGuiIO()
539
 ImGuiIO::ImGuiIO()
563
 
565
 
564
 // Pass in translated ASCII characters for text input.
566
 // Pass in translated ASCII characters for text input.
565
 // - with glfw you can get those from the callback set in glfwSetCharCallback()
567
 // - with glfw you can get those from the callback set in glfwSetCharCallback()
566
-// - on Windows you can get those using ToAscii+keyboard state, or via the VM_CHAR message
568
+// - on Windows you can get those using ToAscii+keyboard state, or via the WM_CHAR message
567
 void ImGuiIO::AddInputCharacter(ImWchar c)
569
 void ImGuiIO::AddInputCharacter(ImWchar c)
568
 {
570
 {
569
     const size_t n = ImStrlenW(InputCharacters);
571
     const size_t n = ImStrlenW(InputCharacters);
589
 #define IM_INT_MAX 2147483647
591
 #define IM_INT_MAX 2147483647
590
 #endif
592
 #endif
591
 
593
 
592
-// Play it nice with Windows users. Notepad in 2014 still doesn't display text data with Unix-style \n.
594
+// Play it nice with Windows users. Notepad in 2015 still doesn't display text data with Unix-style \n.
593
 #ifdef _MSC_VER
595
 #ifdef _MSC_VER
594
 #define STR_NEWLINE "\r\n"
596
 #define STR_NEWLINE "\r\n"
595
 #else
597
 #else
648
 static size_t ImStrlenW(const ImWchar* str)
650
 static size_t ImStrlenW(const ImWchar* str)
649
 {
651
 {
650
     size_t n = 0;
652
     size_t n = 0;
651
-    while (*str++)
652
-        n++;
653
+    while (*str++) n++;
653
     return n;
654
     return n;
654
 }
655
 }
655
 
656
 
842
     ImVec2      PreviousValue;
843
     ImVec2      PreviousValue;
843
 };
844
 };
844
 
845
 
845
-struct ImGuiAabb    // 2D axis aligned bounding-box
846
+struct ImGuiAabb        // 2D axis aligned bounding-box
846
 {
847
 {
847
     ImVec2      Min;
848
     ImVec2      Min;
848
     ImVec2      Max;
849
     ImVec2      Max;
927
 // Internal state of the currently focused/edited text input box
928
 // Internal state of the currently focused/edited text input box
928
 struct ImGuiTextEditState
929
 struct ImGuiTextEditState
929
 {
930
 {
931
+    ImGuiID             Id;                             // widget id owning the text state
930
     ImWchar             Text[1024];                     // edit buffer, we need to persist but can't guarantee the persistence of the user-provided buffer. so we copy into own buffer.
932
     ImWchar             Text[1024];                     // edit buffer, we need to persist but can't guarantee the persistence of the user-provided buffer. so we copy into own buffer.
931
     char                InitialText[1024*3+1];          // backup of end-user buffer at the time of focus (in UTF-8, unconverted)
933
     char                InitialText[1024*3+1];          // backup of end-user buffer at the time of focus (in UTF-8, unconverted)
932
     size_t              BufSize;                        // end-user buffer size, <= 1024 (or increase above)
934
     size_t              BufSize;                        // end-user buffer size, <= 1024 (or increase above)
934
     float               ScrollX;
936
     float               ScrollX;
935
     STB_TexteditState   StbState;
937
     STB_TexteditState   StbState;
936
     float               CursorAnim;
938
     float               CursorAnim;
937
-    ImVec2              LastCursorPos;                  // Cursor position in screen space to be used by IME callback.
939
+    ImVec2              InputCursorScreenPos;           // Cursor position in screen space to be used by IME callback.
938
     bool                SelectedAllMouseLock;
940
     bool                SelectedAllMouseLock;
939
     ImFont*             Font;
941
     ImFont*             Font;
940
     float               FontSize;
942
     float               FontSize;
991
     ImGuiID                 ActiveId;
993
     ImGuiID                 ActiveId;
992
     ImGuiID                 ActiveIdPreviousFrame;
994
     ImGuiID                 ActiveIdPreviousFrame;
993
     bool                    ActiveIdIsAlive;
995
     bool                    ActiveIdIsAlive;
996
+    bool                    ActiveIdIsFocusedOnly;              // Set only by active widget. Denote focus but no active interaction.
994
     float                   SettingsDirtyTimer;
997
     float                   SettingsDirtyTimer;
995
     ImVector<ImGuiIniData*> Settings;
998
     ImVector<ImGuiIniData*> Settings;
996
     ImVector<ImGuiColMod>   ColorModifiers;
999
     ImVector<ImGuiColMod>   ColorModifiers;
1030
     ImGuiState()
1033
     ImGuiState()
1031
     {
1034
     {
1032
         Initialized = false;
1035
         Initialized = false;
1036
+        Font = NULL;
1037
+        FontSize = 0.0f;
1038
+        FontTexUvWhitePixel = ImVec2(0.0f, 0.0f);
1039
+
1033
         Time = 0.0f;
1040
         Time = 0.0f;
1034
         FrameCount = 0;
1041
         FrameCount = 0;
1035
         FrameCountRendered = -1;
1042
         FrameCountRendered = -1;
1037
         FocusedWindow = NULL;
1044
         FocusedWindow = NULL;
1038
         HoveredWindow = NULL;
1045
         HoveredWindow = NULL;
1039
         HoveredRootWindow = NULL;
1046
         HoveredRootWindow = NULL;
1047
+        HoveredId = 0;
1048
+        ActiveId = 0;
1049
+        ActiveIdPreviousFrame = 0;
1040
         ActiveIdIsAlive = false;
1050
         ActiveIdIsAlive = false;
1051
+        ActiveIdIsFocusedOnly = false;
1041
         SettingsDirtyTimer = 0.0f;
1052
         SettingsDirtyTimer = 0.0f;
1042
         SetNextWindowPosVal = ImVec2(0.0f, 0.0f);
1053
         SetNextWindowPosVal = ImVec2(0.0f, 0.0f);
1043
         SetNextWindowPosCond = 0;
1054
         SetNextWindowPosCond = 0;
1045
         SetNextWindowSizeCond = 0;
1056
         SetNextWindowSizeCond = 0;
1046
         SetNextWindowCollapsedVal = false;
1057
         SetNextWindowCollapsedVal = false;
1047
         SetNextWindowCollapsedCond = 0;
1058
         SetNextWindowCollapsedCond = 0;
1059
+
1048
         SliderAsInputTextId = 0;
1060
         SliderAsInputTextId = 0;
1049
         ActiveComboID = 0;
1061
         ActiveComboID = 0;
1050
         memset(Tooltip, 0, sizeof(Tooltip));
1062
         memset(Tooltip, 0, sizeof(Tooltip));
1051
         PrivateClipboard = NULL;
1063
         PrivateClipboard = NULL;
1064
+
1052
         LogEnabled = false;
1065
         LogEnabled = false;
1053
         LogFile = NULL;
1066
         LogFile = NULL;
1067
+        LogClipboard = NULL;
1054
         LogStartDepth = 0;
1068
         LogStartDepth = 0;
1055
         LogAutoExpandMaxDepth = 2;
1069
         LogAutoExpandMaxDepth = 2;
1056
-        LogClipboard = NULL;
1070
+
1071
+        memset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame));
1072
+        FramerateSecPerFrameIdx = 0;
1073
+        FramerateSecPerFrameAccum = 0.0f;
1057
     }
1074
     }
1058
 };
1075
 };
1059
 
1076
 
1086
     ImGuiDrawContext        DC;
1103
     ImGuiDrawContext        DC;
1087
     ImVector<ImGuiID>       IDStack;
1104
     ImVector<ImGuiID>       IDStack;
1088
     ImVector<ImVec4>        ClipRectStack;                      // Scissoring / clipping rectangle. x1, y1, x2, y2.
1105
     ImVector<ImVec4>        ClipRectStack;                      // Scissoring / clipping rectangle. x1, y1, x2, y2.
1106
+    ImGuiAabb               ClippedAabb;                        // = ClipRectStack.front() after setup in Begin()
1089
     int                     LastFrameDrawn;
1107
     int                     LastFrameDrawn;
1090
     float                   ItemWidthDefault;
1108
     float                   ItemWidthDefault;
1091
     ImGuiStorage            StateStorage;
1109
     ImGuiStorage            StateStorage;
1118
     ImVec2      CursorPos() const                       { return DC.CursorPos; }
1136
     ImVec2      CursorPos() const                       { return DC.CursorPos; }
1119
     float       TitleBarHeight() const                  { return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0 : FontSize() + GImGui->Style.FramePadding.y * 2.0f; }
1137
     float       TitleBarHeight() const                  { return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0 : FontSize() + GImGui->Style.FramePadding.y * 2.0f; }
1120
     ImGuiAabb   TitleBarAabb() const                    { return ImGuiAabb(Pos, Pos + ImVec2(SizeFull.x, TitleBarHeight())); }
1138
     ImGuiAabb   TitleBarAabb() const                    { return ImGuiAabb(Pos, Pos + ImVec2(SizeFull.x, TitleBarHeight())); }
1121
-    ImVec2      WindowPadding() const                   { return ((Flags & ImGuiWindowFlags_ChildWindow) && !(Flags & ImGuiWindowFlags_ShowBorders)) ? ImVec2(1,1) : GImGui->Style.WindowPadding; }
1139
+    ImVec2      WindowPadding() const                   { return ((Flags & ImGuiWindowFlags_ChildWindow) && !(Flags & ImGuiWindowFlags_ShowBorders)) ? ImVec2(0,0) : GImGui->Style.WindowPadding; }
1122
     ImU32       Color(ImGuiCol idx, float a=1.f) const  { ImVec4 c = GImGui->Style.Colors[idx]; c.w *= GImGui->Style.Alpha * a; return ImGui::ColorConvertFloat4ToU32(c); }
1140
     ImU32       Color(ImGuiCol idx, float a=1.f) const  { ImVec4 c = GImGui->Style.Colors[idx]; c.w *= GImGui->Style.Alpha * a; return ImGui::ColorConvertFloat4ToU32(c); }
1123
     ImU32       Color(const ImVec4& col) const          { ImVec4 c = col; c.w *= GImGui->Style.Alpha; return ImGui::ColorConvertFloat4ToU32(c); }
1141
     ImU32       Color(const ImVec4& col) const          { ImVec4 c = col; c.w *= GImGui->Style.Alpha; return ImGui::ColorConvertFloat4ToU32(c); }
1124
 };
1142
 };
1125
 
1143
 
1126
-static ImGuiWindow* GetCurrentWindow()
1144
+static inline ImGuiWindow* GetCurrentWindow()
1127
 {
1145
 {
1128
     ImGuiState& g = *GImGui;
1146
     ImGuiState& g = *GImGui;
1129
     IM_ASSERT(g.CurrentWindow != NULL);    // ImGui::NewFrame() hasn't been called yet?
1147
     IM_ASSERT(g.CurrentWindow != NULL);    // ImGui::NewFrame() hasn't been called yet?
1135
 {
1153
 {
1136
     ImGuiState& g = *GImGui;
1154
     ImGuiState& g = *GImGui;
1137
     g.ActiveId = id; 
1155
     g.ActiveId = id; 
1156
+    g.ActiveIdIsFocusedOnly = false;
1138
 }
1157
 }
1139
 
1158
 
1140
 static void RegisterAliveId(const ImGuiID& id)
1159
 static void RegisterAliveId(const ImGuiID& id)
1260
 //-----------------------------------------------------------------------------
1279
 //-----------------------------------------------------------------------------
1261
 
1280
 
1262
 // Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
1281
 // Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
1263
-ImGuiTextFilter::ImGuiTextFilter()
1282
+ImGuiTextFilter::ImGuiTextFilter(const char* default_filter)
1264
 {
1283
 {
1265
-    InputBuf[0] = 0;
1266
-    CountGrep = 0;
1284
+    if (default_filter)
1285
+    {
1286
+        ImFormatString(InputBuf, IM_ARRAYSIZE(InputBuf), "%s", default_filter);
1287
+        Build();
1288
+    }
1289
+    else
1290
+    {
1291
+        InputBuf[0] = 0;
1292
+        CountGrep = 0;
1293
+    }
1267
 }
1294
 }
1268
 
1295
 
1269
 void ImGuiTextFilter::Draw(const char* label, float width)
1296
 void ImGuiTextFilter::Draw(const char* label, float width)
1270
 {
1297
 {
1271
     ImGuiWindow* window = GetCurrentWindow();
1298
     ImGuiWindow* window = GetCurrentWindow();
1272
-    if (width < 0.0f)
1273
-    {
1274
-        ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
1275
-        width = ImMax(window->Pos.x + ImGui::GetContentRegionMax().x - window->DC.CursorPos.x - (label_size.x + GImGui->Style.ItemSpacing.x*4), 10.0f);
1276
-    }
1277
-    ImGui::PushItemWidth(width);
1299
+    if (width > 0.0f)
1300
+        ImGui::PushItemWidth(width);
1278
     ImGui::InputText(label, InputBuf, IM_ARRAYSIZE(InputBuf));
1301
     ImGui::InputText(label, InputBuf, IM_ARRAYSIZE(InputBuf));
1279
-    ImGui::PopItemWidth();
1302
+    if (width > 0.0f)
1303
+        ImGui::PopItemWidth();
1280
     Build();
1304
     Build();
1281
 }
1305
 }
1282
 
1306
 
1393
 {
1417
 {
1394
     Name = ImStrdup(name);
1418
     Name = ImStrdup(name);
1395
     ID = GetID(name); 
1419
     ID = GetID(name); 
1396
-    IDStack.push_back(ID);
1397
-
1420
+    Flags = 0;
1398
     PosFloat = Pos = ImVec2(0.0f, 0.0f);
1421
     PosFloat = Pos = ImVec2(0.0f, 0.0f);
1399
     Size = SizeFull = ImVec2(0.0f, 0.0f);
1422
     Size = SizeFull = ImVec2(0.0f, 0.0f);
1400
     SizeContentsFit = ImVec2(0.0f, 0.0f);
1423
     SizeContentsFit = ImVec2(0.0f, 0.0f);
1409
     AutoFitOnlyGrows = false;
1432
     AutoFitOnlyGrows = false;
1410
     SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = ImGuiSetCondition_Always | ImGuiSetCondition_FirstUseThisSession | ImGuiSetCondition_FirstUseEver;
1433
     SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = ImGuiSetCondition_Always | ImGuiSetCondition_FirstUseThisSession | ImGuiSetCondition_FirstUseEver;
1411
 
1434
 
1435
+    IDStack.push_back(ID);
1412
     LastFrameDrawn = -1;
1436
     LastFrameDrawn = -1;
1413
     ItemWidthDefault = 0.0f;
1437
     ItemWidthDefault = 0.0f;
1414
     FontWindowScale = 1.0f;
1438
     FontWindowScale = 1.0f;
1421
 
1445
 
1422
     DrawList = (ImDrawList*)ImGui::MemAlloc(sizeof(ImDrawList));
1446
     DrawList = (ImDrawList*)ImGui::MemAlloc(sizeof(ImDrawList));
1423
     new(DrawList) ImDrawList();
1447
     new(DrawList) ImDrawList();
1448
+    RootWindow = NULL;
1424
 
1449
 
1425
     FocusIdxAllCounter = FocusIdxTabCounter = -1;
1450
     FocusIdxAllCounter = FocusIdxTabCounter = -1;
1426
     FocusIdxAllRequestCurrent = FocusIdxTabRequestCurrent = IM_INT_MAX;
1451
     FocusIdxAllRequestCurrent = FocusIdxTabRequestCurrent = IM_INT_MAX;
2309
             continue;
2334
             continue;
2310
         if (excluding_childs && (window->Flags & ImGuiWindowFlags_ChildWindow) != 0)
2335
         if (excluding_childs && (window->Flags & ImGuiWindowFlags_ChildWindow) != 0)
2311
             continue;
2336
             continue;
2312
-        ImGuiAabb bb(window->Pos - g.Style.TouchExtraPadding, window->Pos + window->Size + g.Style.TouchExtraPadding);
2337
+
2338
+        // Using the clipped AABB so a child window will typically be clipped by its parent.
2339
+        ImGuiAabb bb(window->ClippedAabb.Min - g.Style.TouchExtraPadding, window->ClippedAabb.Max + g.Style.TouchExtraPadding);
2313
         if (bb.Contains(pos))
2340
         if (bb.Contains(pos))
2314
             return window;
2341
             return window;
2315
     }
2342
     }
2432
     return false;
2459
     return false;
2433
 }
2460
 }
2434
 
2461
 
2462
+bool ImGui::IsAnyItemActive()
2463
+{
2464
+    ImGuiState& g = *GImGui;
2465
+    return g.ActiveId != 0;
2466
+}
2467
+
2435
 ImVec2 ImGui::GetItemBoxMin()
2468
 ImVec2 ImGui::GetItemBoxMin()
2436
 {
2469
 {
2437
     ImGuiWindow* window = GetCurrentWindow();
2470
     ImGuiWindow* window = GetCurrentWindow();
2482
     ImGui::End();
2515
     ImGui::End();
2483
 }
2516
 }
2484
 
2517
 
2485
-void ImGui::BeginChild(ImGuiID id, ImVec2 size, bool border, ImGuiWindowFlags extra_flags)
2486
-{
2487
-    char str_id[32];
2488
-    ImFormatString(str_id, IM_ARRAYSIZE(str_id), "child_%x", id);
2489
-    ImGui::BeginChild(str_id, size, border, extra_flags);
2490
-}
2491
-
2492
-void ImGui::BeginChild(const char* str_id, ImVec2 size, bool border, ImGuiWindowFlags extra_flags)
2518
+bool ImGui::BeginChild(const char* str_id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags)
2493
 {
2519
 {
2494
     ImGuiState& g = *GImGui;
2520
     ImGuiState& g = *GImGui;
2495
     ImGuiWindow* window = GetCurrentWindow();
2521
     ImGuiWindow* window = GetCurrentWindow();
2498
 
2524
 
2499
     const ImVec2 content_max = window->Pos + ImGui::GetContentRegionMax();
2525
     const ImVec2 content_max = window->Pos + ImGui::GetContentRegionMax();
2500
     const ImVec2 cursor_pos = window->Pos + ImGui::GetCursorPos();
2526
     const ImVec2 cursor_pos = window->Pos + ImGui::GetCursorPos();
2527
+    ImVec2 size = size_arg;
2501
     if (size.x <= 0.0f)
2528
     if (size.x <= 0.0f)
2502
     {
2529
     {
2503
         if (size.x == 0.0f)
2530
         if (size.x == 0.0f)
2518
     ImFormatString(title, IM_ARRAYSIZE(title), "%s.%s", window->Name, str_id);
2545
     ImFormatString(title, IM_ARRAYSIZE(title), "%s.%s", window->Name, str_id);
2519
 
2546
 
2520
     const float alpha = 1.0f;
2547
     const float alpha = 1.0f;
2521
-    ImGui::Begin(title, NULL, size, alpha, flags);
2548
+    bool ret = ImGui::Begin(title, NULL, size, alpha, flags);
2522
 
2549
 
2523
     if (!(window->Flags & ImGuiWindowFlags_ShowBorders))
2550
     if (!(window->Flags & ImGuiWindowFlags_ShowBorders))
2524
         g.CurrentWindow->Flags &= ~ImGuiWindowFlags_ShowBorders;
2551
         g.CurrentWindow->Flags &= ~ImGuiWindowFlags_ShowBorders;
2552
+
2553
+    return ret;
2554
+}
2555
+
2556
+bool ImGui::BeginChild(ImGuiID id, const ImVec2& size, bool border, ImGuiWindowFlags extra_flags)
2557
+{
2558
+    char str_id[32];
2559
+    ImFormatString(str_id, IM_ARRAYSIZE(str_id), "child_%x", id);
2560
+    bool ret = ImGui::BeginChild(str_id, size, border, extra_flags);
2561
+    return ret;
2525
 }
2562
 }
2526
 
2563
 
2527
 void ImGui::EndChild()
2564
 void ImGui::EndChild()
2623
 }
2660
 }
2624
 
2661
 
2625
 // Push a new ImGui window to add widgets to. 
2662
 // Push a new ImGui window to add widgets to. 
2626
-// - A default window called "Debug" is automatically stacked at the beginning of every frame.
2627
-// - This can be called multiple times during the frame with the same window name to append content to the same window.
2663
+// - 'size' for a regular window denote the initial size for first-time creation (no saved data) and isn't that useful. Use SetNextWindowSize() prior to calling Begin() for more flexible window manipulation.
2664
+// - A default window called "Debug" is automatically stacked at the beginning of every frame so you can use widgets without explicitly calling a Begin/End pair.
2665
+// - Begin/End can be called multiple times during the frame with the same window name to append content.
2628
 // - The window name is used as a unique identifier to preserve window information across frames (and save rudimentary information to the .ini file). Note that you can use ## to append unique data that isn't displayed, e.g. "My window##1" will use "My window##1" as unique window ID but display "My window" to the user.
2666
 // - The window name is used as a unique identifier to preserve window information across frames (and save rudimentary information to the .ini file). Note that you can use ## to append unique data that isn't displayed, e.g. "My window##1" will use "My window##1" as unique window ID but display "My window" to the user.
2629
 // - Return false when window is collapsed, so you can early out in your code. You always need to call ImGui::End() even if false is returned.
2667
 // - Return false when window is collapsed, so you can early out in your code. You always need to call ImGui::End() even if false is returned.
2630
 // - Passing 'bool* p_opened' displays a Close button on the upper-right corner of the window, the pointed value will be set to false when the button is pressed.
2668
 // - Passing 'bool* p_opened' displays a Close button on the upper-right corner of the window, the pointed value will be set to false when the button is pressed.
2631
 // - Passing non-zero 'size' is roughly equivalent to calling SetNextWindowSize(size, ImGuiSetCondition_FirstUseEver) prior to calling Begin().
2669
 // - Passing non-zero 'size' is roughly equivalent to calling SetNextWindowSize(size, ImGuiSetCondition_FirstUseEver) prior to calling Begin().
2632
-bool ImGui::Begin(const char* name, bool* p_opened, ImVec2 size, float fill_alpha, ImGuiWindowFlags flags)
2670
+bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size, float bg_alpha, ImGuiWindowFlags flags)
2633
 {
2671
 {
2634
     ImGuiState& g = *GImGui;
2672
     ImGuiState& g = *GImGui;
2635
     const ImGuiStyle& style = g.Style;
2673
     const ImGuiStyle& style = g.Style;
2681
     window->RootWindow = g.CurrentWindowStack[root_idx];
2719
     window->RootWindow = g.CurrentWindowStack[root_idx];
2682
 
2720
 
2683
     // Default alpha
2721
     // Default alpha
2684
-    if (fill_alpha < 0.0f)
2685
-        fill_alpha = style.WindowFillAlphaDefault;
2722
+    if (bg_alpha < 0.0f)
2723
+        bg_alpha = style.WindowFillAlphaDefault;
2686
 
2724
 
2687
     // When reusing window again multiple times a frame, just append content (don't need to setup again)
2725
     // When reusing window again multiple times a frame, just append content (don't need to setup again)
2688
     const int current_frame = ImGui::GetFrameCount();
2726
     const int current_frame = ImGui::GetFrameCount();
2888
             window->ScrollbarY = (window->SizeContentsFit.y > window->Size.y) && !(window->Flags & ImGuiWindowFlags_NoScrollbar);
2926
             window->ScrollbarY = (window->SizeContentsFit.y > window->Size.y) && !(window->Flags & ImGuiWindowFlags_NoScrollbar);
2889
 
2927
 
2890
             // Window background
2928
             // Window background
2891
-            if (fill_alpha > 0.0f)
2929
+            if (bg_alpha > 0.0f)
2892
             {
2930
             {
2893
                 if ((window->Flags & ImGuiWindowFlags_ComboBox) != 0)
2931
                 if ((window->Flags & ImGuiWindowFlags_ComboBox) != 0)
2894
-                    window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, window->Color(ImGuiCol_ComboBg, fill_alpha), window_rounding);
2932
+                    window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, window->Color(ImGuiCol_ComboBg, bg_alpha), window_rounding);
2895
                 else if ((window->Flags & ImGuiWindowFlags_Tooltip) != 0)
2933
                 else if ((window->Flags & ImGuiWindowFlags_Tooltip) != 0)
2896
-                    window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, window->Color(ImGuiCol_TooltipBg, fill_alpha), window_rounding);
2934
+                    window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, window->Color(ImGuiCol_TooltipBg, bg_alpha), window_rounding);
2897
                 else if ((window->Flags & ImGuiWindowFlags_ChildWindow) != 0)
2935
                 else if ((window->Flags & ImGuiWindowFlags_ChildWindow) != 0)
2898
-                    window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size-ImVec2(window->ScrollbarY?style.ScrollBarWidth:0.0f,0.0f), window->Color(ImGuiCol_ChildWindowBg, fill_alpha), window_rounding, window->ScrollbarY ? (1|8) : (0xF));
2936
+                    window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size-ImVec2(window->ScrollbarY?style.ScrollBarWidth:0.0f,0.0f), window->Color(ImGuiCol_ChildWindowBg, bg_alpha), window_rounding, window->ScrollbarY ? (1|8) : (0xF));
2899
                 else
2937
                 else
2900
-                    window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, window->Color(ImGuiCol_WindowBg, fill_alpha), window_rounding);
2938
+                    window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, window->Color(ImGuiCol_WindowBg, bg_alpha), window_rounding);
2901
             }
2939
             }
2902
 
2940
 
2903
             // Title bar
2941
             // Title bar
3014
             const ImVec2 text_max = window->Pos + ImVec2(window->Size.x - (p_opened ? (title_bar_aabb.GetHeight()-3) : style.FramePadding.x), style.FramePadding.y*2 + text_size.y);
3052
             const ImVec2 text_max = window->Pos + ImVec2(window->Size.x - (p_opened ? (title_bar_aabb.GetHeight()-3) : style.FramePadding.x), style.FramePadding.y*2 + text_size.y);
3015
             RenderTextClipped(text_min, name, NULL, &text_size, text_max);
3053
             RenderTextClipped(text_min, name, NULL, &text_size, text_max);
3016
         }
3054
         }
3055
+
3056
+        // Save clipped aabb so we can access it in constant-time in FindHoveredWindow()
3057
+        window->ClippedAabb = window->Aabb();
3058
+        window->ClippedAabb.Clip(window->ClipRectStack.front());
3017
     }
3059
     }
3018
 
3060
 
3019
     // Inner clipping rectangle
3061
     // Inner clipping rectangle
3033
     if (flags & ImGuiWindowFlags_ChildWindow)
3075
     if (flags & ImGuiWindowFlags_ChildWindow)
3034
     {
3076
     {
3035
         IM_ASSERT((flags & ImGuiWindowFlags_NoTitleBar) != 0);
3077
         IM_ASSERT((flags & ImGuiWindowFlags_NoTitleBar) != 0);
3078
+        window->Collapsed = parent_window && parent_window->Collapsed;
3079
+
3036
         const ImVec4 clip_rect_t = window->ClipRectStack.back();
3080
         const ImVec4 clip_rect_t = window->ClipRectStack.back();
3037
-        window->Collapsed = (clip_rect_t.x >= clip_rect_t.z || clip_rect_t.y >= clip_rect_t.w);
3081
+        window->Collapsed |= (clip_rect_t.x >= clip_rect_t.z || clip_rect_t.y >= clip_rect_t.w);
3038
 
3082
 
3039
         // We also hide the window from rendering because we've already added its border to the command list.
3083
         // We also hide the window from rendering because we've already added its border to the command list.
3040
         // (we could perform the check earlier in the function but it is simpler at this point)
3084
         // (we could perform the check earlier in the function but it is simpler at this point)
3417
 ImVec2 ImGui::GetContentRegionMax()
3461
 ImVec2 ImGui::GetContentRegionMax()
3418
 {
3462
 {
3419
     ImGuiWindow* window = GetCurrentWindow();
3463
     ImGuiWindow* window = GetCurrentWindow();
3420
-    ImVec2 mx = window->Size - window->WindowPadding();
3464
+    ImVec2 window_padding = window->WindowPadding();
3465
+    ImVec2 mx = window->Size - window_padding;
3421
     if (window->DC.ColumnsCount != 1)
3466
     if (window->DC.ColumnsCount != 1)
3422
     {
3467
     {
3423
         mx.x = ImGui::GetColumnOffset(window->DC.ColumnsCurrent + 1);
3468
         mx.x = ImGui::GetColumnOffset(window->DC.ColumnsCurrent + 1);
3424
-        mx.x -= GImGui->Style.WindowPadding.x;
3469
+        mx.x -= window_padding.x;
3425
     }
3470
     }
3426
     else
3471
     else
3427
     {
3472
     {
3761
     if (g.HoveredId == 0)
3806
     if (g.HoveredId == 0)
3762
     {
3807
     {
3763
         ImGuiWindow* window = GetCurrentWindow();
3808
         ImGuiWindow* window = GetCurrentWindow();
3764
-        const bool hovered = (g.HoveredRootWindow == window->RootWindow) && (g.ActiveId == 0 || g.ActiveId == id) && IsMouseHoveringBox(bb);
3765
-        return hovered;
3809
+        if (g.HoveredRootWindow == window->RootWindow)
3810
+        {
3811
+            bool hovered = (g.ActiveId == 0 || g.ActiveId == id || g.ActiveIdIsFocusedOnly) && IsMouseHoveringBox(bb);
3812
+            return hovered;
3813
+        }
3766
     }
3814
     }
3767
     return false;
3815
     return false;
3768
 }
3816
 }
4486
         if (g.SliderAsInputTextId == 0)
4534
         if (g.SliderAsInputTextId == 0)
4487
         {
4535
         {
4488
             // First frame
4536
             // First frame
4489
-            IM_ASSERT(g.ActiveId == id);    // InputText ID should match the Slider ID (else we'd need to store them both which is also possible)
4537
+            IM_ASSERT(g.ActiveId == id);    // InputText ID expected to match the Slider ID (else we'd need to store them both, which is also possible)
4490
             g.SliderAsInputTextId = g.ActiveId;
4538
             g.SliderAsInputTextId = g.ActiveId;
4491
-            SetActiveId(id);
4492
             g.HoveredId = id;
4539
             g.HoveredId = id;
4493
         }
4540
         }
4494
-        else
4541
+        else if (g.ActiveId != g.SliderAsInputTextId)
4495
         {
4542
         {
4496
-            if (g.ActiveId == g.SliderAsInputTextId)
4497
-                SetActiveId(id);
4498
-            else
4499
-            {
4500
-                SetActiveId(0);
4501
-                g.SliderAsInputTextId = 0;
4502
-            }
4543
+            // Release
4544
+            g.SliderAsInputTextId = 0;
4503
         }
4545
         }
4504
         if (value_changed)
4546
         if (value_changed)
4505
         {
4547
         {
4594
 
4636
 
4595
     // Draw value using user-provided display format so user can add prefix/suffix/decorations to the value.
4637
     // Draw value using user-provided display format so user can add prefix/suffix/decorations to the value.
4596
     char value_buf[64];
4638
     char value_buf[64];
4597
-    ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v);
4598
-    RenderText(ImVec2(slider_bb.GetCenter().x-CalcTextSize(value_buf, NULL, true).x*0.5f, frame_bb.Min.y + style.FramePadding.y), value_buf);
4639
+    char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v);
4640
+    const ImVec2 value_text_size = CalcTextSize(value_buf, value_buf_end, true);
4641
+    RenderTextClipped(ImVec2(ImMax(frame_bb.Min.x + style.FramePadding.x, slider_bb.GetCenter().x - value_text_size.x*0.5f), frame_bb.Min.y + style.FramePadding.y), value_buf, value_buf_end, &value_text_size, frame_bb.Max);
4599
 
4642
 
4600
     RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, slider_bb.Min.y), label);
4643
     RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, slider_bb.Min.y), label);
4601
 
4644
 
5010
 static bool STB_TEXTEDIT_INSERTCHARS(STB_TEXTEDIT_STRING* obj, int pos, const ImWchar* new_text, int new_text_len)
5053
 static bool STB_TEXTEDIT_INSERTCHARS(STB_TEXTEDIT_STRING* obj, int pos, const ImWchar* new_text, int new_text_len)
5011
 {
5054
 {
5012
     const size_t text_len = ImStrlenW(obj->Text);
5055
     const size_t text_len = ImStrlenW(obj->Text);
5013
-    if ((size_t)new_text_len + text_len + 1 >= obj->BufSize)
5056
+    if ((size_t)new_text_len + text_len + 1 > obj->BufSize)
5014
         return false;
5057
         return false;
5015
 
5058
 
5016
     if (pos != (int)text_len)
5059
     if (pos != (int)text_len)
5311
 
5354
 
5312
     const bool is_ctrl_down = io.KeyCtrl;
5355
     const bool is_ctrl_down = io.KeyCtrl;
5313
     const bool is_shift_down = io.KeyShift;
5356
     const bool is_shift_down = io.KeyShift;
5314
-    const bool tab_focus_requested = window->FocusItemRegister(g.ActiveId == id, (flags & ImGuiInputTextFlags_CallbackCompletion) == 0);    // Using completion callback disable keyboard tabbing
5315
-    //const bool align_center = (bool)(flags & ImGuiInputTextFlags_AlignCenter);    // FIXME: Unsupported
5357
+    const bool focus_requested = window->FocusItemRegister(g.ActiveId == id, (flags & ImGuiInputTextFlags_CallbackCompletion) == 0);    // Using completion callback disable keyboard tabbing
5358
+    const bool focus_requested_by_code = focus_requested && (window->FocusIdxAllCounter == window->FocusIdxAllRequestCurrent);
5359
+    const bool focus_requested_by_tab = focus_requested && !focus_requested_by_code;
5316
 
5360
 
5317
     const bool hovered = IsHovered(frame_bb, id);
5361
     const bool hovered = IsHovered(frame_bb, id);
5318
     if (hovered)
5362
     if (hovered)
5319
         g.HoveredId = id;
5363
         g.HoveredId = id;
5364
+    const bool user_clicked = hovered && io.MouseClicked[0];
5320
 
5365
 
5321
     bool select_all = (g.ActiveId != id) && (flags & ImGuiInputTextFlags_AutoSelectAll) != 0;
5366
     bool select_all = (g.ActiveId != id) && (flags & ImGuiInputTextFlags_AutoSelectAll) != 0;
5322
-    if (tab_focus_requested || (hovered && io.MouseClicked[0]))
5367
+    if (focus_requested || user_clicked)
5323
     {
5368
     {
5324
         if (g.ActiveId != id)
5369
         if (g.ActiveId != id)
5325
         {
5370
         {
5326
             // Start edition
5371
             // Start edition
5327
             // Take a copy of the initial buffer value (both in original UTF-8 format and converted to wchar)
5372
             // Take a copy of the initial buffer value (both in original UTF-8 format and converted to wchar)
5328
             ImFormatString(edit_state.InitialText, IM_ARRAYSIZE(edit_state.InitialText), "%s", buf);
5373
             ImFormatString(edit_state.InitialText, IM_ARRAYSIZE(edit_state.InitialText), "%s", buf);
5329
-            ImTextStrFromUtf8(edit_state.Text, IM_ARRAYSIZE(edit_state.Text), buf, NULL);
5330
-            edit_state.ScrollX = 0.0f;
5374
+            size_t buf_len = ImTextStrFromUtf8(edit_state.Text, IM_ARRAYSIZE(edit_state.Text), buf, NULL);
5331
             edit_state.Width = w;
5375
             edit_state.Width = w;
5332
-            stb_textedit_initialize_state(&edit_state.StbState, true); 
5376
+            edit_state.InputCursorScreenPos = ImVec2(-1.f,-1.f);
5333
             edit_state.CursorAnimReset();
5377
             edit_state.CursorAnimReset();
5334
-            edit_state.LastCursorPos = ImVec2(-1.f,-1.f);
5335
 
5378
 
5336
-            if (tab_focus_requested || is_ctrl_down)
5379
+            if (edit_state.Id != id)
5380
+            {
5381
+                edit_state.Id = id;
5382
+                edit_state.ScrollX = 0.0f;
5383
+                stb_textedit_initialize_state(&edit_state.StbState, true); 
5384
+                if (focus_requested_by_code)
5385
+                    select_all = true;
5386
+            }
5387
+            else
5388
+            {
5389
+                // Recycle existing cursor/selection/undo stack but clamp position
5390
+                // Note a single mouse click will override the cursor/position immediately by calling stb_textedit_click handler.
5391
+                edit_state.StbState.cursor = ImMin(edit_state.StbState.cursor, buf_len);
5392
+                edit_state.StbState.select_start = ImMin(edit_state.StbState.select_start, buf_len);
5393
+                edit_state.StbState.select_end = ImMin(edit_state.StbState.select_end, buf_len);
5394
+            }
5395
+            if (focus_requested_by_tab || (user_clicked && is_ctrl_down))
5337
                 select_all = true;
5396
                 select_all = true;
5338
         }
5397
         }
5339
         SetActiveId(id);
5398
         SetActiveId(id);
5348
         }
5407
         }
5349
     }
5408
     }
5350
 
5409
 
5410
+    // Although we are active we don't prevent mouse from hovering other elements unless we are interacting right now with the widget.
5411
+    // Down the line we should have a cleaner concept of focused vs active in the library.
5412
+    if (g.ActiveId == id)
5413
+        g.ActiveIdIsFocusedOnly = !io.MouseDown[0];
5414
+
5351
     bool value_changed = false;
5415
     bool value_changed = false;
5352
     bool cancel_edit = false;
5416
     bool cancel_edit = false;
5353
     bool enter_pressed = false;
5417
     bool enter_pressed = false;
5563
         }
5627
         }
5564
     }
5628
     }
5565
 
5629
 
5566
-    // FIXME: 'align_center' unsupported
5567
     ImGuiTextEditState::RenderTextScrolledClipped(window->Font(), window->FontSize(), buf, frame_bb.Min + style.FramePadding, w, (g.ActiveId == id) ? edit_state.ScrollX : 0.0f);
5630
     ImGuiTextEditState::RenderTextScrolledClipped(window->Font(), window->FontSize(), buf, frame_bb.Min + style.FramePadding, w, (g.ActiveId == id) ? edit_state.ScrollX : 0.0f);
5568
 
5631
 
5569
     if (g.ActiveId == id)
5632
     if (g.ActiveId == id)
5574
         if (g.InputTextState.CursorIsVisible())
5637
         if (g.InputTextState.CursorIsVisible())
5575
             window->DrawList->AddRect(cursor_pos - font_off_up + ImVec2(0,2), cursor_pos + font_off_dn - ImVec2(0,3), window->Color(ImGuiCol_Text));
5638
             window->DrawList->AddRect(cursor_pos - font_off_up + ImVec2(0,2), cursor_pos + font_off_dn - ImVec2(0,3), window->Color(ImGuiCol_Text));
5576
         
5639
         
5577
-        // Notify OS of text input position
5578
-        if (io.ImeSetInputScreenPosFn && ImLengthSqr(edit_state.LastCursorPos - cursor_pos) > 0.0001f)
5640
+        // Notify OS of text input position for advanced IME
5641
+        if (io.ImeSetInputScreenPosFn && ImLengthSqr(edit_state.InputCursorScreenPos - cursor_pos) > 0.0001f)
5579
             io.ImeSetInputScreenPosFn((int)cursor_pos.x - 1, (int)(cursor_pos.y - window->FontSize()));   // -1 x offset so that Windows IME can cover our cursor. Bit of an extra nicety.
5642
             io.ImeSetInputScreenPosFn((int)cursor_pos.x - 1, (int)(cursor_pos.y - window->FontSize()));   // -1 x offset so that Windows IME can cover our cursor. Bit of an extra nicety.
5580
 
5643
 
5581
-        edit_state.LastCursorPos = cursor_pos;
5644
+        edit_state.InputCursorScreenPos = cursor_pos;
5582
     }
5645
     }
5583
 
5646
 
5584
     RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
5647
     RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
6148
     window->DrawList->AddLine(bb.Min, bb.Max, window->Color(ImGuiCol_Border));
6211
     window->DrawList->AddLine(bb.Min, bb.Max, window->Color(ImGuiCol_Border));
6149
 
6212
 
6150
     if (window->DC.ColumnsCount > 1)
6213
     if (window->DC.ColumnsCount > 1)
6214
+    {
6151
         PushColumnClipRect();
6215
         PushColumnClipRect();
6216
+        window->DC.ColumnsCellMinY = window->DC.CursorPos.y;
6217
+    }
6152
 }
6218
 }
6153
 
6219
 
6154
 // A little vertical spacing.
6220
 // A little vertical spacing.
6206
 
6272
 
6207
 static bool ItemAdd(const ImGuiAabb& bb, const ImGuiID* id)
6273
 static bool ItemAdd(const ImGuiAabb& bb, const ImGuiID* id)
6208
 {
6274
 {
6275
+    //ImGuiState& g = *GImGui;
6209
     ImGuiWindow* window = GetCurrentWindow();
6276
     ImGuiWindow* window = GetCurrentWindow();
6210
     window->DC.LastItemID = id ? *id : 0;
6277
     window->DC.LastItemID = id ? *id : 0;
6211
     window->DC.LastItemAabb = bb;
6278
     window->DC.LastItemAabb = bb;
6214
         window->DC.LastItemHovered = false;
6281
         window->DC.LastItemHovered = false;
6215
         return false;
6282
         return false;
6216
     }
6283
     }
6217
-    window->DC.LastItemHovered = IsMouseHoveringBox(bb);     // this is a sensible default but widgets are free to override it after calling ItemAdd()
6284
+
6285
+    // This is a sensible default, but widgets are free to override it after calling ItemAdd()
6286
+    const bool hovered = IsMouseHoveringBox(bb);
6287
+    //const bool hovered = (g.ActiveId == 0 || (id && g.ActiveId == *id) || g.ActiveIdIsFocusedOnly) && IsMouseHoveringBox(bb);  // matching the behaviour of IsHovered(), not always what the user wants?
6288
+    window->DC.LastItemHovered = hovered;
6218
     return true;
6289
     return true;
6219
 }
6290
 }
6220
 
6291
 
6289
     // Read from cache
6360
     // Read from cache
6290
     IM_ASSERT(column_index < (int)window->DC.ColumnsOffsetsT.size());
6361
     IM_ASSERT(column_index < (int)window->DC.ColumnsOffsetsT.size());
6291
     const float t = window->DC.ColumnsOffsetsT[column_index];
6362
     const float t = window->DC.ColumnsOffsetsT[column_index];
6292
-    const float offset = window->DC.ColumnsStartX + t * (window->Size.x - g.Style.ScrollBarWidth - window->DC.ColumnsStartX);
6363
+
6364
+    const float min_x = window->DC.ColumnsStartX;
6365
+    const float max_x = window->Size.x - (g.Style.ScrollBarWidth);// - window->WindowPadding().x;
6366
+    const float offset = min_x + t * (max_x - min_x);
6293
     return offset;
6367
     return offset;
6294
 }
6368
 }
6295
 
6369
 
6302
 
6376
 
6303
     IM_ASSERT(column_index < (int)window->DC.ColumnsOffsetsT.size());
6377
     IM_ASSERT(column_index < (int)window->DC.ColumnsOffsetsT.size());
6304
     const ImGuiID column_id = window->DC.ColumnsSetID + ImGuiID(column_index);
6378
     const ImGuiID column_id = window->DC.ColumnsSetID + ImGuiID(column_index);
6305
-    const float t = (offset - window->DC.ColumnsStartX) / (window->Size.x - g.Style.ScrollBarWidth - window->DC.ColumnsStartX);
6379
+
6380
+    const float min_x = window->DC.ColumnsStartX;
6381
+    const float max_x = window->Size.x - (window->ScrollbarY);// - window->WindowPadding().x;
6382
+    const float t = (offset - min_x) / (max_x - min_x);
6306
     window->StateStorage.SetFloat(column_id, t);
6383
     window->StateStorage.SetFloat(column_id, t);
6307
     window->DC.ColumnsOffsetsT[column_index] = t;
6384
     window->DC.ColumnsOffsetsT[column_index] = t;
6308
 }
6385
 }
6332
 {
6409
 {
6333
     ImGuiState& g = *GImGui;
6410
     ImGuiState& g = *GImGui;
6334
     ImGuiWindow* window = GetCurrentWindow();
6411
     ImGuiWindow* window = GetCurrentWindow();
6335
-    if (window->SkipItems)
6336
-        return;
6337
 
6412
 
6338
     if (window->DC.ColumnsCount != 1)
6413
     if (window->DC.ColumnsCount != 1)
6339
     {
6414
     {
6347
     }
6422
     }
6348
 
6423
 
6349
     // Draw columns borders and handle resize at the time of "closing" a columns set
6424
     // Draw columns borders and handle resize at the time of "closing" a columns set
6350
-    if (window->DC.ColumnsCount != columns_count && window->DC.ColumnsCount != 1 && window->DC.ColumnsShowBorders)
6425
+    if (window->DC.ColumnsCount != columns_count && window->DC.ColumnsCount != 1 && window->DC.ColumnsShowBorders && !window->SkipItems)
6351
     {
6426
     {
6352
         const float y1 = window->DC.ColumnsStartPos.y;
6427
         const float y1 = window->DC.ColumnsStartPos.y;
6353
         const float y2 = window->DC.CursorPos.y;
6428
         const float y2 = window->DC.CursorPos.y;
7382
     {
7457
     {
7383
         Glyphs.resize(Glyphs.size() + 1);
7458
         Glyphs.resize(Glyphs.size() + 1);
7384
         ImFont::Glyph& tab_glyph = Glyphs.back();
7459
         ImFont::Glyph& tab_glyph = Glyphs.back();
7385
-        tab_glyph = *space_glyph;
7460
+        tab_glyph = *FindGlyph((unsigned short)' ');
7386
         tab_glyph.Codepoint = '\t';
7461
         tab_glyph.Codepoint = '\t';
7387
         tab_glyph.XAdvance *= 4;
7462
         tab_glyph.XAdvance *= 4;
7388
         IndexXAdvance[(size_t)tab_glyph.Codepoint] = (float)tab_glyph.XAdvance;
7463
         IndexXAdvance[(size_t)tab_glyph.Codepoint] = (float)tab_glyph.XAdvance;
8115
     static bool no_move = false;
8190
     static bool no_move = false;
8116
     static bool no_scrollbar = false;
8191
     static bool no_scrollbar = false;
8117
     static bool no_collapse = false;
8192
     static bool no_collapse = false;
8118
-    static float fill_alpha = 0.65f;
8193
+    static float bg_alpha = 0.65f;
8119
 
8194
 
8120
     // Demonstrate the various window flags. Typically you would just use the default.
8195
     // Demonstrate the various window flags. Typically you would just use the default.
8121
     ImGuiWindowFlags window_flags = 0;
8196
     ImGuiWindowFlags window_flags = 0;
8125
     if (no_move)      window_flags |= ImGuiWindowFlags_NoMove;
8200
     if (no_move)      window_flags |= ImGuiWindowFlags_NoMove;
8126
     if (no_scrollbar) window_flags |= ImGuiWindowFlags_NoScrollbar;
8201
     if (no_scrollbar) window_flags |= ImGuiWindowFlags_NoScrollbar;
8127
     if (no_collapse)  window_flags |= ImGuiWindowFlags_NoCollapse;
8202
     if (no_collapse)  window_flags |= ImGuiWindowFlags_NoCollapse;
8128
-    if (!ImGui::Begin("ImGui Test", opened, ImVec2(550,680), fill_alpha, window_flags))
8203
+    if (!ImGui::Begin("ImGui Test", opened, ImVec2(550,680), bg_alpha, window_flags))
8129
     {
8204
     {
8130
         // Early out if the window is collapsed, as an optimization.
8205
         // Early out if the window is collapsed, as an optimization.
8131
         ImGui::End();
8206
         ImGui::End();
8156
         ImGui::Checkbox("no move", &no_move); ImGui::SameLine(150);
8231
         ImGui::Checkbox("no move", &no_move); ImGui::SameLine(150);
8157
         ImGui::Checkbox("no scrollbar", &no_scrollbar); ImGui::SameLine(300);
8232
         ImGui::Checkbox("no scrollbar", &no_scrollbar); ImGui::SameLine(300);
8158
         ImGui::Checkbox("no collapse", &no_collapse);
8233
         ImGui::Checkbox("no collapse", &no_collapse);
8159
-        ImGui::SliderFloat("fill alpha", &fill_alpha, 0.0f, 1.0f);
8234
+        ImGui::SliderFloat("bg alpha", &bg_alpha, 0.0f, 1.0f);
8160
 
8235
 
8161
         if (ImGui::TreeNode("Style"))
8236
         if (ImGui::TreeNode("Style"))
8162
         {
8237
         {
8595
 
8670
 
8596
     if (ImGui::CollapsingHeader("Columns"))
8671
     if (ImGui::CollapsingHeader("Columns"))
8597
     {
8672
     {
8598
-        ImGui::Columns(4, "data", true);
8673
+        // Basic columns
8674
+        ImGui::Text("Basic:");
8675
+        ImGui::Columns(4, "mycolumns");
8599
         ImGui::Text("ID"); ImGui::NextColumn();
8676
         ImGui::Text("ID"); ImGui::NextColumn();
8600
         ImGui::Text("Name"); ImGui::NextColumn();
8677
         ImGui::Text("Name"); ImGui::NextColumn();
8601
         ImGui::Text("Path"); ImGui::NextColumn();
8678
         ImGui::Text("Path"); ImGui::NextColumn();
8602
         ImGui::Text("Flags"); ImGui::NextColumn();
8679
         ImGui::Text("Flags"); ImGui::NextColumn();
8603
         ImGui::Separator();
8680
         ImGui::Separator();
8681
+        const char* names[3] = { "Robert", "Stephanie", "C64" };
8682
+        const char* paths[3] = { "/path/robert", "/path/stephanie", "/path/computer" };
8683
+        for (int i = 0; i < 3; i++)
8684
+        {
8685
+            ImGui::Text("%04d", i); ImGui::NextColumn();
8686
+            ImGui::Text(names[i]); ImGui::NextColumn();
8687
+            ImGui::Text(paths[i]); ImGui::NextColumn(); 
8688
+            ImGui::Text("...."); ImGui::NextColumn();
8689
+        }
8690
+        ImGui::Columns(1);
8604
 
8691
 
8605
-        ImGui::Text("0000"); ImGui::NextColumn();
8606
-        ImGui::Text("Robert"); ImGui::NextColumn();
8607
-        ImGui::Text("/path/robert"); ImGui::NextColumn();
8608
-        ImGui::Text("...."); ImGui::NextColumn();
8609
-
8610
-        ImGui::Text("0001"); ImGui::NextColumn();
8611
-        ImGui::Text("Stephanie"); ImGui::NextColumn();
8612
-        ImGui::Text("/path/stephanie"); ImGui::NextColumn();
8613
-        ImGui::Text("line 1"); ImGui::Text("line 2"); ImGui::NextColumn(); // two lines, two items
8692
+        ImGui::Separator();
8693
+        ImGui::Spacing();
8614
 
8694
 
8615
-        ImGui::Text("0002"); ImGui::NextColumn();
8616
-        ImGui::Text("C64"); ImGui::NextColumn();
8617
-        ImGui::Text("/path/computer"); ImGui::NextColumn();
8618
-        ImGui::Text("...."); ImGui::NextColumn();
8695
+        // Scrolling columns
8696
+		/*
8697
+        ImGui::Text("Scrolling:");
8698
+        ImGui::BeginChild("##header", ImVec2(0, ImGui::GetTextLineHeightWithSpacing()+ImGui::GetStyle().ItemSpacing.y));
8699
+        ImGui::Columns(3);
8700
+        ImGui::Text("ID"); ImGui::NextColumn();
8701
+        ImGui::Text("Name"); ImGui::NextColumn();
8702
+        ImGui::Text("Path"); ImGui::NextColumn();
8703
+        ImGui::Columns(1);
8704
+        ImGui::Separator();
8705
+        ImGui::EndChild();
8706
+        ImGui::BeginChild("##scrollingregion", ImVec2(0, 60));
8707
+        ImGui::Columns(3);
8708
+        for (int i = 0; i < 10; i++)
8709
+        {
8710
+            ImGui::Text("%04d", i); ImGui::NextColumn();
8711
+            ImGui::Text("Foobar"); ImGui::NextColumn();
8712
+            ImGui::Text("/path/foobar/%04d/", i); ImGui::NextColumn();
8713
+        }
8619
         ImGui::Columns(1);
8714
         ImGui::Columns(1);
8715
+        ImGui::EndChild();
8620
 
8716
 
8621
         ImGui::Separator();
8717
         ImGui::Separator();
8718
+        ImGui::Spacing();
8719
+		*/
8622
 
8720
 
8721
+        // Create multiple items in a same cell before switching to next column
8722
+        ImGui::Text("Mixed items:");
8623
         ImGui::Columns(3, "mixed");
8723
         ImGui::Columns(3, "mixed");
8724
+        ImGui::Separator();
8624
 
8725
 
8625
-        // Create multiple items in a same cell because switching to next column
8626
         static int e = 0;
8726
         static int e = 0;
8627
         ImGui::Text("Hello"); 
8727
         ImGui::Text("Hello"); 
8628
         ImGui::Button("Banana");
8728
         ImGui::Button("Banana");
8632
         ImGui::Text("ImGui"); 
8732
         ImGui::Text("ImGui"); 
8633
         ImGui::Button("Apple");
8733
         ImGui::Button("Apple");
8634
         ImGui::RadioButton("radio b", &e, 1);
8734
         ImGui::RadioButton("radio b", &e, 1);
8735
+        static float foo = 1.0f;
8736
+        ImGui::InputFloat("red", &foo, 0.05f, 0, 3); 
8635
         ImGui::Text("An extra line here.");
8737
         ImGui::Text("An extra line here.");
8636
         ImGui::NextColumn();
8738
         ImGui::NextColumn();
8637
         
8739
         
8638
         ImGui::Text("World!");
8740
         ImGui::Text("World!");
8639
         ImGui::Button("Corniflower");
8741
         ImGui::Button("Corniflower");
8640
         ImGui::RadioButton("radio c", &e, 2);
8742
         ImGui::RadioButton("radio c", &e, 2);
8743
+        static float bar = 1.0f;
8744
+        ImGui::InputFloat("blue", &bar, 0.05f, 0, 3); 
8641
         ImGui::NextColumn();
8745
         ImGui::NextColumn();
8642
 
8746
 
8643
         if (ImGui::CollapsingHeader("Category A")) ImGui::Text("Blah blah blah"); ImGui::NextColumn();
8747
         if (ImGui::CollapsingHeader("Category A")) ImGui::Text("Blah blah blah"); ImGui::NextColumn();
8644
         if (ImGui::CollapsingHeader("Category B")) ImGui::Text("Blah blah blah"); ImGui::NextColumn();
8748
         if (ImGui::CollapsingHeader("Category B")) ImGui::Text("Blah blah blah"); ImGui::NextColumn();
8645
         if (ImGui::CollapsingHeader("Category C")) ImGui::Text("Blah blah blah"); ImGui::NextColumn();
8749
         if (ImGui::CollapsingHeader("Category C")) ImGui::Text("Blah blah blah"); ImGui::NextColumn();
8646
-
8647
-        ImGui::Columns(1);
8648
-
8649
-        ImGui::Separator();
8650
-
8651
-        ImGui::Columns(2, "multiple components");
8652
-        static float foo = 1.0f;
8653
-        ImGui::InputFloat("red", &foo, 0.05f, 0, 3); ImGui::NextColumn();
8654
-        static float bar = 1.0f;
8655
-        ImGui::InputFloat("blue", &bar, 0.05f, 0, 3); ImGui::NextColumn();
8656
         ImGui::Columns(1);
8750
         ImGui::Columns(1);
8657
 
8751
 
8658
         ImGui::Separator();
8752
         ImGui::Separator();
8753
+        ImGui::Spacing();
8659
 
8754
 
8755
+        // Tree items
8756
+        ImGui::Text("Tree items:");
8660
         ImGui::Columns(2, "tree items");
8757
         ImGui::Columns(2, "tree items");
8758
+        ImGui::Separator();
8661
         if (ImGui::TreeNode("Hello")) { ImGui::BulletText("World"); ImGui::TreePop(); } ImGui::NextColumn();
8759
         if (ImGui::TreeNode("Hello")) { ImGui::BulletText("World"); ImGui::TreePop(); } ImGui::NextColumn();
8662
-        if (ImGui::TreeNode("Bonjour")) { ImGui::BulletText("Monde"); ImGui::TreePop(); }
8760
+        if (ImGui::TreeNode("Bonjour")) { ImGui::BulletText("Monde"); ImGui::TreePop(); } ImGui::NextColumn();
8663
         ImGui::Columns(1);
8761
         ImGui::Columns(1);
8762
+
8664
         ImGui::Separator();
8763
         ImGui::Separator();
8764
+        ImGui::Spacing();
8665
 
8765
 
8666
-        ImGui::Columns(2, "word wrapping");
8766
+        // Word-wrapping
8767
+        ImGui::Text("Word-wrapping:");
8768
+        ImGui::Columns(2, "word-wrapping");
8769
+        ImGui::Separator();
8667
         ImGui::TextWrapped("The quick brown fox jumps over the lazy dog.");
8770
         ImGui::TextWrapped("The quick brown fox jumps over the lazy dog.");
8668
         ImGui::Text("Hello Left");
8771
         ImGui::Text("Hello Left");
8669
         ImGui::NextColumn();
8772
         ImGui::NextColumn();
8672
         ImGui::Columns(1);
8775
         ImGui::Columns(1);
8673
 
8776
 
8674
         ImGui::Separator();
8777
         ImGui::Separator();
8778
+        ImGui::Spacing();
8675
 
8779
 
8676
         if (ImGui::TreeNode("Inside a tree.."))
8780
         if (ImGui::TreeNode("Inside a tree.."))
8677
         {
8781
         {
8678
             if (ImGui::TreeNode("node 1 (with borders)"))
8782
             if (ImGui::TreeNode("node 1 (with borders)"))
8679
             {
8783
             {
8680
                 ImGui::Columns(4);
8784
                 ImGui::Columns(4);
8681
-                ImGui::Text("aaa"); ImGui::NextColumn();
8682
-                ImGui::Text("bbb"); ImGui::NextColumn();
8683
-                ImGui::Text("ccc"); ImGui::NextColumn();
8684
-                ImGui::Text("ddd"); ImGui::NextColumn();
8685
-                ImGui::Text("eee"); ImGui::NextColumn();
8686
-                ImGui::Text("fff"); ImGui::NextColumn();
8687
-                ImGui::Text("ggg"); ImGui::NextColumn();
8688
-                ImGui::Text("hhh"); ImGui::NextColumn();
8785
+                for (int i = 0; i < 8; i++)
8786
+                {
8787
+                    ImGui::Text("%c%c%c", 'a'+i, 'a'+i, 'a'+i);
8788
+                    ImGui::NextColumn();
8789
+                }
8689
                 ImGui::Columns(1);
8790
                 ImGui::Columns(1);
8690
                 ImGui::TreePop();
8791
                 ImGui::TreePop();
8691
             }
8792
             }
8692
             if (ImGui::TreeNode("node 2 (without borders)"))
8793
             if (ImGui::TreeNode("node 2 (without borders)"))
8693
             {
8794
             {
8694
                 ImGui::Columns(4, NULL, false);
8795
                 ImGui::Columns(4, NULL, false);
8695
-                ImGui::Text("aaa"); ImGui::NextColumn();
8696
-                ImGui::Text("bbb"); ImGui::NextColumn();
8697
-                ImGui::Text("ccc"); ImGui::NextColumn();
8698
-                ImGui::Text("ddd"); ImGui::NextColumn();
8699
-                ImGui::Text("eee"); ImGui::NextColumn();
8700
-                ImGui::Text("fff"); ImGui::NextColumn();
8701
-                ImGui::Text("ggg"); ImGui::NextColumn();
8702
-                ImGui::Text("hhh"); ImGui::NextColumn();
8796
+                for (int i = 0; i < 8; i++)
8797
+                {
8798
+                    ImGui::Text("%c%c%c", 'a'+i, 'a'+i, 'a'+i);
8799
+                    ImGui::NextColumn();
8800
+                }
8703
                 ImGui::Columns(1);
8801
                 ImGui::Columns(1);
8704
                 ImGui::TreePop();
8802
                 ImGui::TreePop();
8705
             }
8803
             }
8764
                 ImGui::Text("Item with focus: %d", has_focus);
8862
                 ImGui::Text("Item with focus: %d", has_focus);
8765
             else 
8863
             else 
8766
                 ImGui::Text("Item with focus: <none>");
8864
                 ImGui::Text("Item with focus: <none>");
8865
+            ImGui::TextWrapped("Cursor & selection are preserved when refocusing last used item in code.");
8767
             ImGui::TreePop();
8866
             ImGui::TreePop();
8768
         }
8867
         }
8769
     }
8868
     }

+ 20
- 20
src/deps/imgui/imgui.h View File

1
-// ImGui library v1.32
1
+// ImGui library v1.33
2
 // See .cpp file for documentation.
2
 // See .cpp file for documentation.
3
 // See ImGui::ShowTestWindow() for sample code.
3
 // See ImGui::ShowTestWindow() for sample code.
4
 // Read 'Programmer guide' in .cpp for notes on how to setup ImGui in your codebase.
4
 // Read 'Programmer guide' in .cpp for notes on how to setup ImGui in your codebase.
142
 // - struct ImDrawList                  // Draw command list
142
 // - struct ImDrawList                  // Draw command list
143
 // - struct ImFont                      // TTF font loader, bake glyphs into bitmap
143
 // - struct ImFont                      // TTF font loader, bake glyphs into bitmap
144
 
144
 
145
-// ImGui End-user API
145
+// ImGui end-user API
146
 // In a namespace so that user can add extra functions (e.g. Value() helpers for your vector or common types)
146
 // In a namespace so that user can add extra functions (e.g. Value() helpers for your vector or common types)
147
 namespace ImGui
147
 namespace ImGui
148
 {
148
 {
157
     IMGUI_API void          ShowTestWindow(bool* open = NULL);
157
     IMGUI_API void          ShowTestWindow(bool* open = NULL);
158
 
158
 
159
     // Window
159
     // Window
160
-    IMGUI_API bool          Begin(const char* name = "Debug", bool* p_opened = NULL, ImVec2 size = ImVec2(0,0), float fill_alpha = -1.0f, ImGuiWindowFlags flags = 0);// return false when window is collapsed, so you can early out in your code. passing 'bool* p_opened' displays a Close button on the upper-right corner of the window, the pointed value will be set to false when the button is pressed.
160
+    // See implementation in .cpp for details
161
+    IMGUI_API bool          Begin(const char* name = "Debug", bool* p_opened = NULL, const ImVec2& initial_size = ImVec2(0,0), float bg_alpha = -1.0f, ImGuiWindowFlags flags = 0); // return false when window is collapsed, so you can early out in your code. passing 'bool* p_opened' displays a Close button on the upper-right corner of the window, the pointed value will be set to false when the button is pressed.
161
     IMGUI_API void          End();
162
     IMGUI_API void          End();
162
-    IMGUI_API void          BeginChild(const char* str_id, ImVec2 size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0);                         // size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). on each axis.
163
-    IMGUI_API void          BeginChild(ImGuiID id, ImVec2 size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0);                                 // "
163
+    IMGUI_API bool          BeginChild(const char* str_id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0);            // size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). on each axis.
164
+    IMGUI_API bool          BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0);                    // "
164
     IMGUI_API void          EndChild();
165
     IMGUI_API void          EndChild();
165
     IMGUI_API bool          GetWindowIsFocused();
166
     IMGUI_API bool          GetWindowIsFocused();
166
     IMGUI_API ImVec2        GetContentRegionMax();                                              // window or current column boundaries, in windows coordinates
167
     IMGUI_API ImVec2        GetContentRegionMax();                                              // window or current column boundaries, in windows coordinates
232
     IMGUI_API float         GetTextLineHeightWithSpacing();                                     // spacing (in pixels) between 2 consecutive lines of text == GetWindowFontSize() + GetStyle().ItemSpacing.y
233
     IMGUI_API float         GetTextLineHeightWithSpacing();                                     // spacing (in pixels) between 2 consecutive lines of text == GetWindowFontSize() + GetStyle().ItemSpacing.y
233
 
234
 
234
     // ID scopes
235
     // ID scopes
235
-    // If you are creating repeated widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them.
236
-    // You can also use ## within your widget name to distinguish them from each others (see 'Programmer Guide')
236
+    // If you are creating widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them.
237
+    // You can also use "##extra" within your widget name to distinguish them from each others (see 'Programmer Guide')
237
     IMGUI_API void          PushID(const char* str_id);                                         // push identifier into the ID stack. IDs are hash of the *entire* stack!
238
     IMGUI_API void          PushID(const char* str_id);                                         // push identifier into the ID stack. IDs are hash of the *entire* stack!
238
     IMGUI_API void          PushID(const void* ptr_id);
239
     IMGUI_API void          PushID(const void* ptr_id);
239
     IMGUI_API void          PushID(const int int_id);
240
     IMGUI_API void          PushID(const int int_id);
327
     // Utilities
328
     // Utilities
328
     IMGUI_API bool          IsItemHovered();                                                    // was the last item hovered by mouse?
329
     IMGUI_API bool          IsItemHovered();                                                    // was the last item hovered by mouse?
329
     IMGUI_API bool          IsItemActive();                                                     // was the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false)
330
     IMGUI_API bool          IsItemActive();                                                     // was the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false)
331
+    IMGUI_API bool          IsAnyItemActive();                                                  // 
330
     IMGUI_API ImVec2        GetItemBoxMin();                                                    // get bounding box of last item
332
     IMGUI_API ImVec2        GetItemBoxMin();                                                    // get bounding box of last item
331
     IMGUI_API ImVec2        GetItemBoxMax();                                                    // get bounding box of last item
333
     IMGUI_API ImVec2        GetItemBoxMax();                                                    // get bounding box of last item
332
     IMGUI_API bool          IsClipped(const ImVec2& item_size);                                 // to perform coarse clipping on user's side (as an optimization)
334
     IMGUI_API bool          IsClipped(const ImVec2& item_size);                                 // to perform coarse clipping on user's side (as an optimization)
390
     ImGuiInputTextFlags_CharsHexadecimal    = 1 << 1,   // Allow 0123456789ABCDEFabcdef
392
     ImGuiInputTextFlags_CharsHexadecimal    = 1 << 1,   // Allow 0123456789ABCDEFabcdef
391
     ImGuiInputTextFlags_CharsUppercase      = 1 << 2,   // Turn a..z into A..Z
393
     ImGuiInputTextFlags_CharsUppercase      = 1 << 2,   // Turn a..z into A..Z
392
     ImGuiInputTextFlags_CharsNoBlank        = 1 << 3,   // Filter out spaces, tabs
394
     ImGuiInputTextFlags_CharsNoBlank        = 1 << 3,   // Filter out spaces, tabs
393
-    ImGuiInputTextFlags_AutoSelectAll       = 1 << 4,   // Select entire text when first taking focus
395
+    ImGuiInputTextFlags_AutoSelectAll       = 1 << 4,   // Select entire text when first taking mouse focus
394
     ImGuiInputTextFlags_EnterReturnsTrue    = 1 << 5,   // Return 'true' when Enter is pressed (as opposed to when the value was modified)
396
     ImGuiInputTextFlags_EnterReturnsTrue    = 1 << 5,   // Return 'true' when Enter is pressed (as opposed to when the value was modified)
395
     ImGuiInputTextFlags_CallbackCompletion  = 1 << 6,   // Call user function on pressing TAB (for completion handling)
397
     ImGuiInputTextFlags_CallbackCompletion  = 1 << 6,   // Call user function on pressing TAB (for completion handling)
396
     ImGuiInputTextFlags_CallbackHistory     = 1 << 7,   // Call user function on pressing Up/Down arrows (for history handling)
398
     ImGuiInputTextFlags_CallbackHistory     = 1 << 7,   // Call user function on pressing Up/Down arrows (for history handling)
397
     ImGuiInputTextFlags_CallbackAlways      = 1 << 8,   // Call user function every time
399
     ImGuiInputTextFlags_CallbackAlways      = 1 << 8,   // Call user function every time
398
     ImGuiInputTextFlags_CallbackCharFilter  = 1 << 9    // Call user function to filter character. Modify data->EventChar to replace/filter input, or return 1 to discard character.
400
     ImGuiInputTextFlags_CallbackCharFilter  = 1 << 9    // Call user function to filter character. Modify data->EventChar to replace/filter input, or return 1 to discard character.
399
-    //ImGuiInputTextFlags_AlignCenter       = 1 << 6,
400
 };
401
 };
401
 
402
 
402
 // User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array
403
 // User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array
497
 enum ImGuiSetCondition_
498
 enum ImGuiSetCondition_
498
 {
499
 {
499
     ImGuiSetCondition_Always              = 1 << 0, // Set the variable
500
     ImGuiSetCondition_Always              = 1 << 0, // Set the variable
500
-    ImGuiSetCondition_FirstUseThisSession = 1 << 1, // Only set the variable on the first call for this window (once per session)
501
+    ImGuiSetCondition_FirstUseThisSession = 1 << 1, // Only set the variable on the first call per runtime session
501
     ImGuiSetCondition_FirstUseEver        = 1 << 2  // Only set the variable if the window doesn't exist in the .ini file
502
     ImGuiSetCondition_FirstUseEver        = 1 << 2  // Only set the variable if the window doesn't exist in the .ini file
502
 };
503
 };
503
 
504
 
533
 
534
 
534
     ImVec2        DisplaySize;              // <unset>              // Display size, in pixels. For clamping windows positions.
535
     ImVec2        DisplaySize;              // <unset>              // Display size, in pixels. For clamping windows positions.
535
     float         DeltaTime;                // = 1.0f/60.0f         // Time elapsed since last frame, in seconds.
536
     float         DeltaTime;                // = 1.0f/60.0f         // Time elapsed since last frame, in seconds.
536
-    float         IniSavingRate;            // = 5.0f               // Maximum time between saving .ini file, in seconds.
537
+    float         IniSavingRate;            // = 5.0f               // Maximum time between saving positions/sizes to .ini file, in seconds.
537
     const char*   IniFilename;              // = "imgui.ini"        // Path to .ini file. NULL to disable .ini saving.
538
     const char*   IniFilename;              // = "imgui.ini"        // Path to .ini file. NULL to disable .ini saving.
538
     const char*   LogFilename;              // = "imgui_log.txt"    // Path to .log file (default parameter to ImGui::LogToFile when no file is specified).
539
     const char*   LogFilename;              // = "imgui_log.txt"    // Path to .log file (default parameter to ImGui::LogToFile when no file is specified).
539
     float         MouseDoubleClickTime;     // = 0.30f              // Time for a double-click, in seconds.
540
     float         MouseDoubleClickTime;     // = 0.30f              // Time for a double-click, in seconds.
555
     // See example code if you are unsure of how to implement this.
556
     // See example code if you are unsure of how to implement this.
556
     void        (*RenderDrawListsFn)(ImDrawList** const draw_lists, int count);      
557
     void        (*RenderDrawListsFn)(ImDrawList** const draw_lists, int count);      
557
 
558
 
558
-    // Optional: access OS clipboard (default to use native Win32 clipboard on Windows, otherwise use a ImGui private clipboard)
559
-    // Override to access OS clipboard on other architectures.
559
+    // Optional: access OS clipboard
560
+    // (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures)
560
     const char* (*GetClipboardTextFn)();
561
     const char* (*GetClipboardTextFn)();
561
     void        (*SetClipboardTextFn)(const char* text);
562
     void        (*SetClipboardTextFn)(const char* text);
562
 
563
 
564
     void*       (*MemAllocFn)(size_t sz);
565
     void*       (*MemAllocFn)(size_t sz);
565
     void        (*MemFreeFn)(void* ptr);
566
     void        (*MemFreeFn)(void* ptr);
566
 
567
 
567
-    // Optional: notify OS Input Method Editor of the screen position of your cursor for text input position (e.g. when using Japanese/Chinese inputs in Windows)
568
+    // Optional: notify OS Input Method Editor of the screen position of your cursor for text input position (e.g. when using Japanese/Chinese IME in Windows)
568
     void        (*ImeSetInputScreenPosFn)(int x, int y);
569
     void        (*ImeSetInputScreenPosFn)(int x, int y);
569
 
570
 
570
     //------------------------------------------------------------------
571
     //------------------------------------------------------------------
572
     //------------------------------------------------------------------
573
     //------------------------------------------------------------------
573
 
574
 
574
     ImVec2      MousePos;                   // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.)
575
     ImVec2      MousePos;                   // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.)
575
-    bool        MouseDown[5];               // Mouse buttons. ImGui itself only uses button 0 (left button) but you can use others as storage for convenience.
576
+    bool        MouseDown[5];               // Mouse buttons. ImGui itself only uses button 0 (left button). Others buttons allows to track if mouse is being used by your application + available to user as a convenience via IsMouse** API.
576
     float       MouseWheel;                 // Mouse wheel: 1 unit scrolls about 5 lines text. 
577
     float       MouseWheel;                 // Mouse wheel: 1 unit scrolls about 5 lines text. 
577
     bool        MouseDrawCursor;            // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).
578
     bool        MouseDrawCursor;            // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).
578
     bool        KeyCtrl;                    // Keyboard modifier pressed: Control
579
     bool        KeyCtrl;                    // Keyboard modifier pressed: Control
579
     bool        KeyShift;                   // Keyboard modifier pressed: Shift
580
     bool        KeyShift;                   // Keyboard modifier pressed: Shift
580
-    bool        KeysDown[512];              // Keyboard keys that are pressed (in whatever order user naturally has access to keyboard data)
581
+    bool        KeysDown[512];              // Keyboard keys that are pressed (in whatever storage order you naturally have access to keyboard data)
581
     ImWchar     InputCharacters[16+1];      // List of characters input (translated by user from keypress+keyboard state). Fill using AddInputCharacter() helper.
582
     ImWchar     InputCharacters[16+1];      // List of characters input (translated by user from keypress+keyboard state). Fill using AddInputCharacter() helper.
582
 
583
 
583
     // Function
584
     // Function
595
     // [Internal] ImGui will maintain those fields for you
596
     // [Internal] ImGui will maintain those fields for you
596
     //------------------------------------------------------------------
597
     //------------------------------------------------------------------
597
 
598
 
598
-    ImVec2      MousePosPrev;               //
599
+    ImVec2      MousePosPrev;               // Previous mouse position
599
     ImVec2      MouseDelta;                 // Mouse delta. Note that this is zero if either current or previous position are negative to allow mouse enabling/disabling.
600
     ImVec2      MouseDelta;                 // Mouse delta. Note that this is zero if either current or previous position are negative to allow mouse enabling/disabling.
600
     bool        MouseClicked[5];            // Mouse button went from !Down to Down
601
     bool        MouseClicked[5];            // Mouse button went from !Down to Down
601
     ImVec2      MouseClickedPos[5];         // Position at time of clicking
602
     ImVec2      MouseClickedPos[5];         // Position at time of clicking
651
     ImVector<TextRange> Filters;
652
     ImVector<TextRange> Filters;
652
     int                 CountGrep;
653
     int                 CountGrep;
653
 
654
 
654
-    ImGuiTextFilter();
655
+    ImGuiTextFilter(const char* default_filter = "");
655
     void Clear() { InputBuf[0] = 0; Build(); }
656
     void Clear() { InputBuf[0] = 0; Build(); }
656
     void Draw(const char* label = "Filter (inc,-exc)", float width = -1.0f);    // Helper calling InputText+Build
657
     void Draw(const char* label = "Filter (inc,-exc)", float width = -1.0f);    // Helper calling InputText+Build
657
     bool PassFilter(const char* val) const;
658
     bool PassFilter(const char* val) const;
751
     ImColor(int r, int g, int b, int a = 255)                       { Value.x = (float)r / 255.0f; Value.y = (float)g / 255.0f; Value.z = (float)b / 255.0f; Value.w = (float)a / 255.0f; }
752
     ImColor(int r, int g, int b, int a = 255)                       { Value.x = (float)r / 255.0f; Value.y = (float)g / 255.0f; Value.z = (float)b / 255.0f; Value.w = (float)a / 255.0f; }
752
     ImColor(float r, float g, float b, float a = 1.0f)              { Value.x = r; Value.y = g; Value.z = b; Value.w = a; }
753
     ImColor(float r, float g, float b, float a = 1.0f)              { Value.x = r; Value.y = g; Value.z = b; Value.w = a; }
753
     ImColor(const ImVec4& col)                                      { Value = col; }
754
     ImColor(const ImVec4& col)                                      { Value = col; }
754
-
755
     operator ImU32() const                                          { return ImGui::ColorConvertFloat4ToU32(Value); }
755
     operator ImU32() const                                          { return ImGui::ColorConvertFloat4ToU32(Value); }
756
     operator ImVec4() const                                         { return Value; }
756
     operator ImVec4() const                                         { return Value; }
757
 
757
 
774
 // It is up to you to decide if your rendering loop or the callback should be responsible for backup/restoring rendering state.
774
 // It is up to you to decide if your rendering loop or the callback should be responsible for backup/restoring rendering state.
775
 typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd);
775
 typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd);
776
 
776
 
777
-// Typically, 1 command = 1 gpu draw call
777
+// Typically, 1 command = 1 gpu draw call (unless command is a callback)
778
 struct ImDrawCmd
778
 struct ImDrawCmd
779
 {
779
 {
780
     unsigned int    vtx_count;                  // Number of vertices (multiple of 3) to be drawn as triangles. The vertices are stored in the callee ImDrawList's vtx_buffer[] array.
780
     unsigned int    vtx_count;                  // Number of vertices (multiple of 3) to be drawn as triangles. The vertices are stored in the callee ImDrawList's vtx_buffer[] array.

Loading…
Cancel
Save