C++ API Reference
MTimeSliderCustomDrawManager Class Reference

Introduced in 2023.0 More...

#include <MTimeSliderCustomDrawManager.h>

Public Member Functions

 MTimeSliderCustomDrawManager ()
 MTimeSliderCustomDrawManager represents a singleton on which you can register multiple draw context Each context is represented by an integer value. More...
 
 ~MTimeSliderCustomDrawManager ()
 MTimeSliderCustomDrawManager destructor.
 
MCustomDrawID registerCustomDrawOn (const MString &name, int drawLayer)
 Will create a context to draw primitive on the timeline itself. More...
 
MCustomDrawID registerCustomDrawOutside (MDrawLocation loc, const MString &name, const MString &tooltip, int drawPriority, int height=kUseDefaultHeight)
 Will create a context to draw primitive above/below the timeline. More...
 
void deregisterCustomDraw (MCustomDrawID id)
 Will destroy the previously created context along with all its primitives. More...
 
void clearDrawPrimitives (MCustomDrawID id)
 Remove all primitives set on the draw context. More...
 
void setDrawPrimitives (MCustomDrawID id, const MTimeSliderDrawPrimitives &prims)
 Set all the primitives to be displayed on the timeline for this context. More...
 
void setDrawPrimitives (MCustomDrawID id, MTimeSliderDrawPrimitives &&prims)
 Move all the primitives to be displayed on the timeline for this conte. More...
 
void setDrawVisible (MCustomDrawID id, bool vis)
 Change the visibility of the draw context. More...
 
void setDrawLayer (MCustomDrawID id, int drawLayer)
 Set layer for this context to control overlapping context. More...
 
void setDrawHeight (MCustomDrawID id, int height)
 Set layer for this context to control overlapping context. More...
 
void setDrawLocation (MCustomDrawID id, MDrawLocation loc)
 Change draw location for the specified context. More...
 
void setDrawPriority (MCustomDrawID id, int drawPriority)
 Change the order of drawing for all the context above or below Only valid for draw objects that have location of 'above' and 'below'. More...
 
void setTooltip (MCustomDrawID id, const MString &tooltip)
 Change the tooltip for the context. More...
 
void setStartPrimitiveEditFunction (MCustomDrawID id, MSharedPtr< MStartPrimitiveEditingFct > fct)
 Set the callback to be called to start editing primitive. More...
 
void setEditPrimitiveFunction (MCustomDrawID id, MSharedPtr< MEditPrimitiveFct > fct)
 Set the callback to be called while editing primitive. More...
 
void setStopPrimitiveEditFunction (MCustomDrawID id, MSharedPtr< MStopPrimitiveEditingFct > fct)
 Set the callback to be called to stop editing primitive. More...
 
void setBackgroundColor (MCustomDrawID id, MColor color)
 Change the background color reserved for the specified context. More...
 
void requestTimeSliderRedraw () const
 Force redraw of all primitives in all contexts. More...
 
bool empty () const
 Returns true if no primitives are set on any context. More...
 

Static Public Member Functions

static MTimeSliderCustomDrawManagerinstance ()
 Get the instance of the draw manager.
 

Detailed Description

Introduced in 2023.0

2023.0:
Introduced in this version.

Constructor & Destructor Documentation

MTimeSliderCustomDrawManager represents a singleton on which you can register multiple draw context Each context is represented by an integer value.

Use the draw context and provide primitives to draw custom drawings on the time line. All the instance of MTimeSliderCustomDrawManager use the same service. no need to keep a copy of this object.

Member Function Documentation

MTimeSliderCustomDrawManager::MCustomDrawID registerCustomDrawOn ( const MString name,
int  drawLayer 
)

Will create a context to draw primitive on the timeline itself.

The Location of the primitives will be specified by kOn.

Parameters
nameName of the context.
drawLayerWhen drawing on the timeline, multiple context can draw on the same time range, layer set the priority.
Returns
Context that must be pass to all functions that modifies this context.
MTimeSliderCustomDrawManager::MCustomDrawID registerCustomDrawOutside ( MDrawLocation  loc,
const MString name,
const MString tooltip,
int  drawPriority,
int  height = kUseDefaultHeight 
)

Will create a context to draw primitive above/below the timeline.

Parameters
locationkAbove or kBelow. For kOn use registerCustomDrawOn.
nameName of the context.
tooltipTo be shown when hovering mouse over the reserved space.
drawPriorityDetermine the order above/below the timeline.
heightHeight of the reserved space.
Returns
Context that must be pass to all function that modify this context.
void deregisterCustomDraw ( MCustomDrawID  id)

Will destroy the previously created context along with all its primitives.

Parameters
idContext to be unregistered.
void clearDrawPrimitives ( MCustomDrawID  id)

Remove all primitives set on the draw context.

Parameters
idThe context returned by one of the register functions.
void setDrawPrimitives ( MCustomDrawID  id,
const MTimeSliderDrawPrimitives prims 
)

Set all the primitives to be displayed on the timeline for this context.

Parameters
idThe context returned by one of the register functions.
primsArrays of primitives to be set.
void setDrawPrimitives ( MCustomDrawID  id,
MTimeSliderDrawPrimitives &&  prims 
)

Move all the primitives to be displayed on the timeline for this conte.

Parameters
idThe context returned by one of the register functions.
primsArray of primitives to be moved.
void setDrawVisible ( MCustomDrawID  id,
bool  vis 
)

Change the visibility of the draw context.

Parameters
idThe context returned by one of the register functions.
visThe visibility of the context: true/false for visible/invisible.
void setDrawLayer ( MCustomDrawID  id,
int  drawLayer 
)

Set layer for this context to control overlapping context.

Parameters
idThe context returned by one of the register functions.
drawLayerThe highest number will be on top.
void setDrawHeight ( MCustomDrawID  id,
int  height 
)

Set layer for this context to control overlapping context.

Parameters
idThe context returned by one of the register functions.
heightHeight of the drawing zone for this context.
void setDrawLocation ( MCustomDrawID  id,
MDrawLocation  loc 
)

Change draw location for the specified context.

Parameters
idThe context returned by one of the register functions.
locLocation to draw for the specified context.
void setDrawPriority ( MCustomDrawID  id,
int  drawPriority 
)

Change the order of drawing for all the context above or below Only valid for draw objects that have location of 'above' and 'below'.

Parameters
idThe context returned by one of the register functions.
drawPriorityThe drawPriority determine what is the order context of above or below will be drawn.
void setTooltip ( MCustomDrawID  id,
const MString tooltip 
)

Change the tooltip for the context.

The tooltip will be shown when hovering the mouse over the context reserved space.

Parameters
idThe context returned by one of the register functions.
tooltipThe tooltip to be shown on mouse hover.
void setStartPrimitiveEditFunction ( MCustomDrawID  id,
MSharedPtr< MStartPrimitiveEditingFct fct 
)

Set the callback to be called to start editing primitive.

Parameters
idThe context returned by one of the register functions.
fctThe callback to be triggered.
void setEditPrimitiveFunction ( MCustomDrawID  id,
MSharedPtr< MEditPrimitiveFct fct 
)

Set the callback to be called while editing primitive.

Parameters
idThe context returned by one of the register functions.
fctThe callback to be triggered.
void setStopPrimitiveEditFunction ( MCustomDrawID  id,
MSharedPtr< MStopPrimitiveEditingFct fct 
)

Set the callback to be called to stop editing primitive.

Parameters
idThe context returned by one of the register functions.
fctThe callback to be triggered.
void setBackgroundColor ( MCustomDrawID  id,
MColor  color 
)

Change the background color reserved for the specified context.

Parameters
idThe context returned by one of the register functions.
colorThe color to be set as background.
void requestTimeSliderRedraw ( ) const

Force redraw of all primitives in all contexts.

After all the modifications are done, request a draw to update the timeline.

bool empty ( ) const

Returns true if no primitives are set on any context.

Returns
true if no primitives are set on any context.

The documentation for this class was generated from the following files: