Blender V4.3
wmDropBox Struct Reference

#include <WM_types.hh>

Public Attributes

wmDropBoxnext
 
wmDropBoxprev
 
bool(* poll )(bContext *C, wmDrag *drag, const wmEvent *event)
 
void(* on_drag_start )(bContext *C, wmDrag *drag)
 
void(* on_enter )(wmDropBox *drop, wmDrag *drag)
 
void(* on_exit )(wmDropBox *drop, wmDrag *drag)
 
void(* copy )(bContext *C, wmDrag *drag, wmDropBox *drop)
 
void(* cancel )(Main *bmain, wmDrag *drag, wmDropBox *drop)
 
void(* draw_droptip )(bContext *C, wmWindow *win, wmDrag *drag, const int xy[2])
 
void(* draw_in_view )(bContext *C, wmWindow *win, wmDrag *drag, const int xy[2])
 
void * draw_data
 
WMDropboxTooltipFunc tooltip
 
wmOperatorTypeot
 
char opname [64]
 
IDPropertyproperties
 
PointerRNAptr
 

Detailed Description

Drop-boxes are like key-maps, part of the screen/area/region definition. Allocation and free is on startup and exit.

The operator is polled and invoked with the current context (WM_OP_INVOKE_DEFAULT), there is no way to override that (by design, since drop-boxes should act on the exact mouse position). So the drop-boxes are supposed to check the required area and region context in their poll.

Definition at line 1307 of file WM_types.hh.

Member Data Documentation

◆ cancel

void(* wmDropBox::cancel) (Main *bmain, wmDrag *drag, wmDropBox *drop)

If the operator is canceled (returns OPERATOR_CANCELLED), this can be used for cleanup of copy() resources.

Definition at line 1332 of file WM_types.hh.

Referenced by WM_dropbox_add().

◆ copy

void(* wmDropBox::copy) (bContext *C, wmDrag *drag, wmDropBox *drop)

Before exec, this copies drag info to #wmDrop properties.

Definition at line 1326 of file WM_types.hh.

Referenced by wm_drop_prepare(), and WM_dropbox_add().

◆ draw_data

◆ draw_droptip

void(* wmDropBox::draw_droptip) (bContext *C, wmWindow *win, wmDrag *drag, const int xy[2])

Override the default cursor overlay drawing function. Can be used to draw text or thumbnails. IE a tooltip for drag and drop.

Parameters
xyCursor location in window coordinates (wmEvent.xy compatible).

Definition at line 1339 of file WM_types.hh.

Referenced by sequencer_dropboxes_add_to_lb(), view3d_dropboxes(), and wm_drags_draw().

◆ draw_in_view

void(* wmDropBox::draw_in_view) (bContext *C, wmWindow *win, wmDrag *drag, const int xy[2])

Called with the draw buffer (GPUViewport) set up for drawing into the region's view.

Note
Only setups the drawing buffer for drawing in view, not the GPU transform matrices. The callback has to do that itself, with for example UI_view2d_view_ortho.
Parameters
xyCursor location in window coordinates (wmEvent.xy compatible).

Definition at line 1347 of file WM_types.hh.

Referenced by sequencer_dropboxes_add_to_lb(), and wm_drags_draw().

◆ next

wmDropBox* wmDropBox::next

Definition at line 1308 of file WM_types.hh.

◆ on_drag_start

void(* wmDropBox::on_drag_start) (bContext *C, wmDrag *drag)

Called when the drag action starts. Can be used to prefetch data for previews.

Note
The dropbox that will be called eventually is not known yet when starting the drag. So this callback is called on every dropbox that is registered in the current screen.

Definition at line 1316 of file WM_types.hh.

Referenced by sequencer_dropboxes_add_to_lb(), and wm_dropbox_invoke().

◆ on_enter

void(* wmDropBox::on_enter) (wmDropBox *drop, wmDrag *drag)

Called when poll returns true the first time. Typically used to setup some drawing data.

Definition at line 1319 of file WM_types.hh.

Referenced by sequencer_dropboxes_add_to_lb(), view3d_dropboxes(), and wm_drop_update_active().

◆ on_exit

void(* wmDropBox::on_exit) (wmDropBox *drop, wmDrag *drag)

Called when poll returns false the first time or when the drag event ends (successful drop or canceled). Typically used to cleanup resources or end drawing.

Definition at line 1323 of file WM_types.hh.

Referenced by sequencer_dropboxes_add_to_lb(), view3d_dropboxes(), WM_drag_free(), and wm_drop_update_active().

◆ opname

char wmDropBox::opname[64]

wmOperatorType::idname, needed for re-registration.

Definition at line 1363 of file WM_types.hh.

Referenced by WM_dropbox_add(), and wm_dropbox_item_update_ot().

◆ ot

wmOperatorType* wmDropBox::ot

If poll succeeds, operator is called. Not saved in file, so can be pointer. This may be null when the operator has been unregistered, where opname can be used to re-initialize it.

Definition at line 1361 of file WM_types.hh.

Referenced by dropbox_active(), dropbox_tooltip(), wm_drop_prepare(), WM_dropbox_add(), and wm_dropbox_item_update_ot().

◆ poll

bool(* wmDropBox::poll) (bContext *C, wmDrag *drag, const wmEvent *event)

Test if the dropbox is active.

Definition at line 1311 of file WM_types.hh.

Referenced by dropbox_active(), and WM_dropbox_add().

◆ prev

wmDropBox * wmDropBox::prev

Definition at line 1308 of file WM_types.hh.

◆ properties

IDProperty* wmDropBox::properties

Operator properties, assigned to ptr->data and can be written to a file.

Definition at line 1366 of file WM_types.hh.

Referenced by wm_drop_item_clear_runtime(), wm_drop_item_free_data(), WM_dropbox_add(), and wm_dropbox_item_update_ot().

◆ ptr

◆ tooltip

WMDropboxTooltipFunc wmDropBox::tooltip

Custom tooltip shown during dragging.

Definition at line 1353 of file WM_types.hh.

Referenced by dropbox_tooltip(), and WM_dropbox_add().


The documentation for this struct was generated from the following file: