Skip to content

DIWNE::Canvas

Representation of the 2D infinite plane of a node editor. More...

#include "DIWNE/Core/Canvas.h"

Public Functions

Name
Canvas(NodeEditor & editor)
voidAddBezierCurveDiwne(ImDrawList * idl, const ImVec2 & p1, const ImVec2 & p2, const ImVec2 & p3, const ImVec2 & p4, ImVec4 col, float thickness, int num_segments =0) const<br>Draw Bezier (not Bezier really) curve to window ImDrawList.
voidAddLine(const ImVec2 & p1, const ImVec2 & p2, const ImVec4 & col, float thickness =1.0f, bool ignoreZoom =false) const
voidAddRectDiwne(const ImVec2 & p_min, const ImVec2 & p_max, const ImVec4 & col, float rounding =0.0f, ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll, float thickness =1.0f, bool ignoreZoom =false) const<br>Draw rectangle to window ImDrawlist This method accepts DIWNE coordinates and converts them to truncated screen coordinates.
voidAddRectFilledDiwne(const ImVec2 & p_min, const ImVec2 & p_max, const ImVec4 & col, float rounding =0.0f, ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll, bool ignoreZoom =false) const<br>Draw filled rectangle to window ImDrawlist This method accepts DIWNE coordinates and converts them to truncated screen coordinates.
voidAddRectForegroundDiwne(const ImVec2 & p_min, const ImVec2 & p_max, const ImVec4 & col, float rounding =0.0f, ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll, float thickness =1.0f, bool ignoreZoom =false) const
boolapplyZoomScaling()<br>Modifies the current ImGuiStyle and Font depending on the current diwne zoom level.
floatapplyZoomScalingToFont(ImFont * font, float scaleMultiplier)<br>Modifies the current Font depending on the current diwne zoom level.
ImRectdiwne2screen(const ImRect & rect) const<br>Convert diwne rect to a screen rect.
ImVec2diwne2screen(const ImVec2 & point) const
ImVec2diwne2screenSize(const ImVec2 & point) const<br>Apply diwne scaling factors to an ImVec2 size.
floatdiwne2screenSize(float size) const<br>Apply diwne scaling factors to a float size.
floatdiwne2screenSizeTrunc(float size) const
ImRectdiwne2screenTrunc(const ImRect & rect) const<br>Convert diwne rect to pixel aligned screen rect.
ImVec2diwne2screenTrunc(const ImVec2 & point) const<br>Convert diwne point to pixel aligned screen position.
ImVec2diwne2workArea(const ImVec2 & point) const
voidDrawBurgerMenu(ImDrawList * idl, const ImColor & color, const ImRect & rect, const ImVec2 & padding, float thickness) const
voiddrawGrid(bool dots, float size, ImVec4 color, float fadeStart, float fadeEnd, bool ignoreZoom) const
voidDrawIcon(IconType bgIconType, ImColor bgShapeColor, ImColor bgInnerColor, IconType fgIconType, ImColor fgShapeColor, ImColor fgInnerColor, ImVec2 size, ImVec4 padding, bool filled, ImVec2 thickness =ImVec2(1, 1), float rounding =0) const<br>Draw an Icon combined from two parts (foreground and background) to the window ImDrawList filled with a ShapeColor.
voidDrawIconCircle(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const<br>Draw a circle icon.
voidDrawIconCross(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float shapeThickness =2, float innerThickness =1) const
voidDrawIconFastForward(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const
voidDrawIconGrabDownLeft(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const
voidDrawIconGrabDownRight(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const
voidDrawIconHyphen(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =3.0f) const
voidDrawIconPause(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, ImVec2 thickness =ImVec2(1, 1), float rounding =0) const
voidDrawIconRectangle(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, ImVec2 thickness =ImVec2(1, 1), float rounding =0) const
voidDrawIconRewind(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const
voidDrawIconSkipBack(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const
voidDrawIconSkipBack2(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const
voidDrawIconSkipForward(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const
voidDrawIconSkipForward2(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const
voidDrawIconTriangleDownLeft(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const
voidDrawIconTriangleDownRight(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const
voidDrawIconTriangleLeft(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const
voidDrawIconTriangleRight(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const
voidEmptyButton(ImVec2 size, ImColor color, float rounding)<br>Just the shape of the button, no interaction.
boolensureZoomScaling(bool active)<br>Ensure that zoom scaling is active or not based on a passed parameter.
ImRectgetViewportRectDiwne() const
ImRectgetViewportRectScreen() const
floatgetZoom() const
boolIconButton(IconType bgIconType, ImColor bgShapeColor, ImColor bgInnerColor, ImVec2 size, ImVec4 padding, bool filled, std::string id) const<br>Add ImGui Button with icon on it.
boolIconButton(std::string id, bool disabled, IconType bgIconType, ImColor bgShapeColor, ImColor bgInnerColor, IconType fgIconType, ImColor fgShapeColor, ImColor fgInnerColor, ImVec2 size, ImVec4 padding, bool filled, ImVec2 thickness =ImVec2(1, 1), float rounding =0) const<br>Add ImGui Button with icon on it.
boolIconButton2(const std::string & id, ImVec2 size, bool disabled, IconType bgIconType, IconType fgIconType, const IconStyle & style, const IconStyle & hoveredStyle, const IconStyle & activeStyle) const<br>// TODO: (DR) Docs, new IconButton that allows various styles depening on the button state (hover, maybe press) Add ImGui Button with icon on it
voidmoveViewport(const ImVec2 & distance)
voidmoveViewportZoomed(const ImVec2 & distance)
ImRectscreen2diwne(const ImRect & rect) const<br>Convert screen rect to a diwne rect.
ImVec2screen2diwne(const ImVec2 & point) const
ImVec2screen2diwneSize(const ImVec2 & point) const<br>Revert diwne scaling factors from a ImVec2 size.
floatscreen2diwneSize(float size) const<br>Revert diwne scaling factors from a float size.
ImVec2screen2workArea(const ImVec2 & point) const
voidsetViewportRectDiwne(ImRect rect)
virtual voidsetZoom(float val)
boolstopZoomScaling()<br>Restores the current ImGuiStyle and Font back to its state before applyZoomScaling() was last called.
voidstopZoomScalingToFont(ImFont * font, float originalScale)
voidupdateViewportRects()<br>Update screen and diwne positions and sizes of viewport.
ImVec2workArea2diwne(const ImVec2 & point) const
ImVec2workArea2screen(const ImVec2 & point) const

Protected Functions

Name
voidScaleAllSizes(ImGuiStyle & style, float scale_factor)

Public Attributes

Name
floatm_prevZoom <br>Last frame zoom factor.
floatm_unscaledFontSize <br>Original font size.
ImRectm_viewRectDiwne <br>Bounds of the canvas viewport in canvas/editor's coordinates (diwne coordinates).
ImRectm_viewRectScreen <br>Viewport bounds in screen space coordinates.
floatm_zoom <br>Viewport zoom factor (scale ratio between diwne and screen coordinates).
boolm_zoomScalingApplied <br>Whether zoom UI scaling has been applied or not to Dear ImGui.

Protected Attributes

Name
NodeEditor &editor
floatm_zoomOriginalFontScale <br>Original font scale.
ImGuiStylem_zoomOriginalStyle <br>Original ImGui style.

Detailed Description

cpp
class DIWNE::Canvas;
class DIWNE::Canvas;

Representation of the 2D infinite plane of a node editor.

// TODO: Coordinate systems docs (screen space, viewport coordinates, canvas/editor/diwne coordinates

Public Functions Documentation

function Canvas

cpp
Canvas(
    NodeEditor & editor
)
Canvas(
    NodeEditor & editor
)

function AddBezierCurveDiwne

cpp
void AddBezierCurveDiwne(
    ImDrawList * idl,
    const ImVec2 & p1,
    const ImVec2 & p2,
    const ImVec2 & p3,
    const ImVec2 & p4,
    ImVec4 col,
    float thickness,
    int num_segments =0
) const
void AddBezierCurveDiwne(
    ImDrawList * idl,
    const ImVec2 & p1,
    const ImVec2 & p2,
    const ImVec2 & p3,
    const ImVec2 & p4,
    ImVec4 col,
    float thickness,
    int num_segments =0
) const

Draw Bezier (not Bezier really) curve to window ImDrawList.

Parameters:

  • p1 const ImVec2& start point in diwne coords
  • p2 const ImVec2& start control point in diwne coords
  • p3 const ImVec2& end control point in diwne coords
  • p4 const ImVec2& end point in diwne coords
  • col ImVec4
  • thickness float
  • 0 int num_segments with zero ImGui use some optimal? value

Return: void

function AddLine

cpp
void AddLine(
    const ImVec2 & p1,
    const ImVec2 & p2,
    const ImVec4 & col,
    float thickness =1.0f,
    bool ignoreZoom =false
) const
void AddLine(
    const ImVec2 & p1,
    const ImVec2 & p2,
    const ImVec4 & col,
    float thickness =1.0f,
    bool ignoreZoom =false
) const

function AddRectDiwne

cpp
void AddRectDiwne(
    const ImVec2 & p_min,
    const ImVec2 & p_max,
    const ImVec4 & col,
    float rounding =0.0f,
    ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll,
    float thickness =1.0f,
    bool ignoreZoom =false
) const
void AddRectDiwne(
    const ImVec2 & p_min,
    const ImVec2 & p_max,
    const ImVec4 & col,
    float rounding =0.0f,
    ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll,
    float thickness =1.0f,
    bool ignoreZoom =false
) const

Draw rectangle to window ImDrawlist This method accepts DIWNE coordinates and converts them to truncated screen coordinates.

See: AddRectFilledDiwne

function AddRectFilledDiwne

cpp
void AddRectFilledDiwne(
    const ImVec2 & p_min,
    const ImVec2 & p_max,
    const ImVec4 & col,
    float rounding =0.0f,
    ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll,
    bool ignoreZoom =false
) const
void AddRectFilledDiwne(
    const ImVec2 & p_min,
    const ImVec2 & p_max,
    const ImVec4 & col,
    float rounding =0.0f,
    ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll,
    bool ignoreZoom =false
) const

Draw filled rectangle to window ImDrawlist This method accepts DIWNE coordinates and converts them to truncated screen coordinates.

Parameters:

  • p_min bottom left corner in diwne coords
  • p_max top right corner in diwne coords
  • col
  • rounding
  • rounding_corners

function AddRectForegroundDiwne

cpp
void AddRectForegroundDiwne(
    const ImVec2 & p_min,
    const ImVec2 & p_max,
    const ImVec4 & col,
    float rounding =0.0f,
    ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll,
    float thickness =1.0f,
    bool ignoreZoom =false
) const
void AddRectForegroundDiwne(
    const ImVec2 & p_min,
    const ImVec2 & p_max,
    const ImVec4 & col,
    float rounding =0.0f,
    ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll,
    float thickness =1.0f,
    bool ignoreZoom =false
) const

function applyZoomScaling

cpp
bool applyZoomScaling()
bool applyZoomScaling()

Modifies the current ImGuiStyle and Font depending on the current diwne zoom level.

Return: Whether zoom scaling was active before making this call

function applyZoomScalingToFont

cpp
float applyZoomScalingToFont(
    ImFont * font,
    float scaleMultiplier
)
float applyZoomScalingToFont(
    ImFont * font,
    float scaleMultiplier
)

Modifies the current Font depending on the current diwne zoom level.

Return: Whether zoom scaling was active before making this call

function diwne2screen

cpp
ImRect diwne2screen(
    const ImRect & rect
) const
ImRect diwne2screen(
    const ImRect & rect
) const

Convert diwne rect to a screen rect.

function diwne2screen

cpp
ImVec2 diwne2screen(
    const ImVec2 & point
) const
ImVec2 diwne2screen(
    const ImVec2 & point
) const

function diwne2screenSize

cpp
ImVec2 diwne2screenSize(
    const ImVec2 & point
) const
ImVec2 diwne2screenSize(
    const ImVec2 & point
) const

Apply diwne scaling factors to an ImVec2 size.

function diwne2screenSize

cpp
float diwne2screenSize(
    float size
) const
float diwne2screenSize(
    float size
) const

Apply diwne scaling factors to a float size.

function diwne2screenSizeTrunc

cpp
float diwne2screenSizeTrunc(
    float size
) const
float diwne2screenSizeTrunc(
    float size
) const

function diwne2screenTrunc

cpp
ImRect diwne2screenTrunc(
    const ImRect & rect
) const
ImRect diwne2screenTrunc(
    const ImRect & rect
) const

Convert diwne rect to pixel aligned screen rect.

function diwne2screenTrunc

cpp
ImVec2 diwne2screenTrunc(
    const ImVec2 & point
) const
ImVec2 diwne2screenTrunc(
    const ImVec2 & point
) const

Convert diwne point to pixel aligned screen position.

function diwne2workArea

cpp
ImVec2 diwne2workArea(
    const ImVec2 & point
) const
ImVec2 diwne2workArea(
    const ImVec2 & point
) const

function DrawBurgerMenu

cpp
void DrawBurgerMenu(
    ImDrawList * idl,
    const ImColor & color,
    const ImRect & rect,
    const ImVec2 & padding,
    float thickness
) const
void DrawBurgerMenu(
    ImDrawList * idl,
    const ImColor & color,
    const ImRect & rect,
    const ImVec2 & padding,
    float thickness
) const

function drawGrid

cpp
void drawGrid(
    bool dots,
    float size,
    ImVec4 color,
    float fadeStart,
    float fadeEnd,
    bool ignoreZoom
) const
void drawGrid(
    bool dots,
    float size,
    ImVec4 color,
    float fadeStart,
    float fadeEnd,
    bool ignoreZoom
) const

function DrawIcon

cpp
void DrawIcon(
    IconType bgIconType,
    ImColor bgShapeColor,
    ImColor bgInnerColor,
    IconType fgIconType,
    ImColor fgShapeColor,
    ImColor fgInnerColor,
    ImVec2 size,
    ImVec4 padding,
    bool filled,
    ImVec2 thickness =ImVec2(1, 1),
    float rounding =0
) const
void DrawIcon(
    IconType bgIconType,
    ImColor bgShapeColor,
    ImColor bgInnerColor,
    IconType fgIconType,
    ImColor fgShapeColor,
    ImColor fgInnerColor,
    ImVec2 size,
    ImVec4 padding,
    bool filled,
    ImVec2 thickness =ImVec2(1, 1),
    float rounding =0
) const

Draw an Icon combined from two parts (foreground and background) to the window ImDrawList filled with a ShapeColor.

Parameters:

  • bgIconType background shape (typically a Rectangle)

  • bgShapeColor color of the background shape (or a border color if not filled)

  • bgInnerColor color of the background shape interior if filled == false

  • fgIconType foreground shape (typically a Triangle or Cross)

  • fgShapeColor color of the foreground shape if filled == false

  • fgInnerColor color of foreground shape interior if filled == false

  • size of the icon in screen coordinates

  • padding of the fg shape (left, bottom, right, top)

  • filled means

  • true fill both shapes with their ShapeColor

  • false draw both shapes with a ShapeColor border and fill them with InnerColor

Return: void

When filled == true, both shapes have a border. Then, the border color is the ShapeColor and the shape is filled with the InnerColor

The icon is drawn at the current ImGui cursor. This method does NOT advance the cursor.

function DrawIconCircle

cpp
void DrawIconCircle(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const
void DrawIconCircle(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const

Draw a circle icon.

Parameters:

  • idl ImDrawList* where to draw
  • shapeColor color of the whole shape (border line if not filled)
  • innerColor color of the inner part (middle) of shape
  • topLeft position of the icon in screen coords
  • bottomRight of the icon in screen coords
  • filled false means use the InnerColor in the foreground Shape
  • thickness of the border for zoomFactor = 1.0

function DrawIconCross

cpp
void DrawIconCross(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float shapeThickness =2,
    float innerThickness =1
) const
void DrawIconCross(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float shapeThickness =2,
    float innerThickness =1
) const

function DrawIconFastForward

cpp
void DrawIconFastForward(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const
void DrawIconFastForward(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const

function DrawIconGrabDownLeft

cpp
void DrawIconGrabDownLeft(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const
void DrawIconGrabDownLeft(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const

function DrawIconGrabDownRight

cpp
void DrawIconGrabDownRight(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const
void DrawIconGrabDownRight(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const

function DrawIconHyphen

cpp
void DrawIconHyphen(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =3.0f
) const
void DrawIconHyphen(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =3.0f
) const

function DrawIconPause

cpp
void DrawIconPause(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    ImVec2 thickness =ImVec2(1, 1),
    float rounding =0
) const
void DrawIconPause(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    ImVec2 thickness =ImVec2(1, 1),
    float rounding =0
) const

function DrawIconRectangle

cpp
void DrawIconRectangle(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    ImVec2 thickness =ImVec2(1, 1),
    float rounding =0
) const
void DrawIconRectangle(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    ImVec2 thickness =ImVec2(1, 1),
    float rounding =0
) const

function DrawIconRewind

cpp
void DrawIconRewind(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const
void DrawIconRewind(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const

function DrawIconSkipBack

cpp
void DrawIconSkipBack(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const
void DrawIconSkipBack(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const

function DrawIconSkipBack2

cpp
void DrawIconSkipBack2(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const
void DrawIconSkipBack2(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const

function DrawIconSkipForward

cpp
void DrawIconSkipForward(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const
void DrawIconSkipForward(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const

function DrawIconSkipForward2

cpp
void DrawIconSkipForward2(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const
void DrawIconSkipForward2(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const

function DrawIconTriangleDownLeft

cpp
void DrawIconTriangleDownLeft(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const
void DrawIconTriangleDownLeft(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const

function DrawIconTriangleDownRight

cpp
void DrawIconTriangleDownRight(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const
void DrawIconTriangleDownRight(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const

function DrawIconTriangleLeft

cpp
void DrawIconTriangleLeft(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const
void DrawIconTriangleLeft(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const

function DrawIconTriangleRight

cpp
void DrawIconTriangleRight(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const
void DrawIconTriangleRight(
    ImDrawList * idl,
    ImColor shapeColor,
    ImColor innerColor,
    ImVec2 topLeft,
    ImVec2 bottomRight,
    bool filled,
    float thickness =1
) const

function EmptyButton

cpp
void EmptyButton(
    ImVec2 size,
    ImColor color,
    float rounding
)
void EmptyButton(
    ImVec2 size,
    ImColor color,
    float rounding
)

Just the shape of the button, no interaction.

Parameters:

  • size
  • color
  • rounding

function ensureZoomScaling

cpp
bool ensureZoomScaling(
    bool active
)
bool ensureZoomScaling(
    bool active
)

Ensure that zoom scaling is active or not based on a passed parameter.

Return: Whether zoom scaling was active before making this call, can be later passed to this method again to restore original state

function getViewportRectDiwne

cpp
ImRect getViewportRectDiwne() const
ImRect getViewportRectDiwne() const

function getViewportRectScreen

cpp
ImRect getViewportRectScreen() const
ImRect getViewportRectScreen() const

function getZoom

cpp
float getZoom() const
float getZoom() const

function IconButton

cpp
bool IconButton(
    IconType bgIconType,
    ImColor bgShapeColor,
    ImColor bgInnerColor,
    ImVec2 size,
    ImVec4 padding,
    bool filled,
    std::string id
) const
bool IconButton(
    IconType bgIconType,
    ImColor bgShapeColor,
    ImColor bgInnerColor,
    ImVec2 size,
    ImVec4 padding,
    bool filled,
    std::string id
) const

Add ImGui Button with icon on it.

See: DrawIcon()

Return: true if interaction with button happen, false otherwise

function IconButton

cpp
bool IconButton(
    std::string id,
    bool disabled,
    IconType bgIconType,
    ImColor bgShapeColor,
    ImColor bgInnerColor,
    IconType fgIconType,
    ImColor fgShapeColor,
    ImColor fgInnerColor,
    ImVec2 size,
    ImVec4 padding,
    bool filled,
    ImVec2 thickness =ImVec2(1, 1),
    float rounding =0
) const
bool IconButton(
    std::string id,
    bool disabled,
    IconType bgIconType,
    ImColor bgShapeColor,
    ImColor bgInnerColor,
    IconType fgIconType,
    ImColor fgShapeColor,
    ImColor fgInnerColor,
    ImVec2 size,
    ImVec4 padding,
    bool filled,
    ImVec2 thickness =ImVec2(1, 1),
    float rounding =0
) const

Add ImGui Button with icon on it.

Parameters:

  • disabled Disables the button, prevents presses and retaining of active id on drag, but still allows querying of hover state when wrapped in a ImGui group or with appropriate IsItemHovered flags.

See: DrawIcon()

Return: true if interaction with button happen, false otherwise

function IconButton2

cpp
bool IconButton2(
    const std::string & id,
    ImVec2 size,
    bool disabled,
    IconType bgIconType,
    IconType fgIconType,
    const IconStyle & style,
    const IconStyle & hoveredStyle,
    const IconStyle & activeStyle
) const
bool IconButton2(
    const std::string & id,
    ImVec2 size,
    bool disabled,
    IconType bgIconType,
    IconType fgIconType,
    const IconStyle & style,
    const IconStyle & hoveredStyle,
    const IconStyle & activeStyle
) const

// TODO: (DR) Docs, new IconButton that allows various styles depening on the button state (hover, maybe press) Add ImGui Button with icon on it

Parameters:

  • disabled Disables the button, prevents presses and retaining of active id on drag, but still allows querying of hover state when wrapped in a ImGui group or with appropriate IsItemHovered flags.

See: DrawIcon()

Return: true if interaction with button happen, false otherwise

function moveViewport

cpp
void moveViewport(
    const ImVec2 & distance
)
void moveViewport(
    const ImVec2 & distance
)

function moveViewportZoomed

cpp
void moveViewportZoomed(
    const ImVec2 & distance
)
void moveViewportZoomed(
    const ImVec2 & distance
)

function screen2diwne

cpp
ImRect screen2diwne(
    const ImRect & rect
) const
ImRect screen2diwne(
    const ImRect & rect
) const

Convert screen rect to a diwne rect.

function screen2diwne

cpp
ImVec2 screen2diwne(
    const ImVec2 & point
) const
ImVec2 screen2diwne(
    const ImVec2 & point
) const

function screen2diwneSize

cpp
ImVec2 screen2diwneSize(
    const ImVec2 & point
) const
ImVec2 screen2diwneSize(
    const ImVec2 & point
) const

Revert diwne scaling factors from a ImVec2 size.

function screen2diwneSize

cpp
float screen2diwneSize(
    float size
) const
float screen2diwneSize(
    float size
) const

Revert diwne scaling factors from a float size.

function screen2workArea

cpp
ImVec2 screen2workArea(
    const ImVec2 & point
) const
ImVec2 screen2workArea(
    const ImVec2 & point
) const

function setViewportRectDiwne

cpp
void setViewportRectDiwne(
    ImRect rect
)
void setViewportRectDiwne(
    ImRect rect
)

function setZoom

cpp
virtual void setZoom(
    float val
)
virtual void setZoom(
    float val
)

function stopZoomScaling

cpp
bool stopZoomScaling()
bool stopZoomScaling()

Restores the current ImGuiStyle and Font back to its state before applyZoomScaling() was last called.

Return: Whether zoom scaling was active before making this call

function stopZoomScalingToFont

cpp
void stopZoomScalingToFont(
    ImFont * font,
    float originalScale
)
void stopZoomScalingToFont(
    ImFont * font,
    float originalScale
)

See: applyZoomScalingToFont

function updateViewportRects

cpp
void updateViewportRects()
void updateViewportRects()

Update screen and diwne positions and sizes of viewport.

function workArea2diwne

cpp
ImVec2 workArea2diwne(
    const ImVec2 & point
) const
ImVec2 workArea2diwne(
    const ImVec2 & point
) const

function workArea2screen

cpp
ImVec2 workArea2screen(
    const ImVec2 & point
) const
ImVec2 workArea2screen(
    const ImVec2 & point
) const

Protected Functions Documentation

function ScaleAllSizes

cpp
void ScaleAllSizes(
    ImGuiStyle & style,
    float scale_factor
)
void ScaleAllSizes(
    ImGuiStyle & style,
    float scale_factor
)

Public Attributes Documentation

variable m_prevZoom

cpp
float m_prevZoom;
float m_prevZoom;

Last frame zoom factor.

variable m_unscaledFontSize

cpp
float m_unscaledFontSize {16.f};
float m_unscaledFontSize {16.f};

Original font size.

variable m_viewRectDiwne

cpp
ImRect m_viewRectDiwne;
ImRect m_viewRectDiwne;

Bounds of the canvas viewport in canvas/editor's coordinates (diwne coordinates).

The top left corner (.Min) can be set manually, the bottom right corner (.Max) is determined by available space.

variable m_viewRectScreen

cpp
ImRect m_viewRectScreen;
ImRect m_viewRectScreen;

Viewport bounds in screen space coordinates.

variable m_zoom

cpp
float m_zoom;
float m_zoom;

Viewport zoom factor (scale ratio between diwne and screen coordinates).

variable m_zoomScalingApplied

cpp
bool m_zoomScalingApplied = false;
bool m_zoomScalingApplied = false;

Whether zoom UI scaling has been applied or not to Dear ImGui.

Protected Attributes Documentation

variable editor

cpp
NodeEditor & editor;
NodeEditor & editor;

variable m_zoomOriginalFontScale

cpp
float m_zoomOriginalFontScale;
float m_zoomOriginalFontScale;

Original font scale.

variable m_zoomOriginalStyle

cpp
ImGuiStyle m_zoomOriginalStyle;
ImGuiStyle m_zoomOriginalStyle;

Original ImGui style.


Updated on 2025-05-31 at 12:55:31 +0000