![]() |
![]() |
![]() |
V_Sim API - Reference Manual | ![]() |
---|---|---|---|---|
enum VisuGtkDirType; gboolean (*VisuGtkSetFilesFunc) (VisuData *data, GtkWindow *parent); GtkWidget* (*VisuGtkWidgetFunc) (); void visuGtkMain (VisuGtkInitWidgetFunc panelFunc); void visuGtkWait (); void visuGtkCreate_main (GtkWindow **panel, GtkWindow **render); void visuGtkLoad_file (VisuData *data, guint iSet); gboolean visuGtkRun_commandLine (gpointer data); VisuGtkPreview* visuGtkPreview_add (VisuGtkPreview *preview, GtkFileChooser *chooser); void visuGtkPreview_update (VisuGtkPreview *preview, const char *filenames[]); GList* visuGtkCreate_fileChooserFilter (GList *list, GtkWidget *fileChooser); gchar** visuGtkGet_selectedDirectory (GtkWindow *parent, gboolean multiple, const gchar *dir); gboolean visuGtkGet_fileFromDefaultFileChooser (VisuData *data, GtkWindow *parent); void visuGtkRaise_warning (gchar *action, gchar *message, GtkWindow *window); void visuGtkRaise_warningLong (gchar *action, gchar *message, GtkWindow *window); GdkPixbuf* visuGtkCreate_pixbuf (const gchar *filename); gchar* visuGtkGet_lastOpenDirectory (); void visuGtkSet_lastOpenDirectory (char *directory, VisuGtkDirType type); VisuGtkSetFilesFunc visuGtkGet_renderingSpecificOpen (VisuRendering *method); void visuGtkSet_renderingSpecificMethods (VisuRendering *method, VisuGtkSetFilesFunc methodLoad);
typedef enum { VISU_DIR_FILE, VISU_DIR_SURFACE, VISU_DIR_DATAFILE, VISU_DIR_CONF, N_VISU_DIR } VisuGtkDirType;
gboolean (*VisuGtkSetFilesFunc) (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.
|
a VisuData to store the informations ; |
|
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.
|
GtkWidget* (*VisuGtkWidgetFunc) ();
This prototype is used whenever a method is required to create a GtkWidget.
Returns : |
a newly created GtkWidget. |
void visuGtkMain (VisuGtkInitWidgetFunc panelFunc);
It initializses the GTK part of V_Sim. During this initialisation,
the panelFunc
is called. It should create all the windows needed
by V_Sim, like the command panel and the rendering area. The return
widget is the widget returned itself by panelFunc
. It must be the
main widget: it is the command panel if used, the window containing
the rendering area if no command panel or the rendering area itself
if no container window.
|
function to be called to create the different windows. |
Returns : |
the main widget for V_Sim, returned itself by panelFunc .
|
void visuGtkCreate_main (GtkWindow **panel, GtkWindow **render);
A convenient routine that creates a RenderingWindow alone. To
create also a command panel, gtkMainClassCreate_main()
should be
used instead.
Returns : |
the window containing the rendering area. |
void visuGtkLoad_file (VisuData *data, guint iSet);
This method calls the general function to load data from file
and deals with errors with gtkDialogs. The filenames must have
already been set into data
using visuDataAdd_file()
.
|
the VisuData to be loaded. |
|
the id of data to load.
|
gboolean visuGtkRun_commandLine (gpointer data);
Call the get routines from the command line module and deal with
them. This method is not aware of the panels and is intended to be
called only when the command panel is not used. In the opposite
case, use gtkMainRun_commandLine()
instead.
|
a pointer to the command panel (see GtkMain). |
Returns : |
FALSE always. |
VisuGtkPreview* visuGtkPreview_add (VisuGtkPreview *preview, GtkFileChooser *chooser);
Create the widgets to have a preview attached to filechooser
. But
the signal raised by filechooser
when previewing is needed is not
attached and this must be done by the user with custom routine.
|
a location on VisuGtkPreview (uninitialised) ; |
|
the filechooser the preview must be attached to. |
Returns : |
preview itself.
|
void visuGtkPreview_update (VisuGtkPreview *preview, const char *filenames[]);
This routine update the content of the given preview
by making a
rendering in a pixmap of the given filenames. The number of given
filenames must match the number required by the current rendering
method. Only the nodes, the box and the background (plus fog) is
actually previewed.
|
a location on VisuGtkPreview (initialised) ; |
|
an array of filenames. |
GList* visuGtkCreate_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
.
|
a GList of FileFormat ; |
|
a file chooser to associate filters with. |
Returns : |
a list of FileFilterCustom. This list should be freed after use. |
gchar** visuGtkGet_selectedDirectory (GtkWindow *parent, gboolean multiple, const gchar *dir);
General procedure to get the location of one or more directories.
In the multiple case, all selected directories shares a common ancestor
since the selection is done through the same selector that for single
directory but with multiple selection activated. If dir
is NULL
the last opened (and stored) directory is used (see
visuGtkGet_lastOpenDirectory()
and visuGtkSet_lastOpenDirectory()
).
|
if NULL, the command panel window is used ; |
|
if TRUE, multiple directories can be selected ; |
|
if not NULL, give the opening directory. |
Returns : |
a newly allocated array of paths, NULL terminated. Use g_strfreev()
to free it after use. If no directory is selected, then NULL is
returned.
|
gboolean visuGtkGet_fileFromDefaultFileChooser (VisuData *data, GtkWindow *parent);
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, and wait for its reponse. If OK is clicked, the selected filename is stored. If Cancel is clicked, nothing is done. The dialog is destroyed after use.
|
an allocated VisuData to store the file names ; |
|
the parent window of the dialog. |
Returns : |
FALSE if no file has been set, TRUE if the calling method should
call gtkMainLoadAndRender_file() with a g_idle_add() method.
|
void visuGtkRaise_warning (gchar *action, gchar *message, GtkWindow *window);
Raise a warning window with the action in bold and the message written underneath.
|
a string ; |
|
another string ; |
|
the parent window to raise the warning on. |
void visuGtkRaise_warningLong (gchar *action, gchar *message, GtkWindow *window);
Same as visuGtkRaise_warning()
except that the message is displayed
in a text buffer, ideal for a log.
|
a string ; |
|
another string ; |
|
the parent window to raise the warning on. |
GdkPixbuf* visuGtkCreate_pixbuf (const gchar *filename);
Replace the create_pixbuf()
routine from Glade. It looks only in
the default pixmap directory of V_Sim to find the given file.
|
a file name (must be a base name). |
Returns : |
a newly created GdkPixbuf on success. |
gchar* visuGtkGet_lastOpenDirectory ();
V_Sim stores the last open directory to set the file chooser to
this one the next time it will come. Use
visuGtkSet_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. |
void visuGtkSet_lastOpenDirectory (char *directory, VisuGtkDirType type);
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.
|
a full path to a directory. |
VisuGtkSetFilesFunc visuGtkGet_renderingSpecificOpen (VisuRendering *method);
This method is used to retrieve the GtkMainSetFilesFunc associate with
the specified method
.
|
a RenderingMethod object. |
Returns : |
a load method if one has been specified for method
or gtkMainClassSet_fileFromDefaultFileChooser() .
|
void visuGtkSet_renderingSpecificMethods (VisuRendering *method, VisuGtkSetFilesFunc 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.
|
a RenderingMethod object; |
|
a GtkMainSetFilesFunc method (can be NULL). |