## GogView

GogView — Base class for object views

## Synopsis

                        GogToolAction;
                        GogTool;
    GogToolAction*      gog_tool_action_new                 (GogView *view,
                                                             GogTool *tool,
                                                             double x,
                                                             double y);
    void                gog_tool_action_move                (GogToolAction *action,
                                                             double x,
                                                             double y);
    void                gog_tool_action_double_click        (GogToolAction *action);
    void                gog_tool_action_free                (GogToolAction *action);
                        GogView;
    #define             GOG_VIEW_TYPE
    #define             GOG_VIEW                            (o)
    #define             IS_GOG_VIEW                         (o)
    #define             GOG_VIEW_CLASS                      (k)
    #define             IS_GOG_VIEW_CLASS                   (k)
    #define             GOG_VIEW_GET_CLASS                  (o)
    GType               gog_view_get_type                   (void);
    GogObject*          gog_view_get_model                  (GogView const *view);
    void                gog_view_render                     (GogView *view,
                                                             GogViewAllocation const *bbox);
    void                gog_view_queue_redraw               (GogView *view);
    void                gog_view_queue_resize               (GogView *view);
    void                gog_view_padding_request            (GogView *view,
                                                             GogViewAllocation const *bbox,
                                                             GogViewPadding *padding);
    void                gog_view_size_request               (GogView *view,
                                                             GogViewRequisition const *available,
                                                             GogViewRequisition *requisition);
    void                gog_view_size_allocate              (GogView *view,
                                                             GogViewAllocation const *allocation);
    gboolean            gog_view_update_sizes               (GogView *view);
    GogView*            gog_view_find_child_view            (GogView const *container,
                                                             GogObject const *target_model);
    GSListconst	*       gog_view_get_toolkit                (GogView *view);
    void                gog_view_render_toolkit             (GogView *view);
    GogTool*            gog_view_get_tool_at_point          (GogView *view,
                                                             double x,
                                                             double y,
                                                             GogObject **gobj);
    GogView*            gog_view_get_view_at_point          (GogView *view,
                                                             double x,
                                                             double y,
                                                             GogObject **obj,
                                                             GogTool **tool);
    void                gog_view_size_child_request         (GogView *view,
                                                             GogViewRequisition const *available,
                                                             GogViewRequisition *req,
                                                             GogViewRequisition *min_req);

## Object Hierarchy

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

## Properties

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

## Description

## Details

### GogToolAction

    typedef struct {
    	double 		 start_x, start_y;
    	GogView 	*view;
    	GogTool 	*tool;
    	gpointer	 data;
    } GogToolAction;

### GogTool

    typedef struct {
    	char const 	*name;

    	/* GdkCursorType	 cursor_type; Not compatible with --without-gtk */
    	int	 	cursor_type;

    	gboolean 	(*point) 	(GogView *view, double x, double y, GogObject **object);
    	void 		(*render)	(GogView *view);
    	void 		(*init)		(GogToolAction *action);
    	void 		(*move)		(GogToolAction *action, double x, double y);
    	void		(*double_click)	(GogToolAction *action);
    	void 		(*destroy)	(GogToolAction *action);
    } GogTool;

### gog_tool_action_new ()

    GogToolAction*      gog_tool_action_new                 (GogView *view,
                                                             GogTool *tool,
                                                             double x,
                                                             double y);

`view` : |
`tool` : |
`x` : |
`y` : |
Returns : |

### gog_tool_action_move ()

    void                gog_tool_action_move                (GogToolAction *action,
                                                             double x,
                                                             double y);

`action` : |
`x` : |
`y` : |

### gog_tool_action_double_click ()

    void                gog_tool_action_double_click        (GogToolAction *action);

`action` : |

### gog_tool_action_free ()

    void                gog_tool_action_free                (GogToolAction *action);

`action` : |

### GogView

    typedef struct _GogView GogView;

### GOG_VIEW_TYPE

    #define GOG_VIEW_TYPE		(gog_view_get_type ())

### GOG_VIEW()

    #define GOG_VIEW(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), GOG_VIEW_TYPE, GogView))

`o` : |

### IS_GOG_VIEW()

    #define IS_GOG_VIEW(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), GOG_VIEW_TYPE))

`o` : |

### GOG_VIEW_CLASS()

    #define GOG_VIEW_CLASS(k)	(G_TYPE_CHECK_CLASS_CAST ((k), GOG_VIEW_TYPE, GogViewClass))

`k` : |

### IS_GOG_VIEW_CLASS()

    #define IS_GOG_VIEW_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), GOG_VIEW_TYPE))

`k` : |

### GOG_VIEW_GET_CLASS()

    #define GOG_VIEW_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GOG_VIEW_TYPE, GogViewClass))

`o` : |

### gog_view_get_type ()

    GType               gog_view_get_type                   (void);

Returns : |

### gog_view_get_model ()

    GogObject*          gog_view_get_model                  (GogView const *view);

`view` : |
Returns : |

### gog_view_render ()

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

`view` : |
`bbox` : |

### 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_padding_request ()

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

`view` : |
`bbox` : |
`padding` : |

### 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_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_update_sizes ()

    gboolean            gog_view_update_sizes               (GogView *view);

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

### 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.

### gog_view_get_toolkit ()

    GSListconst	*       gog_view_get_toolkit                (GogView *view);

`view` : | GogView
Returns : | toolkit associated with given view.

### gog_view_render_toolkit ()

    void                gog_view_render_toolkit             (GogView *view);

Render toolkit elements.

`view` : | GogView

### gog_view_get_tool_at_point ()

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

Find tool under cursor for a given view.

`view` : | GogView
`x` : |
`y` : |
`gobj` : |
Returns : |

### 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
`tool` : | pointed tool
Returns : | the GogView at x,y position

### 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

## Property Details

### The `"model"` property

      "model"                    GogObject*            : Write

The GogObject this view displays.

### The `"parent"` property

      "parent"                   GogView*              : Write

the GogView parent.