C++ API 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 MTimeSliderCustomDrawManager & | instance () |
Get the instance of the draw manager. | |
Introduced in 2023.0
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.
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.
name | Name of the context. |
drawLayer | When drawing on the timeline, multiple context can draw on the same time range, layer set the priority. |
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.
location | kAbove or kBelow. For kOn use registerCustomDrawOn. |
name | Name of the context. |
tooltip | To be shown when hovering mouse over the reserved space. |
drawPriority | Determine the order above/below the timeline. |
height | Height of the reserved space. |
void deregisterCustomDraw | ( | MCustomDrawID | id | ) |
Will destroy the previously created context along with all its primitives.
id | Context to be unregistered. |
void clearDrawPrimitives | ( | MCustomDrawID | id | ) |
Remove all primitives set on the draw context.
id | The 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.
id | The context returned by one of the register functions. |
prims | Arrays of primitives to be set. |
void setDrawPrimitives | ( | MCustomDrawID | id, |
MTimeSliderDrawPrimitives && | prims | ||
) |
Move all the primitives to be displayed on the timeline for this conte.
id | The context returned by one of the register functions. |
prims | Array of primitives to be moved. |
void setDrawVisible | ( | MCustomDrawID | id, |
bool | vis | ||
) |
Change the visibility of the draw context.
id | The context returned by one of the register functions. |
vis | The visibility of the context: true/false for visible/invisible. |
void setDrawLayer | ( | MCustomDrawID | id, |
int | drawLayer | ||
) |
Set layer for this context to control overlapping context.
id | The context returned by one of the register functions. |
drawLayer | The highest number will be on top. |
void setDrawHeight | ( | MCustomDrawID | id, |
int | height | ||
) |
Set layer for this context to control overlapping context.
id | The context returned by one of the register functions. |
height | Height of the drawing zone for this context. |
void setDrawLocation | ( | MCustomDrawID | id, |
MDrawLocation | loc | ||
) |
Change draw location for the specified context.
id | The context returned by one of the register functions. |
loc | Location 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'.
id | The context returned by one of the register functions. |
drawPriority | The 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.
id | The context returned by one of the register functions. |
tooltip | The tooltip to be shown on mouse hover. |
void setStartPrimitiveEditFunction | ( | MCustomDrawID | id, |
MSharedPtr< MStartPrimitiveEditingFct > | fct | ||
) |
Set the callback to be called to start editing primitive.
id | The context returned by one of the register functions. |
fct | The callback to be triggered. |
void setEditPrimitiveFunction | ( | MCustomDrawID | id, |
MSharedPtr< MEditPrimitiveFct > | fct | ||
) |
Set the callback to be called while editing primitive.
id | The context returned by one of the register functions. |
fct | The callback to be triggered. |
void setStopPrimitiveEditFunction | ( | MCustomDrawID | id, |
MSharedPtr< MStopPrimitiveEditingFct > | fct | ||
) |
Set the callback to be called to stop editing primitive.
id | The context returned by one of the register functions. |
fct | The callback to be triggered. |
void setBackgroundColor | ( | MCustomDrawID | id, |
MColor | color | ||
) |
Change the background color reserved for the specified context.
id | The context returned by one of the register functions. |
color | The 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.