mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-11-04 01:34:32 +00:00 
			
		
		
		
	Messy... Broken by 66f0fb9. Added ImGuiItemFlags_NoTabStop to EndGroup() ahead of time (not strictly needed here).
			
			
This commit is contained in:
		@@ -7942,7 +7942,7 @@ void ImGui::EndGroup()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    window->DC.CurrLineTextBaseOffset = ImMax(window->DC.PrevLineTextBaseOffset, group_data.BackupCurrLineTextBaseOffset);      // FIXME: Incorrect, we should grab the base offset from the *first line* of the group but it is hard to obtain now.
 | 
					    window->DC.CurrLineTextBaseOffset = ImMax(window->DC.PrevLineTextBaseOffset, group_data.BackupCurrLineTextBaseOffset);      // FIXME: Incorrect, we should grab the base offset from the *first line* of the group but it is hard to obtain now.
 | 
				
			||||||
    ItemSize(group_bb.GetSize());
 | 
					    ItemSize(group_bb.GetSize());
 | 
				
			||||||
    ItemAdd(group_bb, 0);
 | 
					    ItemAdd(group_bb, 0, NULL, ImGuiItemFlags_NoTabStop);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive(), IsItemDeactivated() etc. will be functional on the entire group.
 | 
					    // If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive(), IsItemDeactivated() etc. will be functional on the entire group.
 | 
				
			||||||
    // It would be be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but would put a little more burden on individual widgets.
 | 
					    // It would be be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but would put a little more burden on individual widgets.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2285,7 +2285,7 @@ static void ShowDemoWindowWidgets()
 | 
				
			|||||||
        // Select an item type
 | 
					        // Select an item type
 | 
				
			||||||
        const char* item_names[] =
 | 
					        const char* item_names[] =
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            "Text", "Button", "Button (w/ repeat)", "Checkbox", "SliderFloat", "InputText", "InputFloat",
 | 
					            "Text", "Button", "Button (w/ repeat)", "Checkbox", "SliderFloat", "InputText", "InputTextMultiline", "InputFloat",
 | 
				
			||||||
            "InputFloat3", "ColorEdit4", "Selectable", "MenuItem", "TreeNode", "TreeNode (w/ double-click)", "Combo", "ListBox"
 | 
					            "InputFloat3", "ColorEdit4", "Selectable", "MenuItem", "TreeNode", "TreeNode (w/ double-click)", "Combo", "ListBox"
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        static int item_type = 4;
 | 
					        static int item_type = 4;
 | 
				
			||||||
@@ -2308,15 +2308,16 @@ static void ShowDemoWindowWidgets()
 | 
				
			|||||||
        if (item_type == 3) { ret = ImGui::Checkbox("ITEM: Checkbox", &b); }                            // Testing checkbox
 | 
					        if (item_type == 3) { ret = ImGui::Checkbox("ITEM: Checkbox", &b); }                            // Testing checkbox
 | 
				
			||||||
        if (item_type == 4) { ret = ImGui::SliderFloat("ITEM: SliderFloat", &col4f[0], 0.0f, 1.0f); }   // Testing basic item
 | 
					        if (item_type == 4) { ret = ImGui::SliderFloat("ITEM: SliderFloat", &col4f[0], 0.0f, 1.0f); }   // Testing basic item
 | 
				
			||||||
        if (item_type == 5) { ret = ImGui::InputText("ITEM: InputText", &str[0], IM_ARRAYSIZE(str)); }  // Testing input text (which handles tabbing)
 | 
					        if (item_type == 5) { ret = ImGui::InputText("ITEM: InputText", &str[0], IM_ARRAYSIZE(str)); }  // Testing input text (which handles tabbing)
 | 
				
			||||||
        if (item_type == 6) { ret = ImGui::InputFloat("ITEM: InputFloat", col4f, 1.0f); }               // Testing +/- buttons on scalar input
 | 
					        if (item_type == 6) { ret = ImGui::InputTextMultiline("ITEM: InputTextMultiline", &str[0], IM_ARRAYSIZE(str)); } // Testing input text (which uses a child window)
 | 
				
			||||||
        if (item_type == 7) { ret = ImGui::InputFloat3("ITEM: InputFloat3", col4f); }                   // Testing multi-component items (IsItemXXX flags are reported merged)
 | 
					        if (item_type == 7) { ret = ImGui::InputFloat("ITEM: InputFloat", col4f, 1.0f); }               // Testing +/- buttons on scalar input
 | 
				
			||||||
        if (item_type == 8) { ret = ImGui::ColorEdit4("ITEM: ColorEdit4", col4f); }                     // Testing multi-component items (IsItemXXX flags are reported merged)
 | 
					        if (item_type == 8) { ret = ImGui::InputFloat3("ITEM: InputFloat3", col4f); }                   // Testing multi-component items (IsItemXXX flags are reported merged)
 | 
				
			||||||
        if (item_type == 9) { ret = ImGui::Selectable("ITEM: Selectable"); }                            // Testing selectable item
 | 
					        if (item_type == 9) { ret = ImGui::ColorEdit4("ITEM: ColorEdit4", col4f); }                     // Testing multi-component items (IsItemXXX flags are reported merged)
 | 
				
			||||||
        if (item_type == 10){ ret = ImGui::MenuItem("ITEM: MenuItem"); }                                // Testing menu item (they use ImGuiButtonFlags_PressedOnRelease button policy)
 | 
					        if (item_type == 10){ ret = ImGui::Selectable("ITEM: Selectable"); }                            // Testing selectable item
 | 
				
			||||||
        if (item_type == 11){ ret = ImGui::TreeNode("ITEM: TreeNode"); if (ret) ImGui::TreePop(); }     // Testing tree node
 | 
					        if (item_type == 11){ ret = ImGui::MenuItem("ITEM: MenuItem"); }                                // Testing menu item (they use ImGuiButtonFlags_PressedOnRelease button policy)
 | 
				
			||||||
        if (item_type == 12){ ret = ImGui::TreeNodeEx("ITEM: TreeNode w/ ImGuiTreeNodeFlags_OpenOnDoubleClick", ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_NoTreePushOnOpen); } // Testing tree node with ImGuiButtonFlags_PressedOnDoubleClick button policy.
 | 
					        if (item_type == 12){ ret = ImGui::TreeNode("ITEM: TreeNode"); if (ret) ImGui::TreePop(); }     // Testing tree node
 | 
				
			||||||
        if (item_type == 13){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::Combo("ITEM: Combo", ¤t, items, IM_ARRAYSIZE(items)); }
 | 
					        if (item_type == 13){ ret = ImGui::TreeNodeEx("ITEM: TreeNode w/ ImGuiTreeNodeFlags_OpenOnDoubleClick", ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_NoTreePushOnOpen); } // Testing tree node with ImGuiButtonFlags_PressedOnDoubleClick button policy.
 | 
				
			||||||
        if (item_type == 14){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::ListBox("ITEM: ListBox", ¤t, items, IM_ARRAYSIZE(items), IM_ARRAYSIZE(items)); }
 | 
					        if (item_type == 14){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::Combo("ITEM: Combo", ¤t, items, IM_ARRAYSIZE(items)); }
 | 
				
			||||||
 | 
					        if (item_type == 15){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::ListBox("ITEM: ListBox", ¤t, items, IM_ARRAYSIZE(items), IM_ARRAYSIZE(items)); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Display the values of IsItemHovered() and other common item state functions.
 | 
					        // Display the values of IsItemHovered() and other common item state functions.
 | 
				
			||||||
        // Note that the ImGuiHoveredFlags_XXX flags can be combined.
 | 
					        // Note that the ImGuiHoveredFlags_XXX flags can be combined.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3979,6 +3979,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
 | 
				
			|||||||
    ImGuiWindow* draw_window = window;
 | 
					    ImGuiWindow* draw_window = window;
 | 
				
			||||||
    ImVec2 inner_size = frame_size;
 | 
					    ImVec2 inner_size = frame_size;
 | 
				
			||||||
    ImGuiItemStatusFlags item_status_flags = 0;
 | 
					    ImGuiItemStatusFlags item_status_flags = 0;
 | 
				
			||||||
 | 
					    ImGuiLastItemData item_data_backup;
 | 
				
			||||||
    if (is_multiline)
 | 
					    if (is_multiline)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        ImVec2 backup_pos = window->DC.CursorPos;
 | 
					        ImVec2 backup_pos = window->DC.CursorPos;
 | 
				
			||||||
@@ -3989,6 +3990,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
 | 
				
			|||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        item_status_flags = g.LastItemData.StatusFlags;
 | 
					        item_status_flags = g.LastItemData.StatusFlags;
 | 
				
			||||||
 | 
					        item_data_backup = g.LastItemData;
 | 
				
			||||||
        window->DC.CursorPos = backup_pos;
 | 
					        window->DC.CursorPos = backup_pos;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // We reproduce the contents of BeginChildFrame() in order to provide 'label' so our window internal data are easier to read/debug.
 | 
					        // We reproduce the contents of BeginChildFrame() in order to provide 'label' so our window internal data are easier to read/debug.
 | 
				
			||||||
@@ -4773,18 +4775,19 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
 | 
				
			|||||||
        // For focus requests to work on our multiline we need to ensure our child ItemAdd() call specifies the ImGuiItemFlags_Inputable (ref issue #4761)...
 | 
					        // For focus requests to work on our multiline we need to ensure our child ItemAdd() call specifies the ImGuiItemFlags_Inputable (ref issue #4761)...
 | 
				
			||||||
        Dummy(ImVec2(text_size.x, text_size.y + style.FramePadding.y));
 | 
					        Dummy(ImVec2(text_size.x, text_size.y + style.FramePadding.y));
 | 
				
			||||||
        ImGuiItemFlags backup_item_flags = g.CurrentItemFlags;
 | 
					        ImGuiItemFlags backup_item_flags = g.CurrentItemFlags;
 | 
				
			||||||
        g.CurrentItemFlags |= ImGuiItemFlags_Inputable;
 | 
					        g.CurrentItemFlags |= ImGuiItemFlags_Inputable | ImGuiItemFlags_NoTabStop;
 | 
				
			||||||
        EndChild();
 | 
					        EndChild();
 | 
				
			||||||
 | 
					        item_data_backup.StatusFlags |= (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HoveredWindow);
 | 
				
			||||||
        g.CurrentItemFlags = backup_item_flags;
 | 
					        g.CurrentItemFlags = backup_item_flags;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // ...and then we need to undo the group overriding last item data, which gets a bit messy as EndGroup() tries to forward scrollbar being active...
 | 
					        // ...and then we need to undo the group overriding last item data, which gets a bit messy as EndGroup() tries to forward scrollbar being active...
 | 
				
			||||||
        ImGuiLastItemData item_data = g.LastItemData;
 | 
					        // FIXME: This quite messy/tricky, should attempt to get rid of the child window.
 | 
				
			||||||
        EndGroup();
 | 
					        EndGroup();
 | 
				
			||||||
        if (g.LastItemData.ID == 0)
 | 
					        if (g.LastItemData.ID == 0)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            g.LastItemData.ID = id;
 | 
					            g.LastItemData.ID = id;
 | 
				
			||||||
            g.LastItemData.InFlags = item_data.InFlags;
 | 
					            g.LastItemData.InFlags = item_data_backup.InFlags;
 | 
				
			||||||
            g.LastItemData.StatusFlags = item_data.StatusFlags;
 | 
					            g.LastItemData.StatusFlags = item_data_backup.StatusFlags;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user