GogView

## GogView GogView |

## Synopsis

                        GogView;
                        GogViewClass;
                        GogViewAllocation;
                        GogViewPadding;
                        GogViewRequisition;
    GogView *           gog_view_find_child_view            (GogView const *container,
                                                             GogObject const *target_model);
    GogObject *         gog_view_get_model                  (GogView const *view);
    void                gog_view_get_natural_size           (GogView *view,
                                                             GogViewRequisition *requisition);
    char *              gog_view_get_tip_at_point           (GogView *view,
                                                             double x,
                                                             double y);
    GogTool *           gog_view_get_tool_at_point          (GogView *view,
                                                             double x,
                                                             double y,
                                                             GogObject **gobj);
    GSList const	*      gog_view_get_toolkit                (GogView *view);
    GogView *           gog_view_get_view_at_point          (GogView *view,
                                                             double x,
                                                             double y,
                                                             GogObject **obj,
                                                             GogTool **tool);
    void                gog_view_padding_request            (GogView *view,
                                                             GogViewAllocation const *bbox,
                                                             GogViewPadding *padding);
    void                gog_view_queue_redraw               (GogView *view);
    void                gog_view_queue_resize               (GogView *view);
    void                gog_view_render                     (GogView *view,
                                                             GogViewAllocation const *bbox);
    void                gog_view_render_toolkit             (GogView *view);
    void                gog_view_size_allocate              (GogView *view,
                                                             GogViewAllocation const *allocation);
    void                gog_view_size_child_request         (GogView *view,
                                                             GogViewRequisition const *available,
                                                             GogViewRequisition *req,
                                                             GogViewRequisition *min_req);
    void                gog_view_size_request               (GogView *view,
                                                             GogViewRequisition const *available,
                                                             GogViewRequisition *requisition);
    gboolean            gog_view_update_sizes               (GogView *view);

## Object Hierarchy

      GObject
       +----GogView
             +----GogAxisBaseView
             +----GogOutlinedView
             +----GogPlotView

      GBoxed
       +----GogViewAllocation

## Properties

      "model"                    GogObject*            : Write
      "parent"                   GogView*              : Write

## Description

## Details

### GogView

    typedef struct _GogView GogView;

### GogViewClass

    typedef struct {
    	GObjectClass base;

    	unsigned clip; 	/* Automaticaly clip to object bounding box */

    	/* Virtuals */
    	void	 (*state_init)    (GogView *view);
    	void	 (*padding_request) 		(GogView *view, GogViewAllocation const *bbox,
    						 GogViewPadding *padding);
    	void	 (*size_request)    		(GogView *view, GogViewRequisition const *available,
    						 GogViewRequisition *requisition);
    	void	 (*size_allocate)   		(GogView *view, GogViewAllocation const *allocation);

    	void	 (*render)        		(GogView *view, GogViewAllocation const *bbox);

    	void	 (*build_toolkit)		(GogView *view);
    	char    *(*get_tip_at_point)		(GogView *view, double x, double y);
    	void	 (*natural_size)    		(GogView *view, GogViewRequisition *req);
    } GogViewClass;

the GogViewClass::clip firled should be set to `TRUE` to clip drawings to the vew allocation.

GObjectClass `base`; | base class.
`state_init` () | state intialization.
`padding_request` () | padding request.
`size_request` () | size request.
`size_allocate` () | size allocate.
`render` () | render to cairo.
`build_toolkit` () | builds the associated toolkit.
`get_tip_at_point` () | gets tip at pointer position.
`natural_size` () | gets natural size.

### GogViewAllocation

    typedef struct {
    	double w, h;
    	double x, y;
    } GogViewAllocation;

double `w`; | width.
double `h`; | height.
double `x`; | horizontal position.
double `y`; | vertical position.

### GogViewPadding

    typedef struct {
    	double wr, hb;
    	double wl, ht;
    } GogViewPadding;

double `wr`; | right padding.
double `hb`; | bottom padding.
double `wl`; | left pdding.
double `ht`; | top padding.

### GogViewRequisition

    typedef struct {
    	double w, h;
    } GogViewRequisition;

double `w`; | width.
double `h`; | height.

### gog_view_find_child_view ()

    GogView *           gog_view_find_child_view            (GogView const *container,
                                                             GogObject const *target_model);

Find the GogView contained in `container` that corresponds to `model`.

`container` : | GogView
`target_model` : | GogObject
Returns : | NULL on error or if `target_model` has no view. [transfer none]

### gog_view_get_model ()

    GogObject *         gog_view_get_model                  (GogView const *view);

`view` : | GogView
Returns : | the GogObject owning the view. [transfer none]

### gog_view_get_natural_size ()

    void                gog_view_get_natural_size           (GogView *view,
                                                             GogViewRequisition *requisition);

### gog_view_get_tip_at_point ()

    char *              gog_view_get_tip_at_point           (GogView *view,
                                                             double x,
                                                             double y);

Gets a tip string related to the position as defined by (`x`,`y`) in `view`.

`view` : | GogView
`x` : | x position
`y` : | y position
Returns : | the newly allocated tip string if the view class supports that or NULL.

### gog_view_get_tool_at_point ()

    GogTool *           gog_view_get_tool_at_point          (GogView *view,
                                                             double x,
                                                             double y,
                                                             GogObject **gobj);

`view` : | GogView
`x` : | in coords
`y` : | in coords
`gobj` : | pointed object or NULL
Returns : | tool under cursor for a given view, or `NULL`. [transfer none]

### gog_view_get_toolkit ()

    GSList const	*      gog_view_get_toolkit                (GogView *view);

`view` : | GogView
Returns : | toolkit associated with given view. [element-type GogTool][transfer none]

### gog_view_get_view_at_point ()

    GogView *           gog_view_get_view_at_point          (GogView *view,
                                                             double x,
                                                             double y,
                                                             GogObject **obj,
                                                             GogTool **tool);

Gets view under cursor, searching recursively from `view`. Corresponding object is stored in `obj`. This object may or may not be `view->model` of pointed view. This function also stores tool under cursor, for the pointed view.

`view` : | GogView
`x` : | cursor x position
`y` : | cursor y position
`obj` : | pointed object or NULL
`tool` : | pointed tool or NULL
Returns : | the GogView at x,y position. [transfer none]

### gog_view_padding_request ()

    void                gog_view_padding_request            (GogView *view,
                                                             GogViewAllocation const *bbox,
                                                             GogViewPadding *padding);

### gog_view_queue_redraw ()

    void                gog_view_queue_redraw               (GogView *view);

Requests a redraw for the entire graph.

`view` : | a GogView

### gog_view_queue_resize ()

    void                gog_view_queue_resize               (GogView *view);

Flags a view to have its size renegotiated; should be called when a model for some reason has a new size request. For example, when you change the size of a legend.

`view` : | a GogView

### gog_view_render ()

    void                gog_view_render                     (GogView *view,
                                                             GogViewAllocation const *bbox);

### gog_view_render_toolkit ()

    void                gog_view_render_toolkit             (GogView *view);

Render toolkit elements.

`view` : | GogView

### gog_view_size_allocate ()

    void                gog_view_size_allocate              (GogView *view,
                                                             GogViewAllocation const *allocation);

Assign a size and position to a GogView. Primarilly used by containers.

`view` : | a GogView
`allocation` : | position and size to be allocated to `view`

### gog_view_size_child_request ()

    void                gog_view_size_child_request         (GogView *view,
                                                             GogViewRequisition const *available,
                                                             GogViewRequisition *req,
                                                             GogViewRequisition *min_req);

Computes additional requision in `req` which must be added to parent requisition, and minimum requisition in `min_req` which is minimum space for displaying all children.

`view` : | a GogView
`available` : | the amount of space available in total
`req` : | additionnal requisition
`min_req` : | minimum size for displaying all children

### gog_view_size_request ()

    void                gog_view_size_request               (GogView *view,
                                                             GogViewRequisition const *available,
                                                             GogViewRequisition *requisition);

When called `available` holds the available space and `requisition` is populated with the desired size based on that input and other elements of the view or its model's state (eg the position).

Remember that the size request is not necessarily the size a view will actually be allocated.

`view` : | a GogView
`available` : | available space.
`requisition` : | a GogViewRequisition.

### gog_view_update_sizes ()

    gboolean            gog_view_update_sizes               (GogView *view);

`view` : | GogView
Returns : | `TRUE` if a redraw is necessary.

## Property Details

### The `"model"` property

      "model"                    GogObject*            : Write

The GogObject this view displays.

### The `"parent"` property

      "parent"                   GogView*              : Write

the GogView parent.