uvi-script
Musical event scripting with Lua

DnDArea widget. More...

Inheritance diagram for DnDArea:
Widget

Public Member Functions

 DnDArea (string name)
 creates a DnDArea widget on the user interface.
 

Public Attributes

FileFormat::Type acceptedFileFormat
 accepted file format
 
string filepath
 last file path dropped (read-only)
 
string image
 image path for background image
 
string droppingImage
 image path for background image when dropping (drawn on top of image)
 
string backgroundColour
 background colour: colour string that defines the desired colour.
 
string droppingColour
 dropping colour (drawn on top of image/background colour): colour string that defines the desired colour.
 
function fileDropped
 callback invoked when a file is dropped
 
string acceptedText
 prefix of the dragged texts the area accepts; empty (the default) accepts none
 
string droppedText
 last text dropped (read-only)
 
function textDropped
 callback invoked when an accepted text is dropped
 
- Public Attributes inherited from Widget
string name
 widget name, given at construction (read-only)
 
string displayName
 widget display name
 
string displayText
 custom text to display in place of the standard value display, on widgets that show one.
 
string tooltip
 widget tooltip, default is name
 
int x
 x position in pixels
 
int y
 y position in pixels
 
int width
 widget width in pixels
 
int height
 widget height in pixels
 
int w
 alias of width
 
int h
 alias of height
 
table size
 widget size {width, height}
 
table position
 widget position {x,y}
 
table pos
 alias of position
 
table bounds
 widget bounding rect {x,y,width,height}
 
number alpha
 transparency value between 0.0 and 1.0
 
bool enabled
 boolean flag to enable / disable the widget
 
bool visible
 boolean flag to toggle widget visibility
 
bool interceptsMouseClicks
 boolean flag to toggle mouse handling on widget.
 
bool showLabel
 show widgets label if any
 
bool persistent
 flag to tell if the widget values should be serialized when saving.
 
function changed
 callback function used by child widgets to be notified of changes.
 

Detailed Description

DnDArea widget.

creates a DnDArea widget on the user interface. Image properties support Retina @2x variants.

dnd = DnDArea("DnD")
dnd.fileDropped = function(self)
print("fileDropped", self.filepath)
end
string filepath
last file path dropped (read-only)
Definition ui.cpp:1267
function fileDropped
callback invoked when a file is dropped
Definition ui.cpp:1282
FileFormat::Type acceptedFileFormat
accepted file format
Definition ui.cpp:1266
DnDArea(string name)
creates a DnDArea widget on the user interface.
Predefined format file types.
Definition ui.cpp:904

A DnDArea also receives texts dragged from a Button of the same script (dragAndDropText), which is how widgets are dragged onto each other, e.g. to reorder slots. Set acceptedText to the prefix of the texts the area takes. The area only catches the mouse while a file or an accepted text is being dragged, so it can be laid over other widgets without blocking them; give it a transparent backgroundColour for that.

local handle = Button("Handle")
handle.dragAndDropText = "slot:1"
local target = DnDArea("Target")
target.backgroundColour = "00000000" -- see-through until a drag hovers it
target.droppingColour = "40e0a030"
target.acceptedText = "slot:"
target.textDropped = function(self)
print("dropped", self.droppedText) -- "slot:1"
end
stateless transient button.
Definition ui.cpp:1036
DnDArea widget.
Definition ui.cpp:1258
string droppingColour
dropping colour (drawn on top of image/background colour): colour string that defines the desired col...
Definition ui.cpp:1276
string acceptedText
prefix of the dragged texts the area accepts; empty (the default) accepts none
Definition ui.cpp:1284
string backgroundColour
background colour: colour string that defines the desired colour.
Definition ui.cpp:1272
string droppedText
last text dropped (read-only)
Definition ui.cpp:1285
function textDropped
callback invoked when an accepted text is dropped
Definition ui.cpp:1286

See the FX Rack example.

Constructor & Destructor Documentation

◆ DnDArea()

DnDArea::DnDArea ( string name)

creates a DnDArea widget on the user interface.

Parameters
namethe name to give to the widget

Member Data Documentation

◆ backgroundColour

string DnDArea::backgroundColour

background colour: colour string that defines the desired colour.

It can be either a named colour like "blue" or "red" or an hexadecimal string in RGB ("#FF00CC") or ARGB ("#3C00FECD") format

◆ droppingColour

string DnDArea::droppingColour

dropping colour (drawn on top of image/background colour): colour string that defines the desired colour.

It can be either a named colour like "blue" or "red" or an hexadecimal string in RGB ("#FF00CC") or ARGB ("#3C00FECD") format