dear_imgui_rs/drag_drop/
flags.rs1use crate::sys;
2
3#[derive(Debug, Copy, Clone, PartialEq, Eq)]
7#[repr(i32)]
8#[allow(clippy::unnecessary_cast)]
9pub enum DragDropPayloadCond {
10 Always = sys::ImGuiCond_Always as i32,
12 Once = sys::ImGuiCond_Once as i32,
14}
15
16bitflags::bitflags! {
17 #[repr(transparent)]
19 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
20 pub struct DragDropSourceFlags: u32 {
21 const NONE = 0;
23
24 const NO_PREVIEW_TOOLTIP = sys::ImGuiDragDropFlags_SourceNoPreviewTooltip as u32;
26 const NO_DISABLE_HOVER = sys::ImGuiDragDropFlags_SourceNoDisableHover as u32;
28 const NO_HOLD_TO_OPEN_OTHERS = sys::ImGuiDragDropFlags_SourceNoHoldToOpenOthers as u32;
30 const ALLOW_NULL_ID = sys::ImGuiDragDropFlags_SourceAllowNullID as u32;
32 const EXTERN = sys::ImGuiDragDropFlags_SourceExtern as u32;
34 const PAYLOAD_AUTO_EXPIRE = sys::ImGuiDragDropFlags_PayloadAutoExpire as u32;
36 const PAYLOAD_NO_CROSS_CONTEXT = sys::ImGuiDragDropFlags_PayloadNoCrossContext as u32;
38 const PAYLOAD_NO_CROSS_PROCESS = sys::ImGuiDragDropFlags_PayloadNoCrossProcess as u32;
40 }
41}
42
43impl Default for DragDropSourceFlags {
44 fn default() -> Self {
45 Self::NONE
46 }
47}
48
49bitflags::bitflags! {
50 #[repr(transparent)]
52 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
53 pub struct DragDropTargetFlags: u32 {
54 const NONE = 0;
56 const BEFORE_DELIVERY = sys::ImGuiDragDropFlags_AcceptBeforeDelivery as u32;
58 const NO_DRAW_DEFAULT_RECT = sys::ImGuiDragDropFlags_AcceptNoDrawDefaultRect as u32;
60 const NO_PREVIEW_TOOLTIP = sys::ImGuiDragDropFlags_AcceptNoPreviewTooltip as u32;
62 const DRAW_AS_HOVERED = sys::ImGuiDragDropFlags_AcceptDrawAsHovered as u32;
64 const PEEK_ONLY = sys::ImGuiDragDropFlags_AcceptPeekOnly as u32;
66 }
67}
68
69impl Default for DragDropTargetFlags {
70 fn default() -> Self {
71 Self::NONE
72 }
73}
74
75pub(super) fn validate_drag_drop_source_flags(caller: &str, flags: DragDropSourceFlags) {
76 let unsupported = flags.bits() & !DragDropSourceFlags::all().bits();
77 assert!(
78 unsupported == 0,
79 "{caller} received unsupported ImGuiDragDropFlags source bits: 0x{unsupported:X}"
80 );
81}
82
83pub(super) fn validate_drag_drop_target_flags(caller: &str, flags: DragDropTargetFlags) {
84 let unsupported = flags.bits() & !DragDropTargetFlags::all().bits();
85 assert!(
86 unsupported == 0,
87 "{caller} received unsupported ImGuiDragDropFlags target bits: 0x{unsupported:X}"
88 );
89}