## gtk_main gtk_main |

## Synopsis

    gboolean            (*GtkMainSetFilesFunc)              (VisuData *data,
                                                             GtkWindow *parent);
    GtkWidget*          (*createGtkWidgetFunc)              (void);
    ToolPanel*          (*PanelInitFunc)                    ();
    #define             currentRenderingWindow

                        GtkMain;
                        GtkMainClass;

    GtkWidget*          gtkMainNew                          ();
    void                gtkMain_quit                        ();

    GtkMain*            gtkMainClassGet_currentPanel        ();
    gchar*              gtkMainClassGet_lastOpenDirectory   ();
    gboolean            gtkMainClassGet_rememberPosition    ();
    GtkMainSetFilesFunc gtkMainClassGet_renderingSpecificOpen
                                                            (RenderingMethod *method);
    void                gtkMainClassSet_currentPanel        (GtkMain *main);
    void                gtkMainClassSet_lastOpenDirectory   (char *directory);
    void                gtkMainClassSet_rememberPosition    (gboolean val);
    void                gtkMainClassSet_renderingSpecificMethods
                                                            (RenderingMethod *method,
                                                             GtkMainSetFilesFunc methodLoad);

## Description

## Details

### GtkMainSetFilesFunc ()

    gboolean            (*GtkMainSetFilesFunc)              (VisuData *data,
                                                             GtkWindow *parent);

Methods that conform to this prototype is used to set filename(s) to be loaded when the 'load' button is pushed. They can use a GtkFileChooser to prompt the user for file names.

`data` : | a VisuData to store the informations ;
`parent` : | the parent window of the dialog.
Returns : | FALSE if no filename as been set, TRUE if the calling method should call `gtkMainLoadAndRender_file()` with a g_idle_add method.

### createGtkWidgetFunc ()

    GtkWidget*          (*createGtkWidgetFunc)              (void);

This prototype is used whenever a method is required to create a GtkWidget.

Returns : | a newly created GtkWidget.

### PanelInitFunc ()

    ToolPanel*          (*PanelInitFunc)                    ();

Prototype of the functions used to initialise a new panel.

Returns : | a newly created ToolPanel.

### currentRenderingWindow

    #define currentRenderingWindow RENDERING_WINDOW(gtkMainClassGet_currentPanel()->renderingWindow)

TO BE REMOVED, do not use.

### GtkMain

    typedef struct {
      GtkWindow parent;

      /* Pointers on permanent windows. */
      GtkWidget *renderingWindow;

      GtkWidget *pairsDialog;

      GtkWidget *interactiveDialog;

      GtkWidget *aboutDialog;

      /* Private data. */
      GtkMain_private *private;
    } GtkMain;

This structure describes a GtkMain object.

GtkWindow `parent`; | the parent object, a GtkWindow here ;
GtkWidget *`renderingWindow`; | a pointer on the associated rendering window ;
GtkWidget *`pairsDialog`; | a pointer to the corresponding pair dialog, or NULL if not yet built ;
GtkWidget *`interactiveDialog`; | idem for the interactive dialog ;
GtkWidget *`aboutDialog`; | idem for the about dialog ;
GtkMain_private *`private`; | a pointer to the private data.

### GtkMainClass

    typedef struct _GtkMainClass GtkMainClass;

A short way to identify _GtkMainClass structure.

### gtkMainNew ()

    GtkWidget*          gtkMainNew                          ();

Create the command panel window and is dependencies, such as the associated rendering window... WARNING: some part are still currently static, so only once instance can be created at a time.

Returns : | a newly create command panel.

### gtkMain_quit ()

    void                gtkMain_quit                        ();

Quit the program. If the preference to have a confirm dialog is set, then it raises the little warning window before quiting (or not).

### gtkMainClassGet_currentPanel ()

    GtkMain*            gtkMainClassGet_currentPanel        ();

This routine can be used to get the command panel, everywhere from V_Sim.

Returns : | the command Panel.

### gtkMainClassGet_lastOpenDirectory ()

    gchar*              gtkMainClassGet_lastOpenDirectory   ();

V_Sim stores the last open directory to set the file chooser to this one the next time it will come. Use `gtkMainClassSet_lastOpenDirectory()` to store it after a GTK_RESPONSE_OK has been returned by a file chooser and then initialise each new with this routine.

Returns : | a string owned by V_Sim.

### gtkMainClassGet_rememberPosition ()

    gboolean            gtkMainClassGet_rememberPosition    ();

V_Sim can store the position of its main windows. Use this routine to get the status of this capability.

Returns : | TRUE if set.

### gtkMainClassGet_renderingSpecificOpen ()

    GtkMainSetFilesFunc gtkMainClassGet_renderingSpecificOpen
                                                            (RenderingMethod *method);

This method is used to retrieve the GtkMainSetFilesFunc associate with the specified `method`.

`method` : | a RenderingMethod object.
Returns : | a load method if one has been specified for `method` or `gtkMainClassSet_fileFromDefaultFileChooser()`.

### gtkMainClassSet_currentPanel ()

    void                gtkMainClassSet_currentPanel        (GtkMain *main);

After having created the command panel with `gtkMainNew()`, use this routine to declare it as the current command panel.

`main` : | a command panel.

### gtkMainClassSet_lastOpenDirectory ()

    void                gtkMainClassSet_lastOpenDirectory   (char *directory);

V_Sim stores the last open directory to set the file chooser to this one the next time it will come. Use this routine each time a file chooser returns GTK_RESPONSE_OK. The given string will be copied and can be freed after use.

`directory` : | a full path to a directory.

### gtkMainClassSet_rememberPosition ()

    void                gtkMainClassSet_rememberPosition    (gboolean val);

V_Sim can try to remember the position of its main windows, then open them again will result in a positioning on screen equivalent to previous position.

`val` : | an boolean.

### gtkMainClassSet_renderingSpecificMethods ()

    void                gtkMainClassSet_renderingSpecificMethods
                                                            (RenderingMethod *method,
                                                             GtkMainSetFilesFunc methodLoad);

This function is used by a client to add gtk methods to a rendering method. The `methodLoad` argument is called to when the 'load' button is pushed.

`method` : | a RenderingMethod object;
`methodLoad` : | a GtkMainSetFilesFunc method (can be NULL).