use crate::sys;
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[repr(i32)]
#[allow(clippy::unnecessary_cast)]
pub enum DragDropPayloadCond {
Always = sys::ImGuiCond_Always as i32,
Once = sys::ImGuiCond_Once as i32,
}
bitflags::bitflags! {
#[repr(transparent)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct DragDropSourceFlags: u32 {
const NONE = 0;
const NO_PREVIEW_TOOLTIP = sys::ImGuiDragDropFlags_SourceNoPreviewTooltip as u32;
const NO_DISABLE_HOVER = sys::ImGuiDragDropFlags_SourceNoDisableHover as u32;
const NO_HOLD_TO_OPEN_OTHERS = sys::ImGuiDragDropFlags_SourceNoHoldToOpenOthers as u32;
const ALLOW_NULL_ID = sys::ImGuiDragDropFlags_SourceAllowNullID as u32;
const EXTERN = sys::ImGuiDragDropFlags_SourceExtern as u32;
const PAYLOAD_AUTO_EXPIRE = sys::ImGuiDragDropFlags_PayloadAutoExpire as u32;
const PAYLOAD_NO_CROSS_CONTEXT = sys::ImGuiDragDropFlags_PayloadNoCrossContext as u32;
const PAYLOAD_NO_CROSS_PROCESS = sys::ImGuiDragDropFlags_PayloadNoCrossProcess as u32;
}
}
impl Default for DragDropSourceFlags {
fn default() -> Self {
Self::NONE
}
}
bitflags::bitflags! {
#[repr(transparent)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct DragDropTargetFlags: u32 {
const NONE = 0;
const BEFORE_DELIVERY = sys::ImGuiDragDropFlags_AcceptBeforeDelivery as u32;
const NO_DRAW_DEFAULT_RECT = sys::ImGuiDragDropFlags_AcceptNoDrawDefaultRect as u32;
const NO_PREVIEW_TOOLTIP = sys::ImGuiDragDropFlags_AcceptNoPreviewTooltip as u32;
const DRAW_AS_HOVERED = sys::ImGuiDragDropFlags_AcceptDrawAsHovered as u32;
const PEEK_ONLY = sys::ImGuiDragDropFlags_AcceptPeekOnly as u32;
}
}
impl Default for DragDropTargetFlags {
fn default() -> Self {
Self::NONE
}
}
pub(super) fn validate_drag_drop_source_flags(caller: &str, flags: DragDropSourceFlags) {
let unsupported = flags.bits() & !DragDropSourceFlags::all().bits();
assert!(
unsupported == 0,
"{caller} received unsupported ImGuiDragDropFlags source bits: 0x{unsupported:X}"
);
}
pub(super) fn validate_drag_drop_target_flags(caller: &str, flags: DragDropTargetFlags) {
let unsupported = flags.bits() & !DragDropTargetFlags::all().bits();
assert!(
unsupported == 0,
"{caller} received unsupported ImGuiDragDropFlags target bits: 0x{unsupported:X}"
);
}