DIWNE::Canvas
Representation of the 2D infinite plane of a node editor. More...
#include "DIWNE/Core/Canvas.h"
Public Functions
| Name | |
|---|---|
| Canvas(NodeEditor & editor) | |
| 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<br>Draw Bezier (not Bezier really) curve to window ImDrawList. |
| void | AddLine(const ImVec2 & p1, const ImVec2 & p2, const ImVec4 & col, 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<br>Draw rectangle to window ImDrawlist This method accepts DIWNE coordinates and converts them to truncated screen coordinates. |
| 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<br>Draw filled rectangle to window ImDrawlist This method accepts DIWNE coordinates and converts them to truncated screen coordinates. |
| 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 |
| bool | applyZoomScaling()<br>Modifies the current ImGuiStyle and Font depending on the current diwne zoom level. |
| float | applyZoomScalingToFont(ImFont * font, float scaleMultiplier)<br>Modifies the current Font depending on the current diwne zoom level. |
| ImRect | diwne2screen(const ImRect & rect) const<br>Convert diwne rect to a screen rect. |
| ImVec2 | diwne2screen(const ImVec2 & point) const |
| ImVec2 | diwne2screenSize(const ImVec2 & point) const<br>Apply diwne scaling factors to an ImVec2 size. |
| float | diwne2screenSize(float size) const<br>Apply diwne scaling factors to a float size. |
| float | diwne2screenSizeTrunc(float size) const |
| ImRect | diwne2screenTrunc(const ImRect & rect) const<br>Convert diwne rect to pixel aligned screen rect. |
| ImVec2 | diwne2screenTrunc(const ImVec2 & point) const<br>Convert diwne point to pixel aligned screen position. |
| ImVec2 | diwne2workArea(const ImVec2 & point) const |
| void | DrawBurgerMenu(ImDrawList * idl, const ImColor & color, const ImRect & rect, const ImVec2 & padding, float thickness) const |
| void | drawGrid(bool dots, float size, ImVec4 color, float fadeStart, float fadeEnd, bool ignoreZoom) 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<br>Draw an Icon combined from two parts (foreground and background) to the window ImDrawList filled with a ShapeColor. |
| void | DrawIconCircle(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const<br>Draw a circle icon. |
| void | DrawIconCross(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float shapeThickness =2, float innerThickness =1) const |
| void | DrawIconFastForward(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 |
| void | DrawIconGrabDownRight(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const |
| void | DrawIconHyphen(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =3.0f) const |
| void | DrawIconPause(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 |
| void | DrawIconRewind(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 |
| void | DrawIconSkipBack2(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 |
| void | DrawIconSkipForward2(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 |
| void | DrawIconTriangleDownRight(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 |
| void | DrawIconTriangleRight(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const |
| void | EmptyButton(ImVec2 size, ImColor color, float rounding)<br>Just the shape of the button, no interaction. |
| bool | ensureZoomScaling(bool active)<br>Ensure that zoom scaling is active or not based on a passed parameter. |
| ImRect | getViewportRectDiwne() const |
| ImRect | getViewportRectScreen() const |
| float | getZoom() const |
| bool | IconButton(IconType bgIconType, ImColor bgShapeColor, ImColor bgInnerColor, ImVec2 size, ImVec4 padding, bool filled, std::string id) const<br>Add ImGui Button with icon on it. |
| 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<br>Add ImGui Button with icon on it. |
| bool | IconButton2(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 |
| void | moveViewport(const ImVec2 & distance) |
| void | moveViewportZoomed(const ImVec2 & distance) |
| ImRect | screen2diwne(const ImRect & rect) const<br>Convert screen rect to a diwne rect. |
| ImVec2 | screen2diwne(const ImVec2 & point) const |
| ImVec2 | screen2diwneSize(const ImVec2 & point) const<br>Revert diwne scaling factors from a ImVec2 size. |
| float | screen2diwneSize(float size) const<br>Revert diwne scaling factors from a float size. |
| ImVec2 | screen2workArea(const ImVec2 & point) const |
| void | setViewportRectDiwne(ImRect rect) |
| virtual void | setZoom(float val) |
| bool | stopZoomScaling()<br>Restores the current ImGuiStyle and Font back to its state before applyZoomScaling() was last called. |
| void | stopZoomScalingToFont(ImFont * font, float originalScale) |
| void | updateViewportRects()<br>Update screen and diwne positions and sizes of viewport. |
| ImVec2 | workArea2diwne(const ImVec2 & point) const |
| ImVec2 | workArea2screen(const ImVec2 & point) const |
Protected Functions
| Name | |
|---|---|
| void | ScaleAllSizes(ImGuiStyle & style, float scale_factor) |
Public Attributes
| Name | |
|---|---|
| float | m_prevZoom <br>Last frame zoom factor. |
| float | m_unscaledFontSize <br>Original font size. |
| ImRect | m_viewRectDiwne <br>Bounds of the canvas viewport in canvas/editor's coordinates (diwne coordinates). |
| ImRect | m_viewRectScreen <br>Viewport bounds in screen space coordinates. |
| float | m_zoom <br>Viewport zoom factor (scale ratio between diwne and screen coordinates). |
| bool | m_zoomScalingApplied <br>Whether zoom UI scaling has been applied or not to Dear ImGui. |
Protected Attributes
| Name | |
|---|---|
| NodeEditor & | editor |
| float | m_zoomOriginalFontScale <br>Original font scale. |
| ImGuiStyle | m_zoomOriginalStyle <br>Original ImGui style. |
Detailed Description
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
Canvas(
NodeEditor & editor
)Canvas(
NodeEditor & editor
)function AddBezierCurveDiwne
void AddBezierCurveDiwne(
ImDrawList * idl,
const ImVec2 & p1,
const ImVec2 & p2,
const ImVec2 & p3,
const ImVec2 & p4,
ImVec4 col,
float thickness,
int num_segments =0
) constvoid AddBezierCurveDiwne(
ImDrawList * idl,
const ImVec2 & p1,
const ImVec2 & p2,
const ImVec2 & p3,
const ImVec2 & p4,
ImVec4 col,
float thickness,
int num_segments =0
) constDraw 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
void AddLine(
const ImVec2 & p1,
const ImVec2 & p2,
const ImVec4 & col,
float thickness =1.0f,
bool ignoreZoom =false
) constvoid AddLine(
const ImVec2 & p1,
const ImVec2 & p2,
const ImVec4 & col,
float thickness =1.0f,
bool ignoreZoom =false
) constfunction AddRectDiwne
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
) constvoid 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
) constDraw rectangle to window ImDrawlist This method accepts DIWNE coordinates and converts them to truncated screen coordinates.
See: AddRectFilledDiwne
function AddRectFilledDiwne
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
) constvoid AddRectFilledDiwne(
const ImVec2 & p_min,
const ImVec2 & p_max,
const ImVec4 & col,
float rounding =0.0f,
ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll,
bool ignoreZoom =false
) constDraw 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
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
) constvoid 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
) constfunction applyZoomScaling
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
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
ImRect diwne2screen(
const ImRect & rect
) constImRect diwne2screen(
const ImRect & rect
) constConvert diwne rect to a screen rect.
function diwne2screen
ImVec2 diwne2screen(
const ImVec2 & point
) constImVec2 diwne2screen(
const ImVec2 & point
) constfunction diwne2screenSize
ImVec2 diwne2screenSize(
const ImVec2 & point
) constImVec2 diwne2screenSize(
const ImVec2 & point
) constApply diwne scaling factors to an ImVec2 size.
function diwne2screenSize
float diwne2screenSize(
float size
) constfloat diwne2screenSize(
float size
) constApply diwne scaling factors to a float size.
function diwne2screenSizeTrunc
float diwne2screenSizeTrunc(
float size
) constfloat diwne2screenSizeTrunc(
float size
) constfunction diwne2screenTrunc
ImRect diwne2screenTrunc(
const ImRect & rect
) constImRect diwne2screenTrunc(
const ImRect & rect
) constConvert diwne rect to pixel aligned screen rect.
function diwne2screenTrunc
ImVec2 diwne2screenTrunc(
const ImVec2 & point
) constImVec2 diwne2screenTrunc(
const ImVec2 & point
) constConvert diwne point to pixel aligned screen position.
function diwne2workArea
ImVec2 diwne2workArea(
const ImVec2 & point
) constImVec2 diwne2workArea(
const ImVec2 & point
) constfunction DrawBurgerMenu
void DrawBurgerMenu(
ImDrawList * idl,
const ImColor & color,
const ImRect & rect,
const ImVec2 & padding,
float thickness
) constvoid DrawBurgerMenu(
ImDrawList * idl,
const ImColor & color,
const ImRect & rect,
const ImVec2 & padding,
float thickness
) constfunction drawGrid
void drawGrid(
bool dots,
float size,
ImVec4 color,
float fadeStart,
float fadeEnd,
bool ignoreZoom
) constvoid drawGrid(
bool dots,
float size,
ImVec4 color,
float fadeStart,
float fadeEnd,
bool ignoreZoom
) constfunction DrawIcon
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
) constvoid 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
) constDraw 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
void DrawIconCircle(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constvoid DrawIconCircle(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constDraw 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
void DrawIconCross(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float shapeThickness =2,
float innerThickness =1
) constvoid DrawIconCross(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float shapeThickness =2,
float innerThickness =1
) constfunction DrawIconFastForward
void DrawIconFastForward(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constvoid DrawIconFastForward(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constfunction DrawIconGrabDownLeft
void DrawIconGrabDownLeft(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constvoid DrawIconGrabDownLeft(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constfunction DrawIconGrabDownRight
void DrawIconGrabDownRight(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constvoid DrawIconGrabDownRight(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constfunction DrawIconHyphen
void DrawIconHyphen(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =3.0f
) constvoid DrawIconHyphen(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =3.0f
) constfunction DrawIconPause
void DrawIconPause(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
ImVec2 thickness =ImVec2(1, 1),
float rounding =0
) constvoid DrawIconPause(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
ImVec2 thickness =ImVec2(1, 1),
float rounding =0
) constfunction DrawIconRectangle
void DrawIconRectangle(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
ImVec2 thickness =ImVec2(1, 1),
float rounding =0
) constvoid DrawIconRectangle(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
ImVec2 thickness =ImVec2(1, 1),
float rounding =0
) constfunction DrawIconRewind
void DrawIconRewind(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constvoid DrawIconRewind(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constfunction DrawIconSkipBack
void DrawIconSkipBack(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constvoid DrawIconSkipBack(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constfunction DrawIconSkipBack2
void DrawIconSkipBack2(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constvoid DrawIconSkipBack2(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constfunction DrawIconSkipForward
void DrawIconSkipForward(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constvoid DrawIconSkipForward(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constfunction DrawIconSkipForward2
void DrawIconSkipForward2(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constvoid DrawIconSkipForward2(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constfunction DrawIconTriangleDownLeft
void DrawIconTriangleDownLeft(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constvoid DrawIconTriangleDownLeft(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constfunction DrawIconTriangleDownRight
void DrawIconTriangleDownRight(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constvoid DrawIconTriangleDownRight(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constfunction DrawIconTriangleLeft
void DrawIconTriangleLeft(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constvoid DrawIconTriangleLeft(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constfunction DrawIconTriangleRight
void DrawIconTriangleRight(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constvoid DrawIconTriangleRight(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) constfunction EmptyButton
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
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
ImRect getViewportRectDiwne() constImRect getViewportRectDiwne() constfunction getViewportRectScreen
ImRect getViewportRectScreen() constImRect getViewportRectScreen() constfunction getZoom
float getZoom() constfloat getZoom() constfunction IconButton
bool IconButton(
IconType bgIconType,
ImColor bgShapeColor,
ImColor bgInnerColor,
ImVec2 size,
ImVec4 padding,
bool filled,
std::string id
) constbool IconButton(
IconType bgIconType,
ImColor bgShapeColor,
ImColor bgInnerColor,
ImVec2 size,
ImVec4 padding,
bool filled,
std::string id
) constAdd ImGui Button with icon on it.
See: DrawIcon()
Return: true if interaction with button happen, false otherwise
function IconButton
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
) constbool 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
) constAdd 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
bool IconButton2(
const std::string & id,
ImVec2 size,
bool disabled,
IconType bgIconType,
IconType fgIconType,
const IconStyle & style,
const IconStyle & hoveredStyle,
const IconStyle & activeStyle
) constbool 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
void moveViewport(
const ImVec2 & distance
)void moveViewport(
const ImVec2 & distance
)function moveViewportZoomed
void moveViewportZoomed(
const ImVec2 & distance
)void moveViewportZoomed(
const ImVec2 & distance
)function screen2diwne
ImRect screen2diwne(
const ImRect & rect
) constImRect screen2diwne(
const ImRect & rect
) constConvert screen rect to a diwne rect.
function screen2diwne
ImVec2 screen2diwne(
const ImVec2 & point
) constImVec2 screen2diwne(
const ImVec2 & point
) constfunction screen2diwneSize
ImVec2 screen2diwneSize(
const ImVec2 & point
) constImVec2 screen2diwneSize(
const ImVec2 & point
) constRevert diwne scaling factors from a ImVec2 size.
function screen2diwneSize
float screen2diwneSize(
float size
) constfloat screen2diwneSize(
float size
) constRevert diwne scaling factors from a float size.
function screen2workArea
ImVec2 screen2workArea(
const ImVec2 & point
) constImVec2 screen2workArea(
const ImVec2 & point
) constfunction setViewportRectDiwne
void setViewportRectDiwne(
ImRect rect
)void setViewportRectDiwne(
ImRect rect
)function setZoom
virtual void setZoom(
float val
)virtual void setZoom(
float val
)function stopZoomScaling
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
void stopZoomScalingToFont(
ImFont * font,
float originalScale
)void stopZoomScalingToFont(
ImFont * font,
float originalScale
)function updateViewportRects
void updateViewportRects()void updateViewportRects()Update screen and diwne positions and sizes of viewport.
function workArea2diwne
ImVec2 workArea2diwne(
const ImVec2 & point
) constImVec2 workArea2diwne(
const ImVec2 & point
) constfunction workArea2screen
ImVec2 workArea2screen(
const ImVec2 & point
) constImVec2 workArea2screen(
const ImVec2 & point
) constProtected Functions Documentation
function ScaleAllSizes
void ScaleAllSizes(
ImGuiStyle & style,
float scale_factor
)void ScaleAllSizes(
ImGuiStyle & style,
float scale_factor
)Public Attributes Documentation
variable m_prevZoom
float m_prevZoom;float m_prevZoom;Last frame zoom factor.
variable m_unscaledFontSize
float m_unscaledFontSize {16.f};float m_unscaledFontSize {16.f};Original font size.
variable m_viewRectDiwne
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
ImRect m_viewRectScreen;ImRect m_viewRectScreen;Viewport bounds in screen space coordinates.
variable m_zoom
float m_zoom;float m_zoom;Viewport zoom factor (scale ratio between diwne and screen coordinates).
variable m_zoomScalingApplied
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
NodeEditor & editor;NodeEditor & editor;variable m_zoomOriginalFontScale
float m_zoomOriginalFontScale;float m_zoomOriginalFontScale;Original font scale.
variable m_zoomOriginalStyle
ImGuiStyle m_zoomOriginalStyle;ImGuiStyle m_zoomOriginalStyle;Original ImGui style.
Updated on 2026-05-21 at 15:39:36 +0000