Canvas Views

Canvas Views

Synopsis


#include <ccc.h>


enum                CcZoomMode;
                    CcView;
                    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 const*self,
                                                         gdouble *x,
                                                         gdouble *y);
void                cc_view_world_to_window             (CcView const*self,
                                                         gdouble *x,
                                                         gdouble *y);
CcItem*             cc_view_get_focus                   (const CcView *self);
CcDRect*            cc_view_get_scrolled_region         (CcView *self);
gint                cc_view_grab_item                   (CcView *self,
                                                         CcItem *item,
                                                         GdkEventMask mask,
                                                         GdkCursor *cursor,
                                                         guint32 time);
void                cc_view_set_focus                   (CcView *self,
                                                         CcItem *focus);
void                cc_view_set_scrolled_region         (CcView *self,
                                                         CcDRect const*scrolled_region);
void                cc_view_ungrab_item                 (CcView *self,
                                                         CcItem *item,
                                                         guint32 time);
void                cc_view_world_to_window_distance    (CcView const*self,
                                                         gdouble *x,
                                                         gdouble *y);

Object Hierarchy


  GInterface
   +----CcView

Prerequisites

CcView requires CcItemView and GObject.

Known Implementations

CcView is implemented by CcCamera, CcViewCellRenderer and CcViewWidget.

Properties


  "focus"                    CcItem                : Read / Write
  "root"                     CcItem                : Read / Write
  "scrolled-region"          CcDRect               : Read / Write
  "zoom"                     gdouble               : Read / Write / Construct
  "zoom-mode"                CcZoomMode            : Read / Write

Description

Details

enum CcZoomMode

typedef enum {
	CC_ZOOM_PIXELS,
	CC_ZOOM_WIDTH,
	CC_ZOOM_HEIGHT,
	CC_ZOOM_AUTO
} CcZoomMode;


CcView

typedef struct _CcView CcView;


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 const* self,
				                  gdouble     * x,
				                  gdouble     * y);
	void          (*world_to_window)         (CcView const* self,
				                  gdouble     * x,
				                  gdouble     * y);
	void          (*world_to_window_distance)(CcView const* 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 const*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 const*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

cc_view_get_focus ()

CcItem*             cc_view_get_focus                   (const CcView *self);

self :
Returns :

cc_view_get_scrolled_region ()

CcDRect*            cc_view_get_scrolled_region         (CcView *self);

Get the scrolled region of this view.

self : a CcView
Returns : the scrolled region of this view.

cc_view_grab_item ()

gint                cc_view_grab_item                   (CcView *self,
                                                         CcItem *item,
                                                         GdkEventMask mask,
                                                         GdkCursor *cursor,
                                                         guint32 time);

Grab the item.

self : a CcView
item : a CcItem
mask : a GdkEventMask
cursor : a GdkCursor
time : the time
Returns : GDK_GRAB_NOT_VIEWABLE if the view cannot grab at all.

cc_view_set_focus ()

void                cc_view_set_focus                   (CcView *self,
                                                         CcItem *focus);

self :
focus :

cc_view_set_scrolled_region ()

void                cc_view_set_scrolled_region         (CcView *self,
                                                         CcDRect const*scrolled_region);

Set scrolled_region as the region to be displayed and/or reachable with scrollbars.

self : a CcView
scrolled_region : a CcItem

cc_view_ungrab_item ()

void                cc_view_ungrab_item                 (CcView *self,
                                                         CcItem *item,
                                                         guint32 time);

self :
item :
time :

cc_view_world_to_window_distance ()

void                cc_view_world_to_window_distance    (CcView const*self,
                                                         gdouble *x,
                                                         gdouble *y);

Convert x and y to window coordinates

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

Property Details

The "focus" property

  "focus"                    CcItem                : Read / Write

Focus.


The "root" property

  "root"                     CcItem                : Read / Write

The root element of this canvas.


The "scrolled-region" property

  "scrolled-region"          CcDRect               : Read / Write

scrolled-region.


The "zoom" property

  "zoom"                     gdouble               : Read / Write / Construct

Zoom.

Allowed values: >= G_MINDOUBLE

Default value: 1


The "zoom-mode" property

  "zoom-mode"                CcZoomMode            : Read / Write

BLURB.

Default value: CC_ZOOM_PIXELS