Data associated with a drag event
typedef struct Ph_ev_drag_data {
PhRect_t rect;
PhRid_t rid;
PhRect_t boundary;
PhDim_t min;
PhDim_t max;
PhDim_t step;
unsigned long key_mods;
long zero[2];
ushort_t flags;
} PhDragEvent_t;
The PhDragEvent_t structure defines the data associated with
Ph_EV_DRAG
events (see
PhEvent_t).
It contains at least the following members:
- rect
- A
PhRect_t
structure that contains
the coordinates of the initial, current, or final drag rectangle,
depending on the drag-event subtype value.
- rid
- The ID of the region that initiated the drag operation.
Your application needs to specify the region ID when it calls
PhInitDrag()
to initiate the dragging
operation.
- boundary
- A
PhRect_t
structure that contains
the coordinates of the rectangle that constrains the drag operation.
- min, max
- PhDim_t
structures that define the minimum and maximum sizes of the drag rectangle,
as specified in the call to PhInitDrag().
- step
- A
PhDim_t
structure that defines the drag operation's granularity, as
specified in the call to PhInitDrag().
- key_mods
- Your application can use the modifier keys (e.g. Shift or
Num Lock) to change the meaning of a drag event.
When a modifier key is pressed or released, it's evaluated through a table,
and the key_mods field is updated accordingly.
This evaluation is done before the drag event is sent.
The key_mods member is a combination of the following bits:
- Pk_KM_Shift
- Pk_KM_Ctrl
- Pk_KM_Alt
- Pk_KM_AltGr
- Pk_KM_Shl3
- Pk_KM_Mod6
- Pk_KM_Mod7
- Pk_KM_Mod8
- Pk_KM_Shift_Lock
- Pk_KM_Ctrl_Lock
- Pk_KM_Alt_Lock
- Pk_KM_AltGr_Lock
- Pk_KM_Shl3_Lock
- Pk_KM_Mod6_Lock
- Pk_KM_Mod7_Lock
- Pk_KM_Mod8_Lock
- Pk_KM_Caps_Lock
- Pk_KM_Num_Lock
- Pk_KM_Scroll_Lock
If the Shift key is pressed, the Shift modifier
is on; if it's released, the Shift modifier is off.
Because some keys occur twice on the keyboard, a key
release doesn't guarantee that the corresponding modifier
is off -- the matching key may still be pressed.
- unsigned short flags
- Flags that indicate which edges of the drag rectangle track the pointer.
You can OR the following values into flags:
- Ph_DRAG_NOBUTTON -- Allow the drag to
start, even if the user isn't holding down a button.
- Ph_DRAG_KEY_MOTION -- During the drag,
emit drag events with the
Ph_EV_DRAG_KEY_EVENT
or the
Ph_EV_DRAG_MOTION_EVENT
subtype (see
PhEvent_t).
- Ph_DRAG_TRACK -- No drag outline is drawn, and
Ph_EV_DRAG_MOVE
events are emitted to the initiating region.
Use this flag if you want to implement your own visual interpretation of
dragging operations.
- Ph_TRACK_LEFT -- left edge tracks the pointer.
- Ph_TRACK_RIGHT -- right edge tracks the pointer.
- Ph_TRACK_TOP -- top edge tracks the pointer.
- Ph_TRACK_BOTTOM -- bottom edge tracks the pointer.
- Ph_TRACK_DRAG -- all edges track the pointer
(the same as using all four of the above values).
Photon
PhDim_t,
PhEvent_t,
PhInitDrag(),
PhPoint_t,
PhRect_t
"Dragging"
in the Events chapter of the Photon Programmer's Guide