## GcrViewer

GcrViewer — A viewer which can hold renderers

## Synopsis

                        GcrViewer;
    struct              GcrViewerIface;
    GcrViewer *         gcr_viewer_new                      (void);
    GcrViewer *         gcr_viewer_new_scrolled             (void);
    void                gcr_viewer_add_renderer             (GcrViewer *viewer,
                                                             GcrRenderer *renderer);
    void                gcr_viewer_insert_renderer          (GcrViewer *viewer,
                                                             GcrRenderer *renderer,
                                                             GcrRenderer *before);
    void                gcr_viewer_remove_renderer          (GcrViewer *viewer,
                                                             GcrRenderer *renderer);
    guint               gcr_viewer_count_renderers          (GcrViewer *viewer);
    GcrRenderer *       gcr_viewer_get_renderer             (GcrViewer *viewer,
                                                             guint index_);

## Description

A GcrViewer is an abstract interface that represents a widget that can hold various renderers and display their contents.

The interaction between GcrRenderer and GcrViewer is not stable yet, and so viewers cannot be implemented outside the Gcr library at this time.

Use the `gcr_viewer_new()` and `gcr_viewer_new_scrolled()` to get default implementations of viewers.

## Details

### GcrViewer

    typedef struct _GcrViewer GcrViewer;

An abstract viewer which displays renderers contents.

### struct GcrViewerIface

    struct GcrViewerIface {
    	GTypeInterface parent;

    	void (*add_renderer) (GcrViewer *viewer,
    	                      GcrRenderer *renderer);

    	void (*insert_renderer) (GcrViewer *viewer,
    	                         GcrRenderer *renderer,
    	                         GcrRenderer *before);

    	void (*remove_renderer) (GcrViewer *viewer,
    	                         GcrRenderer *renderer);

    	guint (*count_renderers) (GcrViewer *viewer);

    	GcrRenderer* (*get_renderer) (GcrViewer *viewer,
    	                              guint index_);
    };

The interface for GcrViewer

GTypeInterface `parent`; | The parent interface
`add_renderer` () | Virtual method to add a renderer
`insert_renderer` () | Virtual method to insert a renderer
`remove_renderer` () | Virtual method to remove a renderer
`count_renderers` () | Virtual method to count renderers
`get_renderer` () | Virtual method to get a renderer

### gcr_viewer_new ()

    GcrViewer *         gcr_viewer_new                      (void);

Get an implementation of GcrViewer that supports a view of multiple renderers.

Returns : | A newly allocated GcrViewer, which should be released with `g_object_unref()`

### gcr_viewer_new_scrolled ()

    GcrViewer *         gcr_viewer_new_scrolled             (void);

Get an implementation of GcrViewer that supports a scrolled view of multiple renderers.

Returns : | A newly allocated GcrViewer, which should be released with `g_object_unref()`

### gcr_viewer_add_renderer ()

    void                gcr_viewer_add_renderer             (GcrViewer *viewer,
                                                             GcrRenderer *renderer);

Add a renderer to this viewer.

`viewer` : | The viewer
`renderer` : | The renderer to add

### gcr_viewer_insert_renderer ()

    void                gcr_viewer_insert_renderer          (GcrViewer *viewer,
                                                             GcrRenderer *renderer,
                                                             GcrRenderer *before);

### gcr_viewer_remove_renderer ()

    void                gcr_viewer_remove_renderer          (GcrViewer *viewer,
                                                             GcrRenderer *renderer);

Remove a renderer from this viewer.

`viewer` : | The viewer
`renderer` : | The renderer to remove

### gcr_viewer_count_renderers ()

    guint               gcr_viewer_count_renderers          (GcrViewer *viewer);

Get the number of renderers present in the viewer.

`viewer` : | The viewer
Returns : | The number of renderers.

### gcr_viewer_get_renderer ()

    GcrRenderer *       gcr_viewer_get_renderer             (GcrViewer *viewer,
                                                             guint index_);

Get a pointer to the renderer at the given index. It is an error to request an index that is out of bounds.

`viewer` : | The viewer
`index_` : | The index of the renderer to get
Returns : | The render, owned by the viewer.