gwymodule-tool

gwymodule-tool — Interactive tool modules

Synopsis




            GwyToolFuncInfo;
gboolean    (*GwyToolUseFunc)               (GwyDataWindow *data_window,
                                             GwyToolSwitchEvent event);
gboolean    gwy_tool_func_register          (GwyToolFuncInfo *func_info);
gboolean    gwy_tool_func_use               (const guchar *name,
                                             GwyDataWindow *data_window,
                                             GwyToolSwitchEvent event);
const gchar* gwy_tool_func_get_tooltip      (const gchar *name);
const gchar* gwy_tool_func_get_stock_id     (const gchar *name);
gboolean    gwy_tool_func_exists            (const gchar *name);

Description

Tool modules implement interactive tools that work directly on data windows.

Details

GwyToolFuncInfo

typedef struct {
    const gchar *name;
    const gchar *stock_id;
    const gchar *tooltip;
    GwyToolUseFunc use;
} GwyToolFuncInfo;

Information about one tool use function.

const gchar *name; An unique tool function name.
const gchar *stock_id; Icon stock id or button label (FIXME: more to be said).
const gchar *tooltip; Tooltip for this tool.
GwyToolUseFunc use; The tool use function itself.

GwyToolUseFunc ()

gboolean    (*GwyToolUseFunc)               (GwyDataWindow *data_window,
                                             GwyToolSwitchEvent event);

The type of tool use function.

This function is called to set a tool for a data window, either when the user changes the active tool or switches to another window; the detailed event is given in event.

data_window : A data window the tool should be set for.
event : The tool change event.
Returns : Whether the tool switch succeeded. Under normal circumstances it should always return TRUE.

gwy_tool_func_register ()

gboolean    gwy_tool_func_register          (GwyToolFuncInfo *func_info);

Registeres a tool use function.

To keep compatibility with old versions func_info should not be an automatic variable. However, since 1.6 it keeps a copy of func_info.

func_info : Tool use function info.
Returns : TRUE on success, FALSE on failure.

gwy_tool_func_use ()

gboolean    gwy_tool_func_use               (const guchar *name,
                                             GwyDataWindow *data_window,
                                             GwyToolSwitchEvent event);

Sets a tool for a data window.

name : Tool use function name.
data_window : A data window the tool should be set for.
event : The tool change event.
Returns : Whether the tool switch succeeded. Under normal circumstances it always return TRUE.

gwy_tool_func_get_tooltip ()

const gchar* gwy_tool_func_get_tooltip      (const gchar *name);

Gets tool function tooltip.

name : Tool function name.
Returns : The tooltip as a string owned by module loader.

gwy_tool_func_get_stock_id ()

const gchar* gwy_tool_func_get_stock_id     (const gchar *name);

Gets tool function stock icon id.

name : Tool function name.
Returns : The stock icon id as a string owned by module loader.

gwy_tool_func_exists ()

gboolean    gwy_tool_func_exists            (const gchar *name);

Returns whether tool function name exists.

name : Tool function name.
Returns : TRUE if name exists, FALSE otherwise.