mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-01 02:37:24 +01:00
Drag and Drop: Increased payload type string to 12 characters instead of 8.(#143)
This commit is contained in:
parent
932d3f0198
commit
63d47e8328
@ -11397,7 +11397,7 @@ bool ImGui::SetDragDropPayload(const char* type, const void* data, size_t data_s
|
|||||||
cond = ImGuiCond_Always;
|
cond = ImGuiCond_Always;
|
||||||
|
|
||||||
IM_ASSERT(type != NULL);
|
IM_ASSERT(type != NULL);
|
||||||
IM_ASSERT(strlen(type) < IM_ARRAYSIZE(payload.DataType)); // Payload type can be at most 8 characters longs
|
IM_ASSERT(strlen(type) < IM_ARRAYSIZE(payload.DataType) && "Payload type can be at most 12 characters long");
|
||||||
IM_ASSERT((data != NULL && data_size > 0) || (data == NULL && data_size == 0));
|
IM_ASSERT((data != NULL && data_size > 0) || (data == NULL && data_size == 0));
|
||||||
IM_ASSERT(cond == ImGuiCond_Always || cond == ImGuiCond_Once);
|
IM_ASSERT(cond == ImGuiCond_Always || cond == ImGuiCond_Once);
|
||||||
IM_ASSERT(payload.SourceId != 0); // Not called between BeginDragDropSource() and EndDragDropSource()
|
IM_ASSERT(payload.SourceId != 0); // Not called between BeginDragDropSource() and EndDragDropSource()
|
||||||
|
4
imgui.h
4
imgui.h
@ -429,7 +429,7 @@ namespace ImGui
|
|||||||
// Drag and Drop
|
// Drag and Drop
|
||||||
// [BETA API] Missing Demo code. API may evolve.
|
// [BETA API] Missing Demo code. API may evolve.
|
||||||
IMGUI_API bool BeginDragDropSource(ImGuiDragDropFlags flags = 0, int mouse_button = 0); // call when the current item is active. If this return true, you can call SetDragDropPayload() + EndDragDropSource()
|
IMGUI_API bool BeginDragDropSource(ImGuiDragDropFlags flags = 0, int mouse_button = 0); // call when the current item is active. If this return true, you can call SetDragDropPayload() + EndDragDropSource()
|
||||||
IMGUI_API bool SetDragDropPayload(const char* type, const void* data, size_t size, ImGuiCond cond = 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_API bool SetDragDropPayload(const char* type, const void* data, size_t size, ImGuiCond cond = 0);// type is a user defined string of maximum 12 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui.
|
||||||
IMGUI_API void EndDragDropSource(); // only call EndDragDropSource() if BeginDragDropSource() returns true!
|
IMGUI_API void EndDragDropSource(); // only call EndDragDropSource() if BeginDragDropSource() returns true!
|
||||||
IMGUI_API bool BeginDragDropTarget(); // call after submitting an item that may receive an item. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget()
|
IMGUI_API bool BeginDragDropTarget(); // call after submitting an item that may receive an item. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget()
|
||||||
IMGUI_API const ImGuiPayload* AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags = 0); // accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released.
|
IMGUI_API const ImGuiPayload* AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags = 0); // accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released.
|
||||||
@ -1239,7 +1239,7 @@ struct ImGuiPayload
|
|||||||
ImGuiID SourceId; // Source item id
|
ImGuiID SourceId; // Source item id
|
||||||
ImGuiID SourceParentId; // Source parent id (if available)
|
ImGuiID SourceParentId; // Source parent id (if available)
|
||||||
int DataFrameCount; // Data timestamp
|
int DataFrameCount; // Data timestamp
|
||||||
char DataType[8 + 1]; // Data type tag (short user-supplied string)
|
char DataType[12 + 1]; // Data type tag (short user-supplied string, 12 characters max)
|
||||||
bool Preview; // Set when AcceptDragDropPayload() was called and mouse has been hovering the target item (nb: handle overlapping drag targets)
|
bool Preview; // Set when AcceptDragDropPayload() was called and mouse has been hovering the target item (nb: handle overlapping drag targets)
|
||||||
bool Delivery; // Set when AcceptDragDropPayload() was called and mouse button is released over the target item.
|
bool Delivery; // Set when AcceptDragDropPayload() was called and mouse button is released over the target item.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user