## GcrViewer GcrViewer — A viewer which can hold renderers |

## Functions

GcrViewer * | gcr_viewer_new ()
GcrViewer * | gcr_viewer_new_scrolled ()
void | gcr_viewer_add_renderer ()
void | gcr_viewer_insert_renderer ()
void | gcr_viewer_remove_renderer ()
guint | gcr_viewer_count_renderers ()
GcrRenderer * | gcr_viewer_get_renderer ()

## Types and Values

| GcrViewer
struct | GcrViewerIface

## Object Hierarchy

        GInterface
        ╰── GcrViewer

## Prerequisites

GcrViewer requires GtkWidget.

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

## Functions

### 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()`.

[transfer full]

### 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 GcrViewer which is also a GtkWidget.

[transfer floating]

### gcr_viewer_add_renderer ()

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

Add a renderer to this viewer.

#### Parameters

viewer | The viewer |
renderer | The renderer to add |

### gcr_viewer_insert_renderer ()

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

Insert a renderer at a specific point in the viewer

#### Parameters

viewer | the viewer |
renderer | the renderer to insert |
before | the renderer to insert before. | [allow-none]

### gcr_viewer_remove_renderer ()

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

Remove a renderer from this viewer.

#### Parameters

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.

#### Parameters

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.

#### Parameters

viewer | The viewer |
index_ | The index of the renderer to get |

#### Returns

the render, owned by the viewer.

[transfer none]

## Types and Values

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

#### Members

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 |