KerningVpGuiHelper Class Reference

#include <customgui_kerning.h>

Detailed Description

A helper class that does all the drawing and handle management.

Note
Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Alloc/Free

static KerningVpGuiHelperAlloc ()
 
static void Free (KerningVpGuiHelper *&pData)
 

Constructor/Destructor

 KerningVpGuiHelper ()
 
 ~KerningVpGuiHelper ()
 

Init

Bool Init (const maxon::String &s, BaseContainer *generationresults, KerningData *kd, Int32 plane)
 

Draw

DRAWRESULT Draw (BaseObject *op, BaseDraw *bd, BaseDrawHelp *bh)
 

Handle

Int32 DetectHandle (BaseObject *op, BaseDraw *bd, Int32 x, Int32 y, QUALIFIER qualifier)
 
Bool MoveHandle (BaseObject *op, BaseObject *undo, const Vector &mouse_pos, Int32 hit_id, QUALIFIER qualifier, BaseDraw *bd)
 
void GetHandle (BaseObject *op, Int32 i, HandleInfo &info)
 

Miscellaneous

Bool CopyTo (KerningVpGuiHelper *dest)
 
Bool ClickHandle (Bool release, BaseObject *op)
 
void SetZeroSize ()
 

Constructor & Destructor Documentation

◆ KerningVpGuiHelper()

Constructor.

◆ ~KerningVpGuiHelper()

Destructor.

Member Function Documentation

◆ Alloc()

static KerningVpGuiHelper* Alloc ( )
static

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

Returns
The allocated KerningVpGuiHelper object, or nullptr if the allocation failed.

◆ Free()

static void Free ( KerningVpGuiHelper *&  pData)
static

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

Parameters
[in,out]pDataThe KerningVpGuiHelper objects to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ Init()

Bool Init ( const maxon::String s,
BaseContainer generationresults,
KerningData kd,
Int32  plane 
)

Initializes the KerningVpGuiHelper.

Note
Must be called after each successful generation of a text spline, and before calling Draw(), GetHandleCount(), GetHandle(), SetHandle().
Parameters
[in]sThe string that the text spline was generated from.
[in]generationresultsA pointer to the BaseContainer with generation results (get the container with GetContainer(TEXTSPLINE_RESULTS) from the text spline's container).
[in]kdA pointer to the KerningData that was used for text spline generation.
[in]planeIndicates the spline generation plane. Value from PRIM_PLANE can be used.
Returns
true if successful, otherwise false.

◆ Draw()

DRAWRESULT Draw ( BaseObject op,
BaseDraw bd,
BaseDrawHelp bh 
)

Draws the complete Kerning Viewport GUI into the current drawpass.

Note
Drawing is automatically skipped if the KerningData's edit mode is inactive.
Call this from an ObjectData's Draw() function.
Warning
Init() must be called before calling this function.
Parameters
[in]opPass op from an ObjectData::Draw.
[in]bdPass bd from an ObjectData::Draw.
[in]bhPass bh from an ObjectData::Draw.
Returns
The draw result. It is possible to return this in an ObjectData's Draw() function.

◆ DetectHandle()

Int32 DetectHandle ( BaseObject op,
BaseDraw bd,
Int32  x,
Int32  y,
QUALIFIER  qualifier 
)

Manages the Kerning handles.

Note
Call this from an ObjectData's DetectHandle() function.
Warning
Init() must be called before calling this function.
Parameters
[in]opPass op from an ObjectData::DetectHandle.
[in]bdPass bd from an ObjectData::DetectHandle.
[in]xPass x from an ObjectData::DetectHandle.
[in]yPass y from an ObjectData::DetectHandle.
[in]qualifierPass qualifier from an ObjectData::DetectHandle.
Returns
The handle ID. Return this in an ObjectData's DetectHandle() function.

◆ MoveHandle()

Bool MoveHandle ( BaseObject op,
BaseObject undo,
const Vector mouse_pos,
Int32  hit_id,
QUALIFIER  qualifier,
BaseDraw bd 
)

Manages the Kerning handles.

Note
Call this from an ObjectData's MoveHandle() function.
Warning
Init() must be called before calling this function.
Parameters
[in]opPass op from an ObjectData::MoveHandle.
[in]undoPass undo from an ObjectData::MoveHandle.
[in]mouse_posPass mouse_pos from an ObjectData::MoveHandle.
[in]hit_idPass hit_id from an ObjectData::MoveHandle.
[in]qualifierPass qualifier from anObjectData::MoveHandle.
[in]bdPass bd from an ObjectData::MoveHandle.
Returns
true if the handle was moved, otherwise false. Return this in an ObjectData's MoveHandle() function.

◆ GetHandle()

void GetHandle ( BaseObject op,
Int32  i,
HandleInfo info 
)

Manages the Kerning handles.

Note
Call this from an ObjectData's GetHandle() function.
Warning
Init() must be called before calling this function.
Parameters
[in]opPass op from an ObjectData::GetHandle.
[in]iPass i from an ObjectData::GetHandle.
[in]infoPass info from an ObjectData::GetHandle.

◆ CopyTo()

Bool CopyTo ( KerningVpGuiHelper dest)

Copies all data of the class to another KerningVpGuiHelper object.

Parameters
[in]destA pointer to the destination KerningVpGuiHelper object. Must not be nullptr. The caller owns the pointed KerningVpGuiHelper.
Returns
true if successful, otherwise false.

◆ ClickHandle()

Bool ClickHandle ( Bool  release,
BaseObject op 
)

Used internally by HandleKerningMessages() to handle drag-less clicks on handles.

Parameters
[in]releasefalse on MouseDown, true on MouseUp.
[in]opThe BaseObject from which the HandleKerningMessages() call originated. The caller owns the pointed object.
Returns
true if successful, otherwise false.

◆ SetZeroSize()

void SetZeroSize ( )

Sets all sizes but TEXTSPLINE_RESULT_HEIGHT_BASE to zero. Specially useful when scaling down kerning by handlers to zero until text spline is so small that text spline generator returns a null spline.

See also
TEXTSPLINE_RESULT