diff options
-rw-r--r-- | ganv/Canvas.hpp | 1 | ||||
-rw-r--r-- | ganv/canvas.h | 8 | ||||
-rw-r--r-- | src/Canvas.cpp | 6 |
3 files changed, 15 insertions, 0 deletions
diff --git a/ganv/Canvas.hpp b/ganv/Canvas.hpp index bee0b22..7b71642 100644 --- a/ganv/Canvas.hpp +++ b/ganv/Canvas.hpp @@ -71,6 +71,7 @@ public: METHOD2(ganv_canvas, resize, double, width, double, height); METHOD2(ganv_canvas, for_each_node, GanvNodeFunc, f, void*, data) METHOD2(ganv_canvas, for_each_selected_node, GanvNodeFunc, f, void*, data) + METHODRET0(ganv_canvas, gboolean, empty) METHOD3(ganv_canvas, for_each_edge_from, const GanvNode*, tail, diff --git a/ganv/canvas.h b/ganv/canvas.h index 6d946f4..b569eeb 100644 --- a/ganv/canvas.h +++ b/ganv/canvas.h @@ -166,6 +166,14 @@ ganv_canvas_for_each_selected_node(GanvCanvas* canvas, void* data); /** + * ganv_canvas_empty: + + * Return value: True if there are no items on the canvas. + */ +gboolean +ganv_canvas_empty(const GanvCanvas* canvas); + +/** * ganv_canvas_for_each_edge: * @canvas: The canvas. * @f: (scope call): A function to call on every edge on @canvas. diff --git a/src/Canvas.cpp b/src/Canvas.cpp index e028b26..7111e1a 100644 --- a/src/Canvas.cpp +++ b/src/Canvas.cpp @@ -2037,6 +2037,12 @@ ganv_canvas_for_each_selected_node(GanvCanvas* canvas, } } +gboolean +ganv_canvas_empty(const GanvCanvas* canvas) +{ + return canvas->impl->_items.empty(); +} + void ganv_canvas_for_each_edge_from(GanvCanvas* canvas, const GanvNode* tail, |