![]() |
![]() |
![]() |
V_Sim API - Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
enum VisuUiDirectoryType; struct VisuUiFileFilter; void (*VisuUiInitWidgetFunc) (GtkWindow **panel
,GtkWindow **renderWindow
,GtkWidget **renderArea
); GtkWidget * (*VisuUiNewWidgetFunc) (void
); struct VisuUiPreview; gboolean (*VisuUiSetFilesFunc) (VisuData *data
,GtkWindow *parent
); GdkPixbuf * tool_color_get_stamp (const ToolColor *color
,gboolean alpha
); GtkWidget * visu_ui_buildRenderingWindow (VisuUiRenderingWindow *renderWindow
); GList * visu_ui_createFilter (GList *list
,GtkWidget *fileChooser
); void visu_ui_createInterface (GtkWindow **panel
,GtkWindow **renderWindow
,GtkWidget **renderArea
); GdkPixbuf * visu_ui_createPixbuf (const gchar *filename
); gboolean visu_ui_getFileFromDefaultFileChooser (VisuData *data
,GtkWindow *parent
); gchar * visu_ui_getLastOpenDirectory (void
); GtkWindow * visu_ui_getPanel (void
); GtkWidget * visu_ui_getRenderWidget (void
); GtkWindow * visu_ui_getRenderWindow (void
); VisuUiSetFilesFunc visu_ui_getRenderingSpecificOpen (VisuRendering *method
); gchar ** visu_ui_getSelectedDirectory (GtkWindow *parent
,gboolean multiple
,const gchar *dir
); void visu_ui_mainCreate (VisuUiInitWidgetFunc panelFunc
); VisuUiPreview * visu_ui_preview_add (VisuUiPreview *preview
,GtkFileChooser *chooser
); void visu_ui_preview_update (VisuUiPreview *preview
,const char *filenames[]
); void visu_ui_raiseWarning (gchar *action
,gchar *message
,GtkWindow *window
); void visu_ui_raiseWarningLong (gchar *action
,gchar *message
,GtkWindow *window
); gboolean visu_ui_runCommandLine (gpointer data
); void visu_ui_setLastOpenDirectory (const char *directory
,VisuUiDirectoryType type
); void visu_ui_setRenderWidget (VisuUiRenderingWindow *render
); void visu_ui_setRenderingSpecificMethod (VisuRendering *method
,VisuUiSetFilesFunc methodLoad
); void visu_ui_setWindowTitle (GtkWindow *window
,const VisuData *dataObj
); void visu_ui_wait (void
);
There are some common UI routines here. The preview widget
can be called with visu_ui_preview_add()
. Error messages can be
displayed via dialogs, see visu_ui_raiseWarning()
...
typedef enum { VISU_UI_DIR_FILE, VISU_UI_DIR_SURFACE, VISU_UI_DIR_DATAFILE, VISU_UI_DIR_CONF, VISU_UI_DIR_BROWSER, } VisuUiDirectoryType;
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.
struct VisuUiFileFilter { GtkFileFilter *gtkFilter; ToolFileFormat* visuFilter; };
Structure used to associate the V_Sim way to store file filters with the Gtk way.
GtkFileFilter * |
the GtkFileFilter associate to visuFilter . |
ToolFileFormat * |
a ToolFileFormat object. |
void (*VisuUiInitWidgetFunc) (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.
GtkWidget * (*VisuUiNewWidgetFunc) (void
);
This prototype is used whenever a method is required to create a GtkWidget.
Returns : |
a newly created GtkWidget. [transfer full] |
struct VisuUiPreview { GtkWidget *check; GtkWidget *image; GtkWidget *table; GtkWidget *vbox; VisuData *data; VisuGlView *view; };
A container for the relevant widgets of the preview area.
GtkWidget * |
the widget used to allow or not preview ; |
GtkWidget * |
the GtkImage with the preview ; |
GtkWidget * |
a GtkTable with file informations ; |
GtkWidget * |
the GtkVBox with all the stuff for previewing. |
VisuData * |
a VisuData object. |
VisuGlView * |
a VisuGlView object. |
gboolean (*VisuUiSetFilesFunc) (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 visu_ui_rendering_window_loadFile() . |
GdkPixbuf * tool_color_get_stamp (const ToolColor *color
,gboolean alpha
);
This method is used by VisuUiColorCombobox object to create little stamps
representing the color. If the pixbuf of such stamps are needed, use
visu_ui_color_combobox_getPixbufFromColor()
if the color is registered in an
already existing VisuUiColorCombobox object or use this method to create
a new stamp.
|
a ToolColor object ; |
|
a boolean. |
Returns : |
a pixbuf pointer corresponding to the
little image as shown on a colorComboBox (use g_object_unref() to
free this pixbuf). [transfer full]
|
Since 3.7
GtkWidget * visu_ui_buildRenderingWindow (VisuUiRenderingWindow *renderWindow
);
Create a GtkWindow with V_sim render window icon and wmclass set
to "V_Sim:v_sim_render". It also set the accelerators of
renderWindow
to the newly created window and pack renderWindow
inside.
|
a VisuUiRenderingWindow object. |
Returns : |
a newly created GtkWindow. [transfer full] |
Since 3.7
GList * visu_ui_createFilter (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 ;. [element-type ToolFileFormat*] |
|
a file chooser to associate filters with. |
Returns : |
a list of VisuUiFileFilter. This list should be freed after use. [element-type VisuUiFileFilter][transfer full] |
void visu_ui_createInterface (GtkWindow **panel
,GtkWindow **renderWindow
,GtkWidget **renderArea
);
A convenient routine that creates a VisuUiRenderingWindow alone. To
create also a command panel, visu_ui_main_class_createMain()
should be
used instead.
GdkPixbuf * visu_ui_createPixbuf (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). [type filename] |
Returns : |
a newly created GdkPixbuf on success. [transfer full] |
gboolean visu_ui_getFileFromDefaultFileChooser (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 visu_ui_rendering_window_loadFile() . |
gchar * visu_ui_getLastOpenDirectory (void
);
V_Sim stores the last open directory to set the file chooser to
this one the next time it will come. Use
visu_ui_setLastOpenDirectory()
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. [transfer none] |
GtkWindow * visu_ui_getPanel (void
);
A convenient function to get the command panel window.
Returns : |
a GtkWindow. [transfer none] |
GtkWidget * visu_ui_getRenderWidget (void
);
A convenient function to get the rendering area widget.
Returns : |
a GtkWidget. [transfer none] |
GtkWindow * visu_ui_getRenderWindow (void
);
A convenient function to get the rendering area window.
Returns : |
a GtkWindow. [transfer none] |
VisuUiSetFilesFunc visu_ui_getRenderingSpecificOpen (VisuRendering *method
);
This method is used to retrieve the VisuUiSetFilesFunc associate with
the specified method
.
|
a RenderingMethod object. |
Returns : |
a load method if one has been specified for method
or visu_ui_getFileFromDefaultFileChooser() . |
gchar ** visu_ui_getSelectedDirectory (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
visu_ui_getLastOpenDirectory()
and visu_ui_setLastOpenDirectory()
).
|
if NULL, the command panel window is used ;. [allow-none] |
|
if TRUE, multiple directories can be selected ; |
|
if not NULL, give the opening directory. [allow-none] |
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. [array zero-terminated=1][transfer full]
|
void visu_ui_mainCreate (VisuUiInitWidgetFunc 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. [scope call] |
Returns : |
the main widget for V_Sim, returned itself by panelFunc . |
VisuUiPreview * visu_ui_preview_add (VisuUiPreview *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 VisuUiPreview (uninitialised) ; |
|
the filechooser the preview must be attached to. |
Returns : |
preview itself. |
void visu_ui_preview_update (VisuUiPreview *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 VisuUiPreview (initialised) ; |
|
an array of filenames. |
void visu_ui_raiseWarning (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 visu_ui_raiseWarningLong (gchar *action
,gchar *message
,GtkWindow *window
);
Same as visu_ui_raiseWarning()
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 visu_ui_runCommandLine (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. |
void visu_ui_setLastOpenDirectory (const char *directory
,VisuUiDirectoryType 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. |
void visu_ui_setRenderWidget (VisuUiRenderingWindow *render
);
A convenient function to set the rendering area widget.
|
a VisuUiRenderingWindow widget. |
Since 3.7
void visu_ui_setRenderingSpecificMethod (VisuRendering *method
,VisuUiSetFilesFunc 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 VisuUiSetFilesFunc method (can be NULL). [scope call] |
void visu_ui_setWindowTitle (GtkWindow *window
,const VisuData *dataObj
);
Change the title of the given window, according to dataObj
(setting usually the name of the loaded file).
Since 3.7