LassoSelection Class Reference

#include <c4d_general.h>

Detailed Description

Used to select any GUI element with a lasso.

Private Member Functions

 LassoSelection ()
 
 ~LassoSelection ()
 

Alloc/Free

static LassoSelectionAlloc ()
 
static void Free (LassoSelection *&ls)
 

Start

Bool Start (GeDialog &dlg, Int32 mode, Int32 start_x=-1, Int32 start_y=-1, Int32 start_button=-1, Int32 sx1=-1, Int32 sy1=-1, Int32 sx2=-1, Int32 sy2=-1)
 
Bool Start (GeUserArea &ua, Int32 mode, Int32 start_x=-1, Int32 start_y=-1, Int32 start_button=-1, Int32 sx1=-1, Int32 sy1=-1, Int32 sx2=-1, Int32 sy2=-1)
 
Bool Start (EditorWindow *win, Int32 mode, Int32 start_x=-1, Int32 start_y=-1, Int32 start_button=-1, Int32 sx1=-1, Int32 sy1=-1, Int32 sx2=-1, Int32 sy2=-1)
 

Check/Test

Bool CheckSingleClick ()
 
Bool Test (Int32 x, Int32 y)
 
Bool TestPolygon (const Vector &pa, const Vector &pb, const Vector &pc, const Vector &pd)
 

Miscellaneous

Int32 GetMode ()
 
Bool GetRectangle (Float &x1, Float &y1, Float &x2, Float &y2)
 

Constructor & Destructor Documentation

◆ LassoSelection()

LassoSelection ( )
private

◆ ~LassoSelection()

~LassoSelection ( )
private

Member Function Documentation

◆ Alloc()

static LassoSelection* Alloc ( )
static

Allocates a lasso selection. Destroy the allocated lasso selection with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Returns
The allocated lasso selection, or nullptr if the allocation failed.

◆ Free()

static void Free ( LassoSelection *&  ls)
static

Destructs lasso selections allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in,out]lsThe lasso selection to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ Start() [1/3]

Bool Start ( GeDialog dlg,
Int32  mode,
Int32  start_x = -1,
Int32  start_y = -1,
Int32  start_button = -1,
Int32  sx1 = -1,
Int32  sy1 = -1,
Int32  sx2 = -1,
Int32  sy2 = -1 
)

Starts the lasso selection in a dialog.
If start_x, start_y and start_button are not passed then the call waits for the user to click. It is only needed to pass them if the mouse has already been hit.
Optionally specify a visual clipping boundary rectangle from (sx1,sy1) to (sx2,sy2).

Parameters
[in]dlgThe dialog to draw the lasso in. The caller owns the pointed dialog.
[in]modeThe lasso mode: MOUSESELECT
[in]start_xThe start X position, or NOTOK to wait for mouse down.
[in]start_yThe start Y position, or NOTOK to wait for mouse down.
[in]start_buttonThe start button, or NOTOK to wait for mouse down: BFM_INPUT_CHANNEL
[in]sx1The optional left X coordinate of the clipping boundary.
[in]sy1The optional top Y coordinate of the clipping boundary.
[in]sx2The optional right X coordinate of the clipping boundary.
[in]sy2The optional bottom Y coordinate of the clipping boundary.
Returns
true if the user selected elements in the dialog with the lasso, otherwise false.

◆ Start() [2/3]

Bool Start ( GeUserArea ua,
Int32  mode,
Int32  start_x = -1,
Int32  start_y = -1,
Int32  start_button = -1,
Int32  sx1 = -1,
Int32  sy1 = -1,
Int32  sx2 = -1,
Int32  sy2 = -1 
)

Starts the lasso selection in a user area.
If start_x, start_y and start_button are not passed then the call waits for the user to click. It is only needed to pass them if the mouse has already been hit.
Optionally specify a visual clipping boundary rectangle from (sx1,sy1) to (sx2,sy2).

Parameters
[in]uaThe user area to draw the lasso in. The caller owns the pointed user area.
[in]modeThe lasso mode: MOUSESELECT
[in]start_xThe start X position, or NOTOK to wait for mouse down.
[in]start_yThe start Y position, or NOTOK to wait for mouse down.
[in]start_buttonThe start button, or NOTOK to wait for mouse down: BFM_INPUT_CHANNEL
[in]sx1The optional left X coordinate of the clipping boundary.
[in]sy1The optional top Y coordinate of the clipping boundary.
[in]sx2The optional right X coordinate of the clipping boundary.
[in]sy2The optional bottom Y coordinate of the clipping boundary.
Returns
true if the user selected elements in the user area with the lasso, otherwise false.

◆ Start() [3/3]

Bool Start ( EditorWindow win,
Int32  mode,
Int32  start_x = -1,
Int32  start_y = -1,
Int32  start_button = -1,
Int32  sx1 = -1,
Int32  sy1 = -1,
Int32  sx2 = -1,
Int32  sy2 = -1 
)

Starts the lasso selection in an editor window.
If start_x, start_y and start_button are not passed then the call waits for the user to click. It is only needed to pass them if the mouse has already been hit.
Optionally specify a visual clipping boundary rectangle from (sx1,sy1) to (sx2,sy2).

Parameters
[in]winThe editor window to draw the lasso in. The caller owns the pointed editor window.
[in]modeThe lasso mode: MOUSESELECT
[in]start_xThe start X position, or NOTOK to wait for mouse down.
[in]start_yThe start Y position, or NOTOK to wait for mouse down.
[in]start_buttonThe start button, or NOTOK to wait for mouse down: BFM_INPUT_CHANNEL
[in]sx1The optional left X coordinate of the clipping boundary.
[in]sy1The optional top Y coordinate of the clipping boundary.
[in]sx2The optional right X coordinate of the clipping boundary.
[in]sy2The optional bottom Y coordinate of the clipping boundary.
Returns
true if the user selected elements in the editor window with the lasso, otherwise false.

◆ CheckSingleClick()

Bool CheckSingleClick ( )

Checks if the user did not move the mouse.

Returns
true if the user single clicked, otherwise false.

◆ Test()

Bool Test ( Int32  x,
Int32  y 
)

Tests if the point (x,y) is inside the lasso selection.

Parameters
[in]xThe X coordinate.
[in]yThe Y coordinate.
Returns
true if the point is within the lasso, otherwise false.

◆ TestPolygon()

Bool TestPolygon ( const Vector pa,
const Vector pb,
const Vector pc,
const Vector pd 
)

Tests if the 2D polygon a-b-c-d is inside the selection. The point c can be equal to d in case of a triangle.

Note
Checks if the 2D polygon is fully or partially within the lasso selection.
Parameters
[in]paThe first point.
[in]pbThe second point.
[in]pcThe third point.
[in]pdThe fourth point, or equal to pc for triangles.
Returns
true if the polygon is within the lasso, otherwise false.

◆ GetMode()

Int32 GetMode ( )

Gets the mode passed to Start().

Returns
The lasso mode: MOUSESELECT

◆ GetRectangle()

Bool GetRectangle ( Float x1,
Float y1,
Float x2,
Float y2 
)

Gets the selection rectangle.

Parameters
[out]x1Assigned the X coordinate of the top-left rectangle corner.
[out]y1Assigned the Y coordinate of the top-left rectangle corner.
[out]x2Assigned the X coordinate of the bottom-right rectangle corner.
[out]y2Assigned the Y coordinate of the bottom-right rectangle corner.
Returns
true if the selection rectangle was retrieved, otherwise false.