mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-10-26 12:27:30 +00:00 
			
		
		
		
	Renamed OpenPopupOnItemClick() to OpenPopupContextItem(). Kept inline redirection function (will obsolete). + Removed CalcItemRectClosestPoint() entry point
This commit is contained in:
		| @@ -38,6 +38,8 @@ Breaking Changes: | |||||||
|  |  | ||||||
| - Removed unncessary ID (first arg) of ImFontAtlas::AddCustomRectRegular() function. Please | - Removed unncessary ID (first arg) of ImFontAtlas::AddCustomRectRegular() function. Please | ||||||
|   note that this is a Beta api and will likely be reworked to support multi-monitor multi-DPI. |   note that this is a Beta api and will likely be reworked to support multi-monitor multi-DPI. | ||||||
|  | - Renamed OpenPopupOnItemClick() to OpenPopupContextItem(). Kept inline redirection function (will obsolete). | ||||||
|  | - Removed CalcItemRectClosestPoint() entry point which was made obsolete and asserting in December 2017. | ||||||
|  |  | ||||||
| Other Changes: | Other Changes: | ||||||
|  |  | ||||||
|   | |||||||
| @@ -203,7 +203,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i | |||||||
|  |  | ||||||
| !- popups/menus: clarify usage of popups id, how MenuItem/Selectable closing parent popups affects the ID, etc. this is quite fishy needs improvement! (#331, #402) | !- popups/menus: clarify usage of popups id, how MenuItem/Selectable closing parent popups affects the ID, etc. this is quite fishy needs improvement! (#331, #402) | ||||||
|  - popups/modal: make modal title bar blink when trying to click outside the modal |  - popups/modal: make modal title bar blink when trying to click outside the modal | ||||||
|  - popups: reopening context menu at new position should be the behavior by default? (equivalent to internal OpenPopupEx() with reopen_existing=true) (~#1497) |  | ||||||
|  - popups: if the popup functions took explicit ImGuiID it would allow the user to manage the scope of those ID. (#331) |  - popups: if the popup functions took explicit ImGuiID it would allow the user to manage the scope of those ID. (#331) | ||||||
|  - popups: clicking outside (to close popup) and holding shouldn't drag window below. |  - popups: clicking outside (to close popup) and holding shouldn't drag window below. | ||||||
|  - popups: add variant using global identifier similar to Begin/End (#402) |  - popups: add variant using global identifier similar to Begin/End (#402) | ||||||
|   | |||||||
| @@ -372,7 +372,9 @@ CODE | |||||||
|  When you are not sure about a old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files. |  When you are not sure about a old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files. | ||||||
|  You can read releases logs https://github.com/ocornut/imgui/releases for more details. |  You can read releases logs https://github.com/ocornut/imgui/releases for more details. | ||||||
|  |  | ||||||
|  - 2020/04/23 (1.77) - Removed unnecessary ID (first arg) of ImFontAtlas::AddCustomRectRegular(). |  - 2020/06/15 (1.77) - renamed OpenPopupOnItemClick() to OpenPopupContextItem(). Kept inline redirection function (will obsolete). | ||||||
|  |  - 2020/06/15 (1.77) - removed CalcItemRectClosestPoint() entry point which was made obsolete and asserting in December 2017. | ||||||
|  |  - 2020/04/23 (1.77) - removed unnecessary ID (first arg) of ImFontAtlas::AddCustomRectRegular(). | ||||||
|  - 2020/01/22 (1.75) - ImDrawList::AddCircle()/AddCircleFilled() functions don't accept negative radius any more. |  - 2020/01/22 (1.75) - ImDrawList::AddCircle()/AddCircleFilled() functions don't accept negative radius any more. | ||||||
|  - 2019/12/17 (1.75) - [undid this change in 1.76] made Columns() limited to 64 columns by asserting above that limit. While the current code technically supports it, future code may not so we're putting the restriction ahead. |  - 2019/12/17 (1.75) - [undid this change in 1.76] made Columns() limited to 64 columns by asserting above that limit. While the current code technically supports it, future code may not so we're putting the restriction ahead. | ||||||
|  - 2019/12/13 (1.75) - [imgui_internal.h] changed ImRect() default constructor initializes all fields to 0.0f instead of (FLT_MAX,FLT_MAX,-FLT_MAX,-FLT_MAX). If you used ImRect::Add() to create bounding boxes by adding multiple points into it, you may need to fix your initial value. |  - 2019/12/13 (1.75) - [imgui_internal.h] changed ImRect() default constructor initializes all fields to 0.0f instead of (FLT_MAX,FLT_MAX,-FLT_MAX,-FLT_MAX). If you used ImRect::Add() to create bounding boxes by adding multiple points into it, you may need to fix your initial value. | ||||||
| @@ -7842,7 +7844,7 @@ void ImGui::EndPopup() | |||||||
|     g.WithinEndChild = false; |     g.WithinEndChild = false; | ||||||
| } | } | ||||||
|  |  | ||||||
| bool ImGui::OpenPopupOnItemClick(const char* str_id, ImGuiMouseButton mouse_button) | bool ImGui::OpenPopupContextItem(const char* str_id, ImGuiMouseButton mouse_button) | ||||||
| { | { | ||||||
|     ImGuiWindow* window = GImGui->CurrentWindow; |     ImGuiWindow* window = GImGui->CurrentWindow; | ||||||
|     if (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) |     if (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								imgui.h
									
									
									
									
									
								
							| @@ -609,7 +609,7 @@ namespace ImGui | |||||||
|     IMGUI_API bool          BeginPopupContextVoid(const char* str_id = NULL, ImGuiMouseButton mouse_button = 1);                    // helper to open and begin popup when clicked in void (where there are no imgui windows). |     IMGUI_API bool          BeginPopupContextVoid(const char* str_id = NULL, ImGuiMouseButton mouse_button = 1);                    // helper to open and begin popup when clicked in void (where there are no imgui windows). | ||||||
|     IMGUI_API bool          BeginPopupModal(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0);                     // modal dialog (regular window with title bar, block interactions behind the modal window, can't close the modal window by clicking outside) |     IMGUI_API bool          BeginPopupModal(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0);                     // modal dialog (regular window with title bar, block interactions behind the modal window, can't close the modal window by clicking outside) | ||||||
|     IMGUI_API void          EndPopup();                                                                                             // only call EndPopup() if BeginPopupXXX() returns true! |     IMGUI_API void          EndPopup();                                                                                             // only call EndPopup() if BeginPopupXXX() returns true! | ||||||
|     IMGUI_API bool          OpenPopupOnItemClick(const char* str_id = NULL, ImGuiMouseButton mouse_button = 1);                     // helper to open popup when clicked on last item (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors). return true when just opened. |     IMGUI_API bool          OpenPopupContextItem(const char* str_id = NULL, ImGuiMouseButton mouse_button = 1);                     // helper to open popup when clicked on last item (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors). return true when just opened. | ||||||
|     IMGUI_API bool          IsPopupOpen(const char* str_id);                                    // return true if the popup is open at the current begin-ed level of the popup stack. |     IMGUI_API bool          IsPopupOpen(const char* str_id);                                    // return true if the popup is open at the current begin-ed level of the popup stack. | ||||||
|     IMGUI_API void          CloseCurrentPopup();                                                // close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup. |     IMGUI_API void          CloseCurrentPopup();                                                // close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup. | ||||||
|  |  | ||||||
| @@ -1632,6 +1632,8 @@ struct ImGuiPayload | |||||||
| #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | ||||||
| namespace ImGui | namespace ImGui | ||||||
| { | { | ||||||
|  |     // OBSOLETED in 1.77 (from June 2020) | ||||||
|  |     static inline bool  OpenPopupOnItemClick(const char* str_id = NULL, ImGuiMouseButton mouse_button = 1) { return OpenPopupContextItem(str_id, mouse_button); } | ||||||
|     // OBSOLETED in 1.72 (from July 2019) |     // OBSOLETED in 1.72 (from July 2019) | ||||||
|     static inline void  TreeAdvanceToLabelPos()               { SetCursorPosX(GetCursorPosX() + GetTreeNodeToLabelSpacing()); } |     static inline void  TreeAdvanceToLabelPos()               { SetCursorPosX(GetCursorPosX() + GetTreeNodeToLabelSpacing()); } | ||||||
|     // OBSOLETED in 1.71 (from June 2019) |     // OBSOLETED in 1.71 (from June 2019) | ||||||
| @@ -1652,7 +1654,6 @@ namespace ImGui | |||||||
|     // OBSOLETED in 1.60 (between Dec 2017 and Apr 2018) |     // OBSOLETED in 1.60 (between Dec 2017 and Apr 2018) | ||||||
|     static inline bool  IsAnyWindowFocused()                  { return IsWindowFocused(ImGuiFocusedFlags_AnyWindow); } |     static inline bool  IsAnyWindowFocused()                  { return IsWindowFocused(ImGuiFocusedFlags_AnyWindow); } | ||||||
|     static inline bool  IsAnyWindowHovered()                  { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); } |     static inline bool  IsAnyWindowHovered()                  { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); } | ||||||
|     static inline ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = 0.f) { IM_UNUSED(on_edge); IM_UNUSED(outward); IM_ASSERT(0); return pos; } |  | ||||||
| } | } | ||||||
| typedef ImGuiInputTextCallback      ImGuiTextEditCallback;    // OBSOLETED in 1.63 (from Aug 2018): made the names consistent | typedef ImGuiInputTextCallback      ImGuiTextEditCallback;    // OBSOLETED in 1.63 (from Aug 2018): made the names consistent | ||||||
| typedef ImGuiInputTextCallbackData  ImGuiTextEditCallbackData; | typedef ImGuiInputTextCallbackData  ImGuiTextEditCallbackData; | ||||||
|   | |||||||
| @@ -2829,11 +2829,11 @@ static void ShowDemoWindowPopups() | |||||||
|             ImGui::EndPopup(); |             ImGui::EndPopup(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         // We can also use OpenPopupOnItemClick() which is the same as BeginPopupContextItem() but without the |         // We can also use OpenPopupContextItem() which is the same as BeginPopupContextItem() but without the | ||||||
|         // Begin() call. So here we will make it that clicking on the text field with the right mouse button (1) |         // Begin() call. So here we will make it that clicking on the text field with the right mouse button (1) | ||||||
|         // will toggle the visibility of the popup above. |         // will toggle the visibility of the popup above. | ||||||
|         ImGui::Text("(You can also right-click me to open the same popup as above.)"); |         ImGui::Text("(You can also right-click me to open the same popup as above.)"); | ||||||
|         ImGui::OpenPopupOnItemClick("item context menu", 1); |         ImGui::OpenPopupContextItem("item context menu", 1); | ||||||
|  |  | ||||||
|         // When used after an item that has an ID (e.g.Button), we can skip providing an ID to BeginPopupContextItem(). |         // When used after an item that has an ID (e.g.Button), we can skip providing an ID to BeginPopupContextItem(). | ||||||
|         // BeginPopupContextItem() will use the last item ID as the popup ID. |         // BeginPopupContextItem() will use the last item ID as the popup ID. | ||||||
|   | |||||||
| @@ -4435,7 +4435,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag | |||||||
|                 value_changed |= DragInt(ids[n], &i[n], 1.0f, 0, hdr ? 0 : 255, fmt_table_int[fmt_idx][n]); |                 value_changed |= DragInt(ids[n], &i[n], 1.0f, 0, hdr ? 0 : 255, fmt_table_int[fmt_idx][n]); | ||||||
|             } |             } | ||||||
|             if (!(flags & ImGuiColorEditFlags_NoOptions)) |             if (!(flags & ImGuiColorEditFlags_NoOptions)) | ||||||
|                 OpenPopupOnItemClick("context"); |                 OpenPopupContextItem("context"); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     else if ((flags & ImGuiColorEditFlags_DisplayHex) != 0 && (flags & ImGuiColorEditFlags_NoInputs) == 0) |     else if ((flags & ImGuiColorEditFlags_DisplayHex) != 0 && (flags & ImGuiColorEditFlags_NoInputs) == 0) | ||||||
| @@ -4460,7 +4460,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag | |||||||
|                 sscanf(p, "%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2]); |                 sscanf(p, "%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2]); | ||||||
|         } |         } | ||||||
|         if (!(flags & ImGuiColorEditFlags_NoOptions)) |         if (!(flags & ImGuiColorEditFlags_NoOptions)) | ||||||
|             OpenPopupOnItemClick("context"); |             OpenPopupContextItem("context"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     ImGuiWindow* picker_active_window = NULL; |     ImGuiWindow* picker_active_window = NULL; | ||||||
| @@ -4481,7 +4481,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         if (!(flags & ImGuiColorEditFlags_NoOptions)) |         if (!(flags & ImGuiColorEditFlags_NoOptions)) | ||||||
|             OpenPopupOnItemClick("context"); |             OpenPopupContextItem("context"); | ||||||
|  |  | ||||||
|         if (BeginPopup("picker")) |         if (BeginPopup("picker")) | ||||||
|         { |         { | ||||||
| @@ -4701,7 +4701,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         if (!(flags & ImGuiColorEditFlags_NoOptions)) |         if (!(flags & ImGuiColorEditFlags_NoOptions)) | ||||||
|             OpenPopupOnItemClick("context"); |             OpenPopupContextItem("context"); | ||||||
|     } |     } | ||||||
|     else if (flags & ImGuiColorEditFlags_PickerHueBar) |     else if (flags & ImGuiColorEditFlags_PickerHueBar) | ||||||
|     { |     { | ||||||
| @@ -4714,7 +4714,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl | |||||||
|             value_changed = value_changed_sv = true; |             value_changed = value_changed_sv = true; | ||||||
|         } |         } | ||||||
|         if (!(flags & ImGuiColorEditFlags_NoOptions)) |         if (!(flags & ImGuiColorEditFlags_NoOptions)) | ||||||
|             OpenPopupOnItemClick("context"); |             OpenPopupContextItem("context"); | ||||||
|  |  | ||||||
|         // Hue bar logic |         // Hue bar logic | ||||||
|         SetCursorScreenPos(ImVec2(bar0_pos_x, picker_pos.y)); |         SetCursorScreenPos(ImVec2(bar0_pos_x, picker_pos.y)); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 ocornut
					ocornut