## RenderingWindow RenderingWindow — Defines a complex widget used to render files and print information. |

## Synopsis

    #define             RENDERING_WINDOW_ID

                        RenderingWindow;
    GtkWidget*          renderingWindow_new                 (int width,
                                                             int height,
                                                             gboolean withFrame,
                                                             gboolean withToolBar);
    GtkWidget*          renderingWindow_newEmbedded         (int width,
                                                             int height);
    void                renderingWindowSet_panel            (RenderingWindow *window,
                                                             GtkWidget *panel);
    void                renderingWindowSet_pickEventListener
                                                            (RenderingWindow *window);
    void                renderingWindowSet_observeEventListener
                                                            (RenderingWindow *window);
    void                renderingWindowBlock_defaultIneractiveMode
                                                            (RenderingWindow *window);
    void                renderingWindowUnblock_defaultIneractiveMode
                                                            (RenderingWindow *window);
    void                renderingWindowRemove_interactiveEventListener
                                                            (RenderingWindow *window);
    void                renderingWindowGet_openGLAreaSize   (RenderingWindow *window,
                                                             unsigned int *width,
                                                             unsigned int *height);
    void                renderingWindowPush_message         (RenderingWindow *window,
                                                             gchar *message);
    void                renderingWindowPop_message          (RenderingWindow *window);
    GdkPixbuf*          renderingWindowGet_backgroundImage  (RenderingWindow *window,
                                                             guchar **rowData,
                                                             gboolean *hasAlphaChannel,
                                                             int *width,
                                                             int *height);
    void                renderingWindowFree_backgroundImage (RenderingWindow *window);
    void                renderingWindowLoad_file            (RenderingWindow *window,
                                                             GtkWindow *parent);
    gboolean            renderingWindowDump                 (RenderingWindow *window,
                                                             DumpType *format,
                                                             const char *fileName,
                                                             gint width,
                                                             gint height,
                                                             GError **error,
                                                             voidDataFunc functionWait,
                                                             gpointer data);
    void                renderingWindowRedraw               (RenderingWindow *window,
                                                             gboolean forceRedraw);
    void                renderingWindowSet_current          (RenderingWindow *window,
                                                             gboolean force);
    void                renderingWindowSet_visuData         (RenderingWindow *window,
                                                             VisuData *data);
    VisuData*           renderingWindowGet_visuData         (RenderingWindow *window);

## Description

This is a complex widget, inheriting from GtkWindow, with a rendering area and a status bar area. A VisuData is always attached to this widget, see `renderingWindowSet_visuData()`. If not the V_Sim logo is displayed.

The rendering area can receive keyboard or mouse events, see `renderingWindowSet_pickEventListener()` or `renderingWindowSet_observeEventListener()`. Then, callbacks are defined using `renderingWindowSet_interactiveHandlers()`.

The status bar area has different buttons to load or export a file. It also display some usefull information like the number of rendered nodes. It has also a real status bar location displaying tips about current available actions. One can add news using `renderingWindowPush_message()`.

## Details

### RENDERING_WINDOW_ID

    #define RENDERING_WINDOW_ID "ContainerWindow"

The key to get the embedding GtkWindow of a given RenderingWindow widget, if any. See `renderingWindow_newEmbedded()`.

### RenderingWindow

    typedef struct _RenderingWindow RenderingWindow;

Short form for a RenderingWindow_struct structure.

### renderingWindow_new ()

    GtkWidget*          renderingWindow_new                 (int width,
                                                             int height,
                                                             gboolean withFrame,
                                                             gboolean withToolBar);

A RenderingWindow widget is a GtkWindow that have an area for OpenGL drawing and a statusBar with many stuff like action buttons, real status bar for notifications, ... The rendering area can be drawn with a frame or not. With this routine, only the RenderingWindow widget is created. To embed it into a window automatically, use `renderingWindow_newEmbedded()` instead.

`width` : | its desired width ;
`height` : | its desired height ;
`withFrame` : | a boolean.
Returns : | a newly created RenderingWindow widget.

### renderingWindow_newEmbedded ()

    GtkWidget*          renderingWindow_newEmbedded         (int width,
                                                             int height);

Like `renderingWindow_new()` but create also a GtkWindow to go around. This widget is reachable using `g_object_get_data()` with the key RENDERING_WINDOW_ID. In that case, no frame is drawn around the rendering area.

`width` : | its desired width ;
`height` : | its desired height.
Returns : | a newly created RenderingWindow widget.

### renderingWindowSet_panel ()

    void                renderingWindowSet_panel            (RenderingWindow *window,
                                                             GtkWidget *panel);

If `panel` is not NULL, the given `panel` is considered as the "parent" window of the rendering area. A raise button is then available to link the `panel` and `window`.

`window` : | a valid RenderingWindow object ;
`panel` : | a GtkWidget.

Since 3.5

### renderingWindowSet_pickEventListener ()

    void                renderingWindowSet_pickEventListener
                                                            (RenderingWindow *window);

Bring up the interactive mode listeners (clic, drag...) for pick mode.

`window` : | a valid RenderingWindow object.

### renderingWindowSet_observeEventListener ()

    void                renderingWindowSet_observeEventListener
                                                            (RenderingWindow *window);

Bring up the interactive mode listeners (clic, drag...) for observe mode.

`window` : | a valid RenderingWindow object.

### renderingWindowBlock_defaultIneractiveMode ()

    void                renderingWindowBlock_defaultIneractiveMode
                                                            (RenderingWindow *window);

Stop all default interactive mode and prevent tem to restart until `renderingWindowUnblock_defaultIneractiveMode()` is called.

`window` : | a valid RenderingWindow object.

### renderingWindowUnblock_defaultIneractiveMode ()

    void                renderingWindowUnblock_defaultIneractiveMode
                                                            (RenderingWindow *window);

Unblock and start the default interactive mode.

`window` : | a valid RenderingWindow object.

### renderingWindowRemove_interactiveEventListener ()

    void                renderingWindowRemove_interactiveEventListener
                                                            (RenderingWindow *window);

Remove all the store signals used for the interactive mode.

`window` : | a valid RenderingWindow object.

### renderingWindowGet_openGLAreaSize ()

    void                renderingWindowGet_openGLAreaSize   (RenderingWindow *window,
                                                             unsigned int *width,
                                                             unsigned int *height);

Retrieve the size of the OpenGL area (not the size of the rendering window).

`window` : | a valid RenderingWindow object ;
`width` : | a location to store the width ;
`height` : | a location to store the height.

### renderingWindowPush_message ()

    void                renderingWindowPush_message         (RenderingWindow *window,
                                                             gchar *message);

Use this method to add some informations on the status bar.

`window` : | a valid RenderingWindow object ;
`message` : | an UTF8 string to print on the status bar.

### renderingWindowPop_message ()

    void                renderingWindowPop_message          (RenderingWindow *window);

Remove the last message.

`window` : | a valid RenderingWindow object.

### renderingWindowGet_backgroundImage ()

    GdkPixbuf*          renderingWindowGet_backgroundImage  (RenderingWindow *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 valid RenderingWindow object ;
`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 GdkPixbuf that is own by the `window` object. his image stay in memory until a call to `renderigWindowFree_backgroundImage()` occurs.

### renderingWindowFree_backgroundImage ()

    void                renderingWindowFree_backgroundImage (RenderingWindow *window);

Free loaded background image if exists.

`window` : | a valid RenderingWindow object.

### renderingWindowLoad_file ()

    void                renderingWindowLoad_file            (RenderingWindow *window,
                                                             GtkWindow *parent);

Do as if the load button has been pushed, i.e. open a filechooser dialog on the `parent` window, and load the resulting file, refreshing the view if necessary.

`window` : | the window the file will by rendered on ;
`parent` : | the parent window for the filechooser dialog.

### renderingWindowDump ()

    gboolean            renderingWindowDump                 (RenderingWindow *window,
                                                             DumpType *format,
                                                             const char *fileName,
                                                             gint width,
                                                             gint height,
                                                             GError **error,
                                                             voidDataFunc functionWait,
                                                             gpointer data);

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

`window` : | a valid RenderingWindow object ;
`format` : | a DumpType object, corresponding to the write method ;
`fileName` : | a string that defined the file to write to ;
`width` : | an integer ;
`height` : | an integer ;
`error` : | a location to store some error (not NULL) ;
`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.

### renderingWindowRedraw ()

    void                renderingWindowRedraw               (RenderingWindow *window,
                                                             gboolean forceRedraw);

Update the OpenGL area of the rendering window if the opengl option is set to immediate. If not, use `forceRedraw` to redraw.

`window` : | a valid RenderingWindow object ;
`forceRedraw` : | a boolean.

### renderingWindowSet_current ()

    void                renderingWindowSet_current          (RenderingWindow *window,
                                                             gboolean force);

Set the OpenGL area as the current rendering area. If `force` is TRUE then the context is switched whatever buffered value.

`window` : | a valid RenderingWindow object ;
`force` : | a boolean.

Since 3.5

### renderingWindowSet_visuData ()

    void                renderingWindowSet_visuData         (RenderingWindow *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 valid RenderingWindow object ;
`data` : | a VisuData to render in the given `window` (can be NULL).

### renderingWindowGet_visuData ()

    VisuData*           renderingWindowGet_visuData         (RenderingWindow *window);

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

`window` : | a valid RenderingWindow object.
Returns : | the VisuData attached to the `window` or NULL if none.