mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-30 20:51:06 +01:00 
			
		
		
		
	Merge branch 'master' into navigation
# Conflicts: # imgui.cpp # imgui.h
This commit is contained in:
		
							
								
								
									
										11
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								imgui.cpp
									
									
									
									
									
								
							| @@ -6888,7 +6888,10 @@ void ImGui::SetKeyboardFocusHere(int offset) | |||||||
| void ImGui::SetItemDefaultFocus() | void ImGui::SetItemDefaultFocus() | ||||||
| { | { | ||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
|     if (g.NavWindow == g.CurrentWindow->RootNavWindow && (g.NavInitRequest || g.NavInitResultId != 0) && g.NavLayer == g.NavWindow->DC.NavLayerCurrent) |     ImGuiWindow* window = g.CurrentWindow; | ||||||
|  |     if (!window->Appearing) | ||||||
|  |         return; | ||||||
|  |     if (g.NavWindow == window->RootNavWindow && (g.NavInitRequest || g.NavInitResultId != 0) && g.NavLayer == g.NavWindow->DC.NavLayerCurrent) | ||||||
|     { |     { | ||||||
|         g.NavInitRequest = false; |         g.NavInitRequest = false; | ||||||
|         g.NavInitResultExplicit = true; |         g.NavInitResultExplicit = true; | ||||||
| @@ -10304,7 +10307,7 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi | |||||||
|         return false; |         return false; | ||||||
|  |  | ||||||
|     // Display items |     // Display items | ||||||
|     // FIXME-OPT: Use clipper (if we can disable it on the appearing frame to make sure our call to SetScrollHere() is processed) |     // FIXME-OPT: Use clipper (but we need to disable it on the appearing frame to make sure our call to SetItemDefaultFocus() is processed) | ||||||
|     bool value_changed = false; |     bool value_changed = false; | ||||||
|     for (int i = 0; i < items_count; i++) |     for (int i = 0; i < items_count; i++) | ||||||
|     { |     { | ||||||
| @@ -10318,8 +10321,8 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi | |||||||
|             value_changed = true; |             value_changed = true; | ||||||
|             *current_item = i; |             *current_item = i; | ||||||
|         } |         } | ||||||
|         if (item_selected && IsWindowAppearing()) |         if (item_selected) | ||||||
|             SetItemDefaultFocus(); //SetScrollHere(); |             SetItemDefaultFocus(); | ||||||
|         PopID(); |         PopID(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										9
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								imgui.h
									
									
									
									
									
								
							| @@ -180,7 +180,7 @@ namespace ImGui | |||||||
|     IMGUI_API float         GetScrollMaxY();                                                    // get maximum scrolling amount ~~ ContentSize.Y - WindowSize.Y |     IMGUI_API float         GetScrollMaxY();                                                    // get maximum scrolling amount ~~ ContentSize.Y - WindowSize.Y | ||||||
|     IMGUI_API void          SetScrollX(float scroll_x);                                         // set scrolling amount [0..GetScrollMaxX()] |     IMGUI_API void          SetScrollX(float scroll_x);                                         // set scrolling amount [0..GetScrollMaxX()] | ||||||
|     IMGUI_API void          SetScrollY(float scroll_y);                                         // set scrolling amount [0..GetScrollMaxY()] |     IMGUI_API void          SetScrollY(float scroll_y);                                         // set scrolling amount [0..GetScrollMaxY()] | ||||||
|     IMGUI_API void          SetScrollHere(float center_y_ratio = 0.5f);                         // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. |     IMGUI_API void          SetScrollHere(float center_y_ratio = 0.5f);                         // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead. | ||||||
|     IMGUI_API void          SetScrollFromPosY(float pos_y, float center_y_ratio = 0.5f);        // adjust scrolling amount to make given position valid. use GetCursorPos() or GetCursorStartPos()+offset to get valid positions. |     IMGUI_API void          SetScrollFromPosY(float pos_y, float center_y_ratio = 0.5f);        // adjust scrolling amount to make given position valid. use GetCursorPos() or GetCursorStartPos()+offset to get valid positions. | ||||||
|     IMGUI_API void          SetStateStorage(ImGuiStorage* tree);                                // replace tree state storage with our own (if you want to manipulate it yourself, typically clear subsection of it) |     IMGUI_API void          SetStateStorage(ImGuiStorage* tree);                                // replace tree state storage with our own (if you want to manipulate it yourself, typically clear subsection of it) | ||||||
|     IMGUI_API ImGuiStorage* GetStateStorage(); |     IMGUI_API ImGuiStorage* GetStateStorage(); | ||||||
| @@ -431,8 +431,8 @@ namespace ImGui | |||||||
|     // Focus, Activation |     // Focus, Activation | ||||||
|     IMGUI_API void          ActivateItem(ImGuiID id);                                           // remotely activate a button, checkbox, tree node etc. given its unique ID. activation is queued and processed on the next frame when the item is encountered again. |     IMGUI_API void          ActivateItem(ImGuiID id);                                           // remotely activate a button, checkbox, tree node etc. given its unique ID. activation is queued and processed on the next frame when the item is encountered again. | ||||||
|     IMGUI_API ImGuiID       GetItemID();                                                        // get id of previous item, generally ~GetID(label) |     IMGUI_API ImGuiID       GetItemID();                                                        // get id of previous item, generally ~GetID(label) | ||||||
|     IMGUI_API void          SetKeyboardFocusHere(int offset = 0);  // FIXME-NAVIGATION          // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget. |     IMGUI_API void          SetItemDefaultFocus();                                              // make last item the default focused item of a window. Please use instead of "if (IsWindowAppearing()) SetScrollHere()" to signify "default item". | ||||||
|     IMGUI_API void          SetItemDefaultFocus(); // FIXME-NAVIGATION                          // make last item the default focused item of a window |     IMGUI_API void          SetKeyboardFocusHere(int offset = 0);                               // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget. | ||||||
|  |  | ||||||
|     // Utilities |     // Utilities | ||||||
|     IMGUI_API bool          IsItemHovered(ImGuiHoveredFlags flags = 0);                         // is the last item hovered by mouse (and usable)? or we are currently using Nav and the item is focused. |     IMGUI_API bool          IsItemHovered(ImGuiHoveredFlags flags = 0);                         // is the last item hovered by mouse (and usable)? or we are currently using Nav and the item is focused. | ||||||
| @@ -989,9 +989,6 @@ namespace ImGui | |||||||
|     static inline bool      IsMouseHoveringAnyWindow() { return IsAnyWindowHovered(); }        // OBSOLETE 1.51+ |     static inline bool      IsMouseHoveringAnyWindow() { return IsAnyWindowHovered(); }        // OBSOLETE 1.51+ | ||||||
|     static inline bool      IsMouseHoveringWindow() { return IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem); } // OBSOLETE 1.51+ |     static inline bool      IsMouseHoveringWindow() { return IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem); } // OBSOLETE 1.51+ | ||||||
|     static inline bool      CollapsingHeader(const char* label, const char* str_id, bool framed = true, bool default_open = false) { (void)str_id; (void)framed; ImGuiTreeNodeFlags default_open_flags = 1 << 5; return CollapsingHeader(label, (default_open ? default_open_flags : 0)); } // OBSOLETE 1.49+ |     static inline bool      CollapsingHeader(const char* label, const char* str_id, bool framed = true, bool default_open = false) { (void)str_id; (void)framed; ImGuiTreeNodeFlags default_open_flags = 1 << 5; return CollapsingHeader(label, (default_open ? default_open_flags : 0)); } // OBSOLETE 1.49+ | ||||||
|     static inline ImFont*   GetWindowFont() { return GetFont(); }                              // OBSOLETE 1.48+ |  | ||||||
|     static inline float     GetWindowFontSize() { return GetFontSize(); }                      // OBSOLETE 1.48+ |  | ||||||
|     static inline void      SetScrollPosHere() { SetScrollHere(); }                            // OBSOLETE 1.42+ |  | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1655,7 +1655,7 @@ void ImGui::ShowTestWindow(bool* p_open) | |||||||
|  |  | ||||||
|         if (ImGui::TreeNode("Horizontal Scrolling")) |         if (ImGui::TreeNode("Horizontal Scrolling")) | ||||||
|         { |         { | ||||||
|             ImGui::SetNextWindowContentWidth(1500); |             ImGui::SetNextWindowContentSize(ImVec2(1500.0f, 0.0f)); | ||||||
|             ImGui::BeginChild("##ScrollingRegion", ImVec2(0, ImGui::GetFontSize() * 20), false, ImGuiWindowFlags_HorizontalScrollbar); |             ImGui::BeginChild("##ScrollingRegion", ImVec2(0, ImGui::GetFontSize() * 20), false, ImGuiWindowFlags_HorizontalScrollbar); | ||||||
|             ImGui::Columns(10); |             ImGui::Columns(10); | ||||||
|             int ITEMS_COUNT = 2000; |             int ITEMS_COUNT = 2000; | ||||||
|   | |||||||
| @@ -22,6 +22,9 @@ | |||||||
| #if !defined(alloca) | #if !defined(alloca) | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
| #include <malloc.h>     // alloca | #include <malloc.h>     // alloca | ||||||
|  | #if !defined(alloca) | ||||||
|  | #define alloca _alloca  // for clang with MS Codegen | ||||||
|  | #endif | ||||||
| #elif defined(__GLIBC__) || defined(__sun) | #elif defined(__GLIBC__) || defined(__sun) | ||||||
| #include <alloca.h>     // alloca | #include <alloca.h>     // alloca | ||||||
| #else | #else | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user