## gtk_main

gtk_main —

## Synopsis

    int         (*createGtkLoadWidgetFunc)      (VisuData *data,
                                                 GtkFileChooser **fileChooser,
                                                 GtkWidget **fileWidget);
    createGtkLoadWidgetFunc gtkMainGet_renderingSpecificOpen
                                                (RenderingMethod *method);
    GList*      gtkMainCreate_fileChooserFilter (GList *list,
                                                 GtkWidget *fileChooser);
    void        gtkMainSet_renderingSpecificMethods
                                                (RenderingMethod *method,
                                                 createGtkWidgetFunc createLoadWidget,
                                                 createGtkLoadWidgetFunc methodLoad);
    int         gtkMainCreate_defaultFileChooser
                                                (VisuData *data,
                                                 GtkFileChooser **fileChooser,
                                                 GtkWidget **fileWidget);
    ToolPanel*  (*subPanelInitFunc)             ();
    GtkWidget*  (*createGtkWidgetFunc)          (void);
    char*       getLastOpenDirectory            ();
    void        setLastOpenDirectory            (char *directory);
    gchar*      getSelectedDirectory            ();
    gboolean    loadAndRenderFileWithGtk        (gpointer data);
    void        raiseAlertDialog                (char *message);
    void        raiseAlertDialogWithScrollView  (char *message);
    void        visuHideWindow                  (GtkWindow *win);
    void        visuShowWindow                  (GtkWindow *win);
    void        setRememberPosition             (int val);
    int         getRememberPosition             ();

## Description

## Details

### createGtkLoadWidgetFunc ()

    int         (*createGtkLoadWidgetFunc)      (VisuData *data,
                                                 GtkFileChooser **fileChooser,
                                                 GtkWidget **fileWidget);

Methods that conform to this prototype is used to set filename(s) to be loaded when the 'load' button is pushed. It must creates a GtkWidget that will be destroy after use and it must also use a GtkFileChooser.

`data` : | a VisuData to store the informations ;
`fileChooser` : | a pointer to store the created GtkFileChooser ;
`fileWidget` : | a pointer to store the created ancapsulating widget.
Returns : | 0 if no filename as been set, 1 if the calling method should call `loadAndRenderFileWithGtk()` with a g_idle_add method.

### gtkMainGet_renderingSpecificOpen ()

    createGtkLoadWidgetFunc gtkMainGet_renderingSpecificOpen
                                                (RenderingMethod *method);

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

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

### gtkMainCreate_fileChooserFilter ()

    GList*      gtkMainCreate_fileChooserFilter (GList *list,
                                                 GtkWidget *fileChooser);

Create a list of GtkFileFilter created from the given list of file formats and attach it to the given `fileChooser`.

`list` : | a GList of FileFormat ;
`fileChooser` : | a file chooser to associate filters with.
Returns : | a list of FileFilterCustom. This list should be freed after use.

### gtkMainSet_renderingSpecificMethods ()

    void        gtkMainSet_renderingSpecificMethods
                                                (RenderingMethod *method,
                                                 createGtkWidgetFunc createLoadWidget,
                                                 createGtkLoadWidgetFunc 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;
`createLoadWidget` : | a createGtkWidgetFunc method (can be NULL).
`methodLoad` : | a createGtkLoadWidgetFunc method (can be NULL).

### gtkMainCreate_defaultFileChooser ()

    int         gtkMainCreate_defaultFileChooser
                                                (VisuData *data,
                                                 GtkFileChooser **fileChooser,
                                                 GtkWidget **fileWidget);

This method is a default method to launch a file chooser that select a single file, with the filters of the current RenderingMethod. It creates a modal dialog (`fileWidget`), and wait for its reponse. If OK is clicked, the selected filename is stored. If Cancel is clicked, nothing is done. In all cases the dialog is not destroyed and it can be retrieve via the `fileWidget` argument.

`data` : | an allocated VisuData to store the file names ;
`fileChooser` : | a pointer to store the created GtkFileChooser ;
`fileWidget` : | a pointer to store the created ancapsulating widget.
Returns : | 0 if no file has been set, 1 if the calling method should call `loadAndRenderFileWithGtk()` with a g_idle_add method.

### subPanelInitFunc ()

    ToolPanel*  (*subPanelInitFunc)             ();

Returns : |

### createGtkWidgetFunc ()

    GtkWidget*  (*createGtkWidgetFunc)          (void);

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

Returns : | a newly created GtkWidget.

### getLastOpenDirectory ()

    char*       getLastOpenDirectory            ();

Returns : |

### setLastOpenDirectory ()

    void        setLastOpenDirectory            (char *directory);

`directory` : |

### getSelectedDirectory ()

    gchar*      getSelectedDirectory            ();

Returns : |

### loadAndRenderFileWithGtk ()

    gboolean    loadAndRenderFileWithGtk        (gpointer data);

`data` : |
Returns : |

### raiseAlertDialog ()

    void        raiseAlertDialog                (char *message);

`message` : |

### raiseAlertDialogWithScrollView ()

    void        raiseAlertDialogWithScrollView  (char *message);

`message` : |

### visuHideWindow ()

    void        visuHideWindow                  (GtkWindow *win);

`win` : |

### visuShowWindow ()

    void        visuShowWindow                  (GtkWindow *win);

`win` : |

### setRememberPosition ()

    void        setRememberPosition             (int val);

`val` : |

### getRememberPosition ()

    int         getRememberPosition             ();

Returns : |