Top | ![]() |
![]() |
![]() |
![]() |
void (*GanvEdgeFunc) (GanvEdge *edge
,void *data
);
A node function that takes a user data argument (for callbacks).
Note that in the Gtk world it is considered safe to cast a function to a function with more arguments and call the resulting pointer, so functions like ganv_edge_select can safely be used where a GanvEdgeFunc is expected.
void (*GanvNodeFunc) (GanvNode *node
,void *data
);
A node function that takes a user data argument (for callbacks).
Note that in the Gtk world it is considered safe to cast a function to a function with more arguments and call the resulting pointer, so functions like ganv_node_select can safely be used where a GanvNodeFunc is expected.
int (*GanvPortOrderFunc) (const GanvPort *Param1
,const GanvPort *Param2
,void *data
);
void ganv_canvas_set_wrapper (GanvCanvas *canvas
,void *wrapper
);
Set the opaque wrapper object for the canvas.
void *
ganv_canvas_get_wrapper (GanvCanvas *canvas
);
Return an opaque pointer to the wrapper for the canvas.
void ganv_canvas_resize (GanvCanvas *canvas
,double width
,double height
);
Resize the canvas to the given dimensions.
void ganv_canvas_set_scroll_region (GanvCanvas *canvas
,double x1
,double y1
,double x2
,double y2
);
Sets the scrolling region of a canvas to the specified rectangle. The canvas will then be able to scroll only within this region. The view of the canvas is adjusted as appropriate to display as much of the new region as possible.
void ganv_canvas_get_scroll_region (GanvCanvas *canvas
,double *x1
,double *y1
,double *x2
,double *y2
);
Queries the scrolling region of a canvas.
void ganv_canvas_set_center_scroll_region (GanvCanvas *canvas
,gboolean center_scroll_region
);
When the scrolling region of the canvas is smaller than the canvas window, e.g. the allocation of the canvas, it can be either centered on the window or simply made to be on the upper-left corner on the window. This function lets you configure this property.
gboolean
ganv_canvas_get_center_scroll_region (const GanvCanvas *canvas
);
Returns whether the canvas is set to center the scrolling region in the window if the former is smaller than the canvas' allocation.
void ganv_canvas_scroll_to (GanvCanvas *canvas
,int cx
,int cy
);
Makes a canvas scroll to the specified offsets, given in canvas pixel units. The canvas will adjust the view so that it is not outside the scrolling region. This function is typically not used, as it is better to hook scrollbars to the canvas layout's scrolling adjusments.
void ganv_canvas_get_scroll_offsets (const GanvCanvas *canvas
,int *cx
,int *cy
);
Queries the scrolling offsets of a canvas. The values are returned in canvas pixel units.
void ganv_canvas_w2c_affine (GanvCanvas *canvas
,cairo_matrix_t *matrix
);
Gets the affine transform that converts from world coordinates to canvas pixel coordinates.
void ganv_canvas_w2c (GanvCanvas *canvas
,double wx
,double wy
,int *cx
,int *cy
);
Converts world coordinates into canvas pixel coordinates.
void ganv_canvas_w2c_d (GanvCanvas *canvas
,double wx
,double wy
,double *cx
,double *cy
);
Converts world coordinates into canvas pixel coordinates. This version uses floating point coordinates for greater precision.
void ganv_canvas_c2w (GanvCanvas *canvas
,int cx
,int cy
,double *wx
,double *wy
);
Converts canvas pixel coordinates to world coordinates.
void ganv_canvas_window_to_world (GanvCanvas *canvas
,double winx
,double winy
,double *worldx
,double *worldy
);
Converts window-relative coordinates into world coordinates. You can use this when you need to convert mouse coordinates into world coordinates, for example.
void ganv_canvas_world_to_window (GanvCanvas *canvas
,double worldx
,double worldy
,double *winx
,double *winy
);
Converts world coordinates into window-relative coordinates.
GanvItem * ganv_canvas_get_item_at (GanvCanvas *canvas
,double x
,double y
);
Looks for the item that is under the specified position, which must be specified in world coordinates.
GanvEdge * ganv_canvas_get_edge (GanvCanvas *canvas
,GanvNode *tail
,GanvNode *head
);
Get the edge between two nodes, or NULL if none exists.
void ganv_canvas_remove_edge (GanvCanvas *canvas
,GanvEdge *edge
);
Remove edge
from the canvas.
void ganv_canvas_remove_edge_between (GanvCanvas *canvas
,GanvNode *tail
,GanvNode *head
);
Remove the edge from tail
to head
if one exists.
GanvDirection
ganv_canvas_get_direction (GanvCanvas *canvas
);
Return the direction of signal flow.
void ganv_canvas_set_direction (GanvCanvas *canvas
,GanvDirection dir
);
Set the direction of signal flow.
void
ganv_canvas_arrange (GanvCanvas *canvas
);
Automatically arrange the canvas contents.
int ganv_canvas_export_image (GanvCanvas *canvas
,const char *filename
,gboolean draw_background
);
Draw the canvas to an image file. The file type is determined by extension, currently supported: pdf, ps, svg, dot.
void ganv_canvas_export_dot (GanvCanvas *canvas
,const char *filename
);
Write a Graphviz DOT description of the canvas to a file.
gboolean
ganv_canvas_supports_sprung_layout (const GanvCanvas *canvas
);
gboolean ganv_canvas_set_sprung_layout (GanvCanvas *canvas
,gboolean sprung_layout
);
Enable or disable "live" force-directed canvas layout.
gboolean
ganv_canvas_get_locked (const GanvCanvas *canvas
);
Return true iff the canvas is locked and nodes may not move.
void ganv_canvas_for_each_node (GanvCanvas *canvas
,GanvNodeFunc f
,void *data
);
void ganv_canvas_for_each_selected_node (GanvCanvas *canvas
,GanvNodeFunc f
,void *data
);
void ganv_canvas_for_each_edge (GanvCanvas *canvas
,GanvEdgeFunc f
,void *data
);
void ganv_canvas_for_each_edge_from (GanvCanvas *canvas
,const GanvNode *tail
,GanvEdgeFunc f
,void *data
);
void ganv_canvas_for_each_edge_to (GanvCanvas *canvas
,const GanvNode *head
,GanvEdgeFunc f
,void *data
);
void ganv_canvas_for_each_edge_on (GanvCanvas *canvas
,const GanvNode *node
,GanvEdgeFunc f
,void *data
);
void ganv_canvas_for_each_selected_edge (GanvCanvas *canvas
,GanvEdgeFunc f
,void *data
);
void
ganv_canvas_select_all (GanvCanvas *canvas
);
Select all items on the canvas.
void
ganv_canvas_clear_selection (GanvCanvas *canvas
);
Deselect any selected items on the canvas.
double
ganv_canvas_get_zoom (const GanvCanvas *canvas
);
Return the current zoom factor (pixels per unit).
void ganv_canvas_set_zoom (GanvCanvas *canvas
,double zoom
);
The anchor point for zooming, i.e. the point that stays fixed and all others
zoom inwards or outwards from it, depends on whether the canvas is set to
center the scrolling region or not. You can control this using the
ganv_canvas_set_center_scroll_region()
function. If the canvas is set to
center the scroll region, then the center of the canvas window is used as
the anchor point for zooming. Otherwise, the upper-left corner of the
canvas window is used as the anchor point.
void
ganv_canvas_zoom_full (GanvCanvas *canvas
);
Zoom so all canvas contents are visible.
double
ganv_canvas_get_default_font_size (const GanvCanvas *canvas
);
Get the default font size in points.
double
ganv_canvas_get_font_size (const GanvCanvas *canvas
);
Get the current font size in points.
void ganv_canvas_set_font_size (GanvCanvas *canvas
,double points
);
Set the current font size in points.
GdkCursor *
ganv_canvas_get_move_cursor (const GanvCanvas *canvas
);
Return the cursor to use while dragging canvas objects.
void ganv_canvas_move_contents_to (GanvCanvas *canvas
,double x
,double y
);
Shift all canvas contents so the top-left object is at (x, y).
void ganv_canvas_set_port_order (GanvCanvas *canvas
,GanvPortOrderFunc port_cmp
,void *data
);
Set a comparator function to use as the default order for ports on modules. If left unset, ports are shown in the order they are added.