Canvas Views

Canvas Views —

Synopsis




            CcViewIface;
CcItem*     cc_view_get_root                (CcView *self);
void        cc_view_set_root                (CcView *self,
                                             CcItem *root);
gdouble     cc_view_get_zoom                (CcView *self);
void        cc_view_set_zoom                (CcView *self,
                                             gdouble zoom);
void        cc_view_window_to_world         (CcView *self,
                                             gdouble *x,
                                             gdouble *y);
void        cc_view_world_to_window         (CcView *self,
                                             gdouble *x,
                                             gdouble *y);

Description

Details

CcViewIface

typedef struct {
	GTypeInterface base_iface;

	/* vtable */
	GdkGrabStatus (*grab_item)               (CcView*       self,
				                  CcItem*       item,
					          GdkEventMask  mask,
					          GdkCursor   * cursor,
					          guint32       time);
	void          (*ungrab_item)             (CcView      * self,
					          CcItem      * item,
					          guint32       time);
	void          (*window_to_world)         (CcView      * self,
				                  gdouble     * x,
				                  gdouble     * y);
	void          (*world_to_window)         (CcView      * self,
				                  gdouble     * x,
				                  gdouble     * y);
	void          (*world_to_window_distance)(CcView      * self,
					          gdouble     * x,
					          gdouble     * y);
} CcViewIface;


cc_view_get_root ()

CcItem*     cc_view_get_root                (CcView *self);

Get the model that's displayed by self.

self : a CcView
Returns : the CcItem that's displayed by self, may be NULL.

cc_view_set_root ()

void        cc_view_set_root                (CcView *self,
                                             CcItem *root);

Set root as the model to be displayed in self.

self : a CcView
root : a CcItem

cc_view_get_zoom ()

gdouble     cc_view_get_zoom                (CcView *self);

Get the zoom of the view.

self : a CcView
Returns : the zoom of the view.

cc_view_set_zoom ()

void        cc_view_set_zoom                (CcView *self,
                                             gdouble zoom);

Set the zoom of the canvas.

self : a CcView
zoom : a new zoom value

cc_view_window_to_world ()

void        cc_view_window_to_world         (CcView *self,
                                             gdouble *x,
                                             gdouble *y);

Convert window_x and window_y to world_x and world_y if given.

self : a CcView
x : target for a world coordinate, may be NULL
y : target for a world coordinate, may be NULL

cc_view_world_to_window ()

void        cc_view_world_to_window         (CcView *self,
                                             gdouble *x,
                                             gdouble *y);

Convert x and y to window coordinates if given.

self : a CcView
x : target for a window coordinate, may be NULL
y : target for a window coordinate, may be NULL