## RenderingWindow

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

## Synopsis

                        RenderingWindow;
    GtkWidget*          renderingWindow_new                 (char *windowRef,
                                                             char *window_name,
                                                             char *class_name,
                                                             int width,
                                                             int height);
    void                renderingWindowSet_pickEventListener
                                                            (RenderingWindow *window);
    void                renderingWindowSet_observeEventListener
                                                            (RenderingWindow *window);
    void                renderingWindowSet_interactiveHandlers
                                                            (RenderingWindow *window,
                                                             VisuInteractive *inter);
    void                renderingWindowStop_defaultIneractiveMode
                                                            (RenderingWindow *window);
    void                renderingWindowStart_defaultIneractiveMode
                                                            (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);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkWidget
                         +----GtkContainer
                               +----GtkBin
                                     +----GtkWindow
                                           +----RenderingWindow

## Implemented Interfaces

RenderingWindow implements AtkImplementorIface and GtkBuildable.

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

### RenderingWindow

    typedef struct _RenderingWindow RenderingWindow;

Short form for a RenderingWindow_struct structure.

### renderingWindow_new ()

    GtkWidget*          renderingWindow_new                 (char *windowRef,
                                                             char *window_name,
                                                             char *class_name,
                                                             int width,
                                                             int height);

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

`windowRef` : | the title of the window ;
`window_name` : | the name of the window ;
`class_name` : | the class of the window ;
`width` : | its desired width ;
`height` : | its desired height.
Returns : | a newly created RenderingWindow widget.

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

### renderingWindowSet_interactiveHandlers ()

    void                renderingWindowSet_interactiveHandlers
                                                            (RenderingWindow *window,
                                                             VisuInteractive *inter);

Define the callback routines used when an action (clic, drag...) is done.

`window` : | a valid RenderingWindow object ;
`inter` : | a valid VisuInteractive object.

### renderingWindowStop_defaultIneractiveMode ()

    void                renderingWindowStop_defaultIneractiveMode
                                                            (RenderingWindow *window);

Stop all default interactive mode.

`window` : | a valid RenderingWindow object.

### renderingWindowStart_defaultIneractiveMode ()

    void                renderingWindowStart_defaultIneractiveMode
                                                            (RenderingWindow *window);

Start all default interactive mode. It doesn't work if the default interactive mode has been stopped by `renderingWindowBlock_defaultIneractiveMode()`. Use `renderingWindowUnblock_defaultIneractiveMode()` instead to restart it.

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

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