## GOComponent

GOComponent

## Synopsis

                        GOComponent;
                        GOComponentClass;
    void                (*GOComponentSaxHandler)            (GOComponent *component,
                                                             gpointer user_data);
    enum                GOSnapshotType;
    GOSnapshotType      go_component_build_snapshot         (GOComponent *component);
    GOComponent *       go_component_duplicate              (GOComponent const *component);
    GtkWindow *         go_component_edit                   (GOComponent *component);
    void                go_component_emit_changed           (GOComponent *component);
    gboolean            go_component_export_image           (GOComponent *component,
                                                             GOImageFormat format,
                                                             GsfOutput *output,
                                                             double x_dpi,
                                                             double y_dpi);
    GOCmdContext *      go_component_get_command_context    (GOComponent *component);
    gboolean            go_component_get_data               (GOComponent *component,
                                                             gpointer *data,
                                                             int *length,
                                                             GDestroyNotify *clearfunc,
                                                             gpointer *user_data);
    gboolean            go_component_get_inline             (GOComponent *component);
    char const *        go_component_get_mime_type          (GOComponent *component);
    void                go_component_get_size               (GOComponent *component,
                                                             double *width,
                                                             double *height);
    void const *        go_component_get_snapshot           (GOComponent *component,
                                                             GOSnapshotType *type,
                                                             size_t *length);
    gboolean            go_component_get_use_font_from_app  (GOComponent *component);
    gboolean            go_component_is_editable            (GOComponent *component);
    gboolean            go_component_is_resizable           (GOComponent *component);
    GOComponent *       go_component_new_by_mime_type       (char const *mime_type);
    GOComponent *       go_component_new_from_uri           (char const *uri);
    void                go_component_render                 (GOComponent *component,
                                                             cairo_t *cr,
                                                             double width,
                                                             double height);
    void                go_component_sax_push_parser        (GsfXMLIn *xin,
                                                             xmlChar const **attrs,
                                                             GOComponentSaxHandler handler,
                                                             gpointer user_data);
    void                go_component_set_command_context    (GOComponent *component,
                                                             GOCmdContext *cc);
    void                go_component_set_data               (GOComponent *component,
                                                             char const *data,
                                                             int length);
    void                go_component_set_default_command_context
                                                            (GOCmdContext *cc);
    void                go_component_set_default_size       (GOComponent *component,
                                                             double width,
                                                             double ascent,
                                                             double descent);
    gboolean            go_component_set_font               (GOComponent *component,
                                                             PangoFontDescription const *desc);
    void                go_component_set_inline             (GOComponent *component,
                                                             gboolean is_inline);
    void                go_component_set_size               (GOComponent *component,
                                                             double width,
                                                             double height);
    void                go_component_set_window             (GOComponent *component,
                                                             GdkWindow *window);
    void                go_component_set_use_font_from_app  (GOComponent *component,
                                                             gboolean use_font_from_app);
    void                go_component_stop_editing           (GOComponent *component);
    void                go_component_write_xml_sax          (GOComponent *component,
                                                             GsfXMLOut *output);

## Object Hierarchy

      GObject
       +----GOComponent

## Properties

      "ascent"                   gdouble               : Read / Write
      "descent"                  gdouble               : Read / Write
      "height"                   gdouble               : Read
      "inline"                   gboolean              : Read / Write
      "mime-type"                gchar*                : Read / Write / Construct Only
      "width"                    gdouble               : Read / Write

## Signals

      "changed"                                        : Run Last

## Description

## Details

### GOComponent

    typedef struct _GOComponent GOComponent;

### GOComponentClass

    typedef struct {
    	GObjectClass parent_class;

    	GtkWindow* (*edit) (GOComponent *component);
    	gboolean (*get_data) (GOComponent *component, gpointer *data, int *length,
    			      GDestroyNotify *clearfunc, gpointer *user_data);
    	void (*mime_type_set) (GOComponent* component);
    	void (*set_data) (GOComponent *component);
    	void (*set_default_size) (GOComponent* component);
    	void (*set_size) (GOComponent *component);
    	void (*render) (GOComponent *component, cairo_t *cr,
    			    double width, double height);
    	gboolean (*set_font) (GOComponent *component, PangoFontDescription const *desc);
    } GOComponentClass;

The component base object class.

GObjectClass `parent_class`; | the parent object class.
`edit` () | callback for component edition.
`get_data` () | returns the data embedded in the component.
`mime_type_set` () | sets the mime type.
`set_data` () | sets the data embedded in the component.
`set_default_size` () | sets the default size for the component.
`set_size` () | sets the requested size.
`render` () | displays the contents.
`set_font` () | sets the default font for the component.

### GOComponentSaxHandler ()

    void                (*GOComponentSaxHandler)            (GOComponent *component,
                                                             gpointer user_data);

### enum GOSnapshotType

    typedef enum {
    	GO_SNAPSHOT_NONE,
    	GO_SNAPSHOT_SVG,
    	GO_SNAPSHOT_PNG,
    } GOSnapshotType;

`GO_SNAPSHOT_NONE` | no snapshot.
`GO_SNAPSHOT_SVG` | svg snapshot.
`GO_SNAPSHOT_PNG` | png snapshot.

### go_component_build_snapshot ()

    GOSnapshotType      go_component_build_snapshot         (GOComponent *component);

### go_component_duplicate ()

    GOComponent *       go_component_duplicate              (GOComponent const *component);

Duplicates the component.

`component` : | a GOComponent
Returns : | the duplicated component. [transfer full]

### go_component_edit ()

    GtkWindow *         go_component_edit                   (GOComponent *component);

Opens a top level window editor for the component if it can be edited.

`component` : | GOComponent
Returns : | the editor window or NULL. [transfer none]

### go_component_emit_changed ()

    void                go_component_emit_changed           (GOComponent *component);

### go_component_export_image ()

    gboolean            go_component_export_image           (GOComponent *component,
                                                             GOImageFormat format,
                                                             GsfOutput *output,
                                                             double x_dpi,
                                                             double y_dpi);

Exports an image of `graph` in given `format`, writing results in a GsfOutput stream. If export format type is a bitmap one, it computes image size with x_dpi, y_dpi and `graph` size (see ``gog_graph_get_size()``).

`component` : | a GOComponent
`format` : | image format for export
`output` : | a GsfOutput stream
`x_dpi` : | x resolution of exported graph
`y_dpi` : | y resolution of exported graph
Returns : | `TRUE` if export succeed.

### go_component_get_command_context ()

    GOCmdContext *      go_component_get_command_context    (GOComponent *component);

`component` : | GOComponent
Returns : | the command context used by the component or the default command context if the argument is NULL. [transfer none]

### go_component_get_data ()

    gboolean            go_component_get_data               (GOComponent *component,
                                                             gpointer *data,
                                                             int *length,
                                                             GDestroyNotify *clearfunc,
                                                             gpointer *user_data);

### go_component_get_inline ()

    gboolean            go_component_get_inline             (GOComponent *component);

Returns the in-line or not nature of the component.

`component` : | a GOComponent
Returns : | whether the component is displayed in-line

### go_component_get_mime_type ()

    char const *        go_component_get_mime_type          (GOComponent *component);

### go_component_get_size ()

    void                go_component_get_size               (GOComponent *component,
                                                             double *width,
                                                             double *height);

### go_component_get_snapshot ()

    void const *        go_component_get_snapshot           (GOComponent *component,
                                                             GOSnapshotType *type,
                                                             size_t *length);

Returns a snapshot is either svg or png format for the component.

`component` : | GOComponent
`type` : | GOSnapshotType
`length` : | where to store the data length
Returns : | the snapshot as an arry of bytes. [transfer none]

### go_component_get_use_font_from_app ()

    gboolean            go_component_get_use_font_from_app  (GOComponent *component);

Returns whether the component should use the font from the calling application or use its own font.

`component` : | a GOComponent
Returns : | whether the component should use the font from the calling application

### go_component_is_editable ()

    gboolean            go_component_is_editable            (GOComponent *component);

### go_component_is_resizable ()

    gboolean            go_component_is_resizable           (GOComponent *component);

### go_component_new_by_mime_type ()

    GOComponent *       go_component_new_by_mime_type       (char const *mime_type);

### go_component_new_from_uri ()

    GOComponent *       go_component_new_from_uri           (char const *uri);

### go_component_render ()

    void                go_component_render                 (GOComponent *component,
                                                             cairo_t *cr,
                                                             double width,
                                                             double height);

### go_component_sax_push_parser ()

    void                go_component_sax_push_parser        (GsfXMLIn *xin,
                                                             xmlChar const **attrs,
                                                             GOComponentSaxHandler handler,
                                                             gpointer user_data);

Loads the component from the xml stream. `handler` will be called when done.

`xin` : | GsfInput
`attrs` : | the current node attributes.
`handler` : | GOComponentSaxHandler. [scope call]
`user_data` : | data to pass to `handler`

### go_component_set_command_context ()

    void                go_component_set_command_context    (GOComponent *component,
                                                             GOCmdContext *cc);

### go_component_set_data ()

    void                go_component_set_data               (GOComponent *component,
                                                             char const *data,
                                                             int length);

### go_component_set_default_command_context ()

    void                go_component_set_default_command_context
                                                            (GOCmdContext *cc);

### go_component_set_default_size ()

    void                go_component_set_default_size       (GOComponent *component,
                                                             double width,
                                                             double ascent,
                                                             double descent);

### go_component_set_font ()

    gboolean            go_component_set_font               (GOComponent *component,
                                                             PangoFontDescription const *desc);

Sets the font the component should use. Not all components will actually changed the font they use.

`component` : | GOComponent
`desc` : | PangoFontDescription
Returns : | `TRUE` if size changed.

### go_component_set_inline ()

    void                go_component_set_inline             (GOComponent *component,
                                                             gboolean is_inline);

Sets the in-line or not nature of the component. Default is `FALSE`.

`component` : | a GOComponent
`is_inline` : | whether the component should be displayed in-line

### go_component_set_size ()

    void                go_component_set_size               (GOComponent *component,
                                                             double width,
                                                             double height);

### go_component_set_window ()

    void                go_component_set_window             (GOComponent *component,
                                                             GdkWindow *window);

### go_component_set_use_font_from_app ()

    void                go_component_set_use_font_from_app  (GOComponent *component,
                                                             gboolean use_font_from_app);

Sets the source of the font that the component should use. Default is `FALSE`.

`component` : | a GOComponent
`use_font_from_app` : | whether the component should use the font from the calling application or use its own font.

### go_component_stop_editing ()

    void                go_component_stop_editing           (GOComponent *component);

### go_component_write_xml_sax ()

    void                go_component_write_xml_sax          (GOComponent *component,
                                                             GsfXMLOut *output);

## Property Details

### The `"ascent"` property

      "ascent"                   gdouble               : Read / Write

Component ascent.

Allowed values: >= 0

Default value: 0

### The `"descent"` property

      "descent"                  gdouble               : Read / Write

Component descent.

Allowed values: >= 0

Default value: 0

### The `"height"` property

      "height"                   gdouble               : Read

Component height.

Allowed values: >= 0

Default value: 0

### The `"inline"` property

      "inline"                   gboolean              : Read / Write

Whether the component should be displayed in-line.

Default value: FALSE

### The `"mime-type"` property

      "mime-type"                gchar*                : Read / Write / Construct Only

mime type of the content of the component.

Default value: NULL

### The `"width"` property

      "width"                    gdouble               : Read / Write

Component width.

Allowed values: >= 0

Default value: 0

## Signal Details

### The `"changed"` signal

    void                user_function                      (GOComponent *gocomponent,
                                                            gpointer     user_data)        : Run Last

`gocomponent` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.