## visu_windowInterface

visu_windowInterface —

## Synopsis

    typedef     GenericRenderingWindow;
    int         initRenderingWindow             (char *windowRef,
                                                 char *iconRef,
                                                 char *window_name,
                                                 char *class_name,
                                                 int width,
                                                 int height);
    GList*      setObserveEventListener         (GenericRenderingWindow window,
                                                 CallbackFunctions *userCallbacks);
    GList*      setPickEventListener            (GenericRenderingWindow window,
                                                 CallbackFunctions *userCallbacks);
    void        removeEventListener             (GenericRenderingWindow window,
                                                 GList *listId);
    void        checkWindowSize                 (GenericRenderingWindow window,
                                                 unsigned int *width,
                                                 unsigned int *height);
    void        raiseRenderWindow               (GenericRenderingWindow window);
    void        rename_window                   (GenericRenderingWindow window,
                                                 char *nom);
    void        visuRenderingWindowFree_backgroundImage
                                                (GenericRenderingWindow window,
                                                 gpointer image);
    gpointer    visuRenderingWindowGet_backgroundImage
                                                (GenericRenderingWindow window,
                                                 guchar **rowData,
                                                 gboolean *hasAlphaChannel,
                                                 int *width,
                                                 int *height);
    GenericRenderingWindow visuRenderingWindowGet_current
                                                ();
    void        visuRenderingWindowGet_backgroundColor
                                                (GenericRenderingWindow window,
                                                 float rgb[3]);
    VisuData*   visuRenderingWindowGet_visuData (GenericRenderingWindow window);
    void        visuRenderingWindowSet_visuData (GenericRenderingWindow window,
                                                 VisuData *data);
    gboolean    visuRenderingWindowDump         (GenericRenderingWindow window,
                                                 DumpType *format,
                                                 GString *buffer,
                                                 char *fileName,
                                                 gint width,
                                                 gint height,
                                                 voidDataFunc functionWait,
                                                 gpointer data);

## Description

## Details

### GenericRenderingWindow

    typedef gpointer GenericRenderingWindow;

This is an alias to store a pointer to the object that represent the redering window. If the window is rendered by GTK, for instance, GenericRenderingWindow is equivalent to a RenderingWindow object.

### initRenderingWindow ()

    int         initRenderingWindow             (char *windowRef,
                                                 char *iconRef,
                                                 char *window_name,
                                                 char *class_name,
                                                 int width,
                                                 int height);

`windowRef` : |
`iconRef` : |
`window_name` : |
`class_name` : |
`width` : |
`height` : |
Returns : |

### setObserveEventListener ()

    GList*      setObserveEventListener         (GenericRenderingWindow window,
                                                 CallbackFunctions *userCallbacks);

Bring up the interactive mode listeners (clic, drag...) for observe mode and connect then to the given methods pointed by `userCallbacks`.

`window` : | a pointer on a valid rendering window object (see RenderingWindow if GTK is used for rendering) ;
`userCallbacks` : | methods to be called depending on listeners.
Returns : | a list of signal ID. This list is empty if GTK is used for rendering since it is stored internally in the RenderingWindow object.

### setPickEventListener ()

    GList*      setPickEventListener            (GenericRenderingWindow window,
                                                 CallbackFunctions *userCallbacks);

Bring up the interactive mode listeners (clic, drag...) for pick mode and connect then to the given methods pointed by `userCallbacks`.

`window` : | a pointer on a valid rendering window object (see RenderingWindow if GTK is used for rendering) ;
`userCallbacks` : | methods to be called depending on listeners.
Returns : | a list of signal ID. This list is empty if GTK is used for rendering since it is stored internally in the RenderingWindow object.

### removeEventListener ()

    void        removeEventListener             (GenericRenderingWindow window,
                                                 GList *listId);

Remove all listeners responsible for the interactive mode.

`window` : | a pointer on a valid rendering window object (see RenderingWindow if GTK is used for rendering) ;
`listId` : | a GList of guint callbacks id to be removed (useless if GTK is used for rendering since tis list is stored internally in the widget.

### checkWindowSize ()

    void        checkWindowSize                 (GenericRenderingWindow window,
                                                 unsigned int *width,
                                                 unsigned int *height);

Get the rendering window size by asking the X server.

`window` : | a pointer on a valid rendering window object (see RenderingWindow if GTK is used for rendering) ;
`width` : | a pointer to store the width of the window ;
`height` : | a pointer to store the height of the window.

### raiseRenderWindow ()

    void        raiseRenderWindow               (GenericRenderingWindow window);

Ask the window manager to raise the given window.

`window` : | a pointer on a valid rendering window object (see RenderingWindow if GTK is used for rendering).

### rename_window ()

    void        rename_window                   (GenericRenderingWindow window,
                                                 char *nom);

Change the nam of the given window.

`window` : | a pointer on a valid rendering window object (see RenderingWindow if GTK is used for rendering).
`nom` : | a string, null terminated.

### visuRenderingWindowFree_backgroundImage ()

    void        visuRenderingWindowFree_backgroundImage
                                                (GenericRenderingWindow window,
                                                 gpointer image);

Free loaded image.

`window` : | a pointer on a valid rendering window object (see RenderingWindow if GTK is used for rendering) ;
`image` : | an opaque structure returned by `visuRenderigWindowGet_backgroundImage()`.

### visuRenderingWindowGet_backgroundImage ()

    gpointer    visuRenderingWindowGet_backgroundImage
                                                (GenericRenderingWindow window,
                                                 guchar **rowData,
                                                 gboolean *hasAlphaChannel,
                                                 int *width,
                                                 int *height);

Use this method to load an image in memory (according to GdkPixbuf specification) and retrieve the row data in memory.

`window` : | a pointer on a valid rendering window object (see RenderingWindow if GTK is used for rendering) ;
`rowData` : | a pointer to be set on the data in memory ;
`hasAlphaChannel` : | a pointer to store if the loaded iage has an alpha channel ;
`width` : | store the width ;
`height` : | store the height.
Returns : | a pointer to an opaque structure that must be freed after use by a call to visuRenderigWindowFree_backgroundImage:().

### visuRenderingWindowGet_current ()

    GenericRenderingWindow visuRenderingWindowGet_current
                                                ();

Method used to get a pointer to the current active window.

Returns : | a pointer to the current active window.

### visuRenderingWindowGet_backgroundColor ()

    void        visuRenderingWindowGet_backgroundColor
                                                (GenericRenderingWindow window,
                                                 float rgb[3]);

This method is used to retrieve the color of the rendering window, depending on its style (see v_sim.rc for example if the rendering window is monitored by GTK).

`window` : | a pointer on a valid rendering window object (see RenderingWindow if GTK is used for rendering) ;
`rgb` : | an allocated array of three floating point values.

### visuRenderingWindowGet_visuData ()

    VisuData*   visuRenderingWindowGet_visuData (GenericRenderingWindow window);

This method is used to get the VisuData attached to a window.

`window` : | a pointer on a valid rendering window object (see RenderingWindow if GTK is used for rendering).
Returns : | the VisuData attached to the `window` or NULL if none.

### visuRenderingWindowSet_visuData ()

    void        visuRenderingWindowSet_visuData (GenericRenderingWindow window,
                                                 VisuData *data);

This method is used to attach a VisuData object to a given window. When, `data` is not NULL, this method emit the dataReadyForRendering signal, and all modules that needs to draw something should catch this signal and draw in the rendering window. If `data` is NULL, the dataNotReadyForRendering is emitted instead.

`window` : | a pointer on a valid rendering window object (see RenderingWindow if GTK is used for rendering) ;
`data` : | a VisuData to render in the given `window`.

### visuRenderingWindowDump ()

    gboolean    visuRenderingWindowDump         (GenericRenderingWindow window,
                                                 DumpType *format,
                                                 GString *buffer,
                                                 char *fileName,
                                                 gint width,
                                                 gint height,
                                                 voidDataFunc functionWait,
                                                 gpointer data);

Call this method to dump the given `window` to a file.

`window` : | a pointer on a valid rendering window object (see RenderingWindow if GTK is used for rendering) ;
`format` : | a DumpType object, corresponding to the write method ;
`buffer` : | a GString to store some error (not NULL) ;
`fileName` : | a string that defined the file to write to ;
`width` : | an integer ;
`height` : | an integer ;
`functionWait` : | a method to call periodically during the dump ;
`data` : | some pointer on object to be passed to the wait function.
Returns : | TRUE if everything went right.