// This is how we end up with child menus appearing (most-commonly) on the right of the parent menu.
IM_ASSERT(window_pos_set_by_api);
floathorizontal_overlap=style.ItemSpacing.x;// We want some overlap to convey the relative depth of each popup (currently the amount of overlap it is hard-coded to style.ItemSpacing.x, may need to introduce another style value).
if(CalcTypematicPressedRepeatAmount(g.HoveredIdTimer+0.0001f,g.HoveredIdTimer+0.0001f-g.IO.DeltaTime,0.01f,0.70f))// FIXME: Our formula for CalcTypematicPressedRepeatAmount() is fishy
// When this returns true you need to: a) call SetDragDropPayload() exactly once, b) you may render the payload visual/description, c) call EndDragDropSource()
// We don't use BeginDragDropTargetCustom() and duplicate its code because:
// 1) we use LastItemRectHoveredRect which handles items that pushes a temporarily clip rectangle in their code. Calling BeginDragDropTargetCustom(LastItemRect) would not handle them.
// 2) and it's faster. as this code may be very frequently called, we want to early out as fast as we can.
// Also note how the HoveredWindow test is positioned differently in both functions (in both functions we optimize for the cheapest early out case)
@ -65,6 +65,7 @@ struct ImGuiTextBuffer; // Text buffer for logging/accumulating text
structImGuiTextEditCallbackData;// Shared state of ImGui::InputText() when using custom ImGuiTextEditCallback (rare/advanced use)
structImGuiSizeConstraintCallbackData;// Structure used to constraint window size in custom ways when using custom ImGuiSizeConstraintCallback (rare/advanced use)
structImGuiListClipper;// Helper to manually clip large list of items
structImGuiPayload;// User data payload for drag and drop operations
structImGuiContext;// ImGui context (opaque)
// Typedefs and Enumerations (declared as int for compatibility and to not pollute the top of this file)
@ -80,6 +81,7 @@ typedef int ImGuiMouseCursor; // enum: a mouse cursor identifier
typedefintImGuiStyleVar;// enum: a variable identifier for styling // enum ImGuiStyleVar_
typedefintImDrawCornerFlags;// flags: for ImDrawList::AddRect*() etc. // enum ImDrawCornerFlags_
typedefintImGuiColorEditFlags;// flags: for ColorEdit*(), ColorPicker*() // enum ImGuiColorEditFlags_
typedefintImGuiDragDropFlags;// flags: for *DragDrop*() // enum ImGuiDragDropFlags_
typedefintImGuiColumnsFlags;// flags: for *Columns*() // enum ImGuiColumnsFlags_
typedefintImGuiComboFlags;// flags: for BeginCombo() // enum ImGuiComboFlags_
typedefintImGuiFocusedFlags;// flags: for IsWindowFocused() // enum ImGuiFocusedFlags_
@ -421,6 +423,15 @@ namespace ImGui
IMGUI_APIvoidLogButtons();// helper to display buttons for logging to tty/file/clipboard
IMGUI_APIvoidLogText(constchar*fmt,...)IM_FMTARGS(1);// pass text data straight to log (without being displayed)
// Drag and Drop
// [BETA API] Missing Demo code. API may evolve.
IMGUI_APIboolBeginDragDropSource(ImGuiDragDropFlagsflags=0,intmouse_button=0);// Call when the current item is active. If this return true, you can call SetDragDropPayload() + EndDragDropSource()
IMGUI_APIboolSetDragDropPayload(constchar*type,constvoid*data,size_tdata_size,ImGuiCondcond=0);// Type is a user defined string of maximum 8 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui.
IMGUI_APIvoidEndDragDropSource();
IMGUI_APIboolBeginDragDropTarget();// Call after submitting an item that may receive an item. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget()
IMGUI_APIconstImGuiPayload*AcceptDragDropPayload(constchar*type,ImGuiDragDropFlagsflags=0);// Accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released.
// Flags for ImGui::BeginDragDropSource(), ImGui::AcceptDragDropPayload()
enumImGuiDragDropFlags_
{
// BeginDragDropSource() flags
ImGuiDragDropFlags_SourceNoAutoTooltip=1<<0,// By default, a successful call to BeginDragDropSource opens a tooltip so you can display a preview or description of the dragged contents. This flag disable this behavior.
ImGuiDragDropFlags_SourceNoDisableHover=1<<1,// By default, when dragging we clear data so that IsItemHovered() will return true, to avoid subsequent user code submitting tooltips. This flag disable this behavior so you can still call IsItemHovered() on the source item.
ImGuiDragDropFlags_SourceNoHoldToOpenOthers=1<<2,// Disable the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item.
ImGuiDragDropFlags_SourceAllowNullID=1<<3,// Allow items such as Text(), Image() that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear imgui ecosystem and so we made it explicit.
// AcceptDragDropPayload() flags
ImGuiDragDropFlags_AcceptBeforeDelivery=1<<10,// AcceptDragDropPayload() will returns true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered.
ImGuiDragDropFlags_AcceptNoDrawDefaultRect=1<<11,// Do not draw the default highlight rectangle when hovering over target.
ImGuiDragDropFlags_AcceptPeekOnly=ImGuiDragDropFlags_AcceptBeforeDelivery|ImGuiDragDropFlags_AcceptNoDrawDefaultRect// For peeking ahead and inspecting the payload before delivery.
};
// Standard Drag and Drop payload types. Types starting with '_' are defined by Dear ImGui.
#define IMGUI_PAYLOAD_TYPE_COLOR_3F "_COL3F" // float[3] // Standard type for colors, without alpha. User code may use this type.
#define IMGUI_PAYLOAD_TYPE_COLOR_4F "_COL4F" // float[4] // Standard type for colors. User code may use this type.
// User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array
enumImGuiKey_
{
@ -726,6 +755,7 @@ enum ImGuiCol_
ImGuiCol_PlotHistogramHovered,
ImGuiCol_TextSelectedBg,
ImGuiCol_ModalWindowDarkening,// darken entire screen when a modal window is active
ImGuiCol_DragDropTarget,
ImGuiCol_NavHighlight,// gamepad/keyboard: current highlighted item
ImGuiCol_NavWindowingHighlight,// gamepad/keyboard: when holding NavMenu to focus/move/resize windows
ImGuiButtonFlags_AlignTextBaseLine=1<<9,// vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine
ImGuiButtonFlags_NoKeyModifiers=1<<10,// disable interaction if a key modifier is held
ImGuiButtonFlags_NoHoldingActiveID=1<<11,// don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only)
ImGuiButtonFlags_NoNavFocus=1<<12// don't override navigation focus when activated
ImGuiButtonFlags_PressedOnDragDropHold=1<<12,// press when held into while we are drag and dropping another item (used by e.g. tree nodes, collapsing headers)
ImGuiButtonFlags_NoNavFocus=1<<13// don't override navigation focus when activated
IMGUI_APIvoidVerticalSeparator();// Vertical separator, for menu bars (use current line height). not exposed because it is misleading what it doesn't have an effect on regular layout.
IMGUI_APIvoidBeginColumns(constchar*id,intcount,ImGuiColumnsFlagsflags=0);// setup number of columns. use an identifier to distinguish multiple column sets. close with EndColumns().