![]() |
![]() |
![]() |
V_Sim API - Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
GtkWidget * (*VisuGtkWidgetFunc) (void
); void (*VisuGtkInitWidgetFunc) (GtkWindow **panel
,GtkWindow **renderWindow
,GtkWidget **renderArea
); void visuGtkRaise_warning (gchar *action
,gchar *message
,GtkWindow *window
); void visuGtkRaise_warningLong (gchar *action
,gchar *message
,GtkWindow *window
); gboolean (*VisuGtkSetFilesFunc) (VisuData *data
,GtkWindow *parent
); void visuGtkSet_renderingSpecificMethods (VisuRendering *method
,VisuGtkSetFilesFunc methodLoad
); VisuGtkSetFilesFunc visuGtkGet_renderingSpecificOpen (VisuRendering *method
); VisuGtkPreview; VisuGtkPreview* visuGtkPreview_add (VisuGtkPreview *preview
,GtkFileChooser *chooser
); void visuGtkPreview_update (VisuGtkPreview *preview
,const char *filenames[]
); gchar** visuGtkGet_selectedDirectory (GtkWindow *parent
,gboolean multiple
,const gchar *dir
); gboolean visuGtkGet_fileFromDefaultFileChooser (VisuData *data
,GtkWindow *parent
); void visuGtkMain (VisuGtkInitWidgetFunc panelFunc
); gboolean visuGtkRun_commandLine (gpointer data
); void visuGtkWait (void
); GList* visuGtkCreate_fileChooserFilter (GList *list
,GtkWidget *fileChooser
); enum VisuGtkDirType; gchar* visuGtkGet_lastOpenDirectory (void
); void visuGtkSet_lastOpenDirectory (const char *directory
,VisuGtkDirType type
); GdkPixbuf* visuGtkCreate_pixbuf (const gchar *filename
); void visuGtkCreate_main (GtkWindow **panel
,GtkWindow **renderWindow
,GtkWidget **renderArea
); GtkWindow* visuGtkGet_panel (void
); GtkWindow* visuGtkGet_render (void
); GtkWidget* visuGtkGet_renderArea (void
);
GtkWidget * (*VisuGtkWidgetFunc) (void
);
This prototype is used whenever a method is required to create a GtkWidget.
Returns : |
a newly created GtkWidget.. transfer full. |
void (*VisuGtkInitWidgetFunc) (GtkWindow **panel
,GtkWindow **renderWindow
,GtkWidget **renderArea
);
This prototype is used whenever a method is required to initialise
the GTK interface of V_Sim. panel
must be set to point on the
window of the command panel, renderWindow
must point to the window
containing the rendering area (can be the same than panel
) and
renderArea
contains the widget that does the OpenGL rendering.
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. |
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.
|
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 VisuUiMainSetFilesFunc method (can be NULL). |
VisuGtkSetFilesFunc visuGtkGet_renderingSpecificOpen (VisuRendering *method
);
This method is used to retrieve the VisuUiMainSetFilesFunc associate with
the specified method
.
|
a RenderingMethod object. |
Returns : |
a load method if one has been specified for method
or gtkMainClassSet_fileFromDefaultFileChooser() .
|
typedef struct { GtkWidget *check; GtkWidget *image; GtkWidget *table; GtkWidget *vbox; gpointer data; } VisuGtkPreview;
A container for the relevant widgets of the preview area.
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. |
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 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 .
|
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 visu_ui_main_runCommandLine()
instead.
|
a pointer to the command panel (see VisuUiMain). |
Returns : |
FALSE always. |
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 ToolFileFormat ; |
|
a file chooser to associate filters with. |
Returns : |
a list of FileFilterCustom. This list should be freed after use. |
typedef enum { VISU_DIR_FILE, VISU_DIR_SURFACE, VISU_DIR_DATAFILE, VISU_DIR_CONF, VISU_DIR_BROWSER, /*< private >*/ N_VISU_DIR } VisuGtkDirType;
V_Sim remembers the last open directory when presenting a new file selector. This enum is used to specify different kind of directories. Like that saving a configuration file in a given directory will not affect the prefered directory for browsing a list of files.
gchar* visuGtkGet_lastOpenDirectory (void
);
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 (const 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 ; |
|
the kind of directory to set the remember flag 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. |
void visuGtkCreate_main (GtkWindow **panel
,GtkWindow **renderWindow
,GtkWidget **renderArea
);
A convenient routine that creates a VisuRenderingWindow alone. To
create also a command panel, visu_uiMainClass_createMain()
should be
used instead.
GtkWindow* visuGtkGet_panel (void
);
A convenient function to get the command panel window.
Returns : |
a GtkWindow. |
GtkWindow* visuGtkGet_render (void
);
A convenient function to get the rendering area window.
Returns : |
a GtkWindow. |