1#ifndef YAZE_APP_GUI_CORE_DRAG_DROP_H_
2#define YAZE_APP_GUI_CORE_DRAG_DROP_H_
8#include "imgui/imgui.h"
66 if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceAllowNullID)) {
69 ImGui::Text(tr(
"Tile #%d"), tile_id);
70 ImGui::EndDragDropSource();
77 if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceAllowNullID)) {
80 ImGui::Text(tr(
"Sprite #%d"), sprite_id);
81 ImGui::EndDragDropSource();
89 if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceAllowNullID)) {
92 ImGui::Text(tr(
"Color [%d:%d:%d]"), group_idx, palette_idx, color_idx);
93 ImGui::EndDragDropSource();
100 int pos_x,
int pos_y, uint8_t size = 0) {
101 if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceAllowNullID)) {
105 ImGui::Text(tr(
"Object 0x%04X"), object_id);
106 ImGui::EndDragDropSource();
113 const char* preview_label) {
114 if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceAllowNullID)) {
116 if (panel_id !=
nullptr) {
120 ImGui::TextUnformatted(preview_label !=
nullptr ? preview_label : panel_id);
121 ImGui::EndDragDropSource();
133 if (ImGui::BeginDragDropTarget()) {
134 if (
const ImGuiPayload* payload =
137 ImGui::EndDragDropTarget();
140 ImGui::EndDragDropTarget();
146 if (ImGui::BeginDragDropTarget()) {
147 if (
const ImGuiPayload* payload =
150 ImGui::EndDragDropTarget();
153 ImGui::EndDragDropTarget();
159 if (ImGui::BeginDragDropTarget()) {
160 if (
const ImGuiPayload* payload =
163 ImGui::EndDragDropTarget();
166 ImGui::EndDragDropTarget();
172 if (ImGui::BeginDragDropTarget()) {
173 if (
const ImGuiPayload* payload =
176 ImGui::EndDragDropTarget();
179 ImGui::EndDragDropTarget();
189 if (
const ImGuiPayload* payload =
constexpr const char * kDragPayloadRoomObject
bool BeginPanelDragSource(const char *panel_id, const char *preview_label)
bool BeginSpriteDragSource(int sprite_id, int room_id)
constexpr const char * kDragPayloadTile16
bool AcceptTileDrop(TileDragPayload *out)
Accept a tile16 drop. Returns true if a payload was accepted.
constexpr const char * kDragPayloadPalette
bool BeginTileDragSource(int tile_id, int map_id)
bool AcceptRoomObjectDrop(RoomObjectDragPayload *out)
constexpr const char * kDragPayloadPanel
bool AcceptSpriteDrop(SpriteDragPayload *out)
bool AcceptPaletteDrop(PaletteDragPayload *out)
bool AcceptPanelDropWithinTarget(PanelDragPayload *out)
bool BeginRoomObjectDragSource(uint16_t object_id, int room_id, int pos_x, int pos_y, uint8_t size=0)
bool BeginPaletteDragSource(int group_idx, int palette_idx, int color_idx)
constexpr const char * kDragPayloadSprite