![]() |
![]() |
![]() |
Gwyddion Module Library Reference Manual | ![]() |
---|---|---|---|---|
enum GwyToolSwitchEvent; GwyToolFuncInfo; gboolean (*GwyToolUseFunc) (GwyDataWindow *data_window, GwyToolSwitchEvent event); gboolean gwy_tool_func_register (const gchar *modname, GwyToolFuncInfo *func_info); gboolean gwy_tool_func_use (const guchar *name, GwyDataWindow *data_window, GwyToolSwitchEvent event); GtkWidget* gwy_tool_func_build_toolbox (GCallback item_callback, gint max_width, const gchar **first_tool); const gchar* gwy_tool_func_get_tooltip (const gchar *name); gboolean gwy_tool_func_exists (const gchar *name);
typedef enum { GWY_TOOL_SWITCH_WINDOW = 1, GWY_TOOL_SWITCH_TOOL } GwyToolSwitchEvent;
Tool switch events.
typedef struct { const gchar *name; const gchar *stock_id; const gchar *tooltip; gint toolbox_position; 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. |
gint toolbox_position ; |
Position in the toolbox, the tools are sorted by this value (and then alphabetically if they are equal). Standard tools are in the range [0,100]. |
GwyToolUseFunc use ; |
The tool use function itself. |
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 .
|
gboolean gwy_tool_func_register (const gchar *modname, 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
.
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 .
|
GtkWidget* gwy_tool_func_build_toolbox (GCallback item_callback, gint max_width, const gchar **first_tool);
Creates a toolbox with the tools.
item_callback : |
A callback called when a tool from the toolbox is selected with tool name as the user data. |
max_width : |
The number of columns. |
first_tool : |
Where name of the first tool in the toolbox should be stored. |
Returns : | The toolbox as a GtkWidget. |
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. |
Since 1.9