![]() |
![]() |
Gwyddion Application Library Reference Manual | ![]() |
|
---|---|---|---|---|
enum GwyToolResponseType; GwyTool; GwyToolClass; void gwy_tool_add_hide_button (GwyTool *tool, gboolean set_default); void gwy_tool_show (GwyTool *tool); void gwy_tool_hide (GwyTool *tool); gboolean gwy_tool_is_visible (GwyTool *tool); void gwy_tool_data_switched (GwyTool *tool, GwyDataView *data_view); const gchar* gwy_tool_class_get_title (GwyToolClass *klass); const gchar* gwy_tool_class_get_stock_id (GwyToolClass *klass); const gchar* gwy_tool_class_get_tooltip (GwyToolClass *klass);
typedef enum { GWY_TOOL_RESPONSE_CLEAR = 1, GWY_TOOL_RESPONSE_UPDATE = 2, } GwyToolResponseType;
Common tool dialog responses.
They do not have any special meaning for GwyTool (yet?), nonetheless you are encouraged to use them for consistency.
typedef struct { GObjectClass parent_class; const gchar *stock_id; const gchar *tooltip; const gchar *title; const gchar *prefix; gint default_width; gint default_height; void (*show)(GwyTool *tool); void (*hide)(GwyTool *tool); void (*data_switched)(GwyTool *tool, GwyDataView *data_view); void (*response)(GwyTool *tool, gint response_id); void (*reserved1)(void); void (*reserved2)(void); void (*reserved3)(void); void (*reserved4)(void); } GwyToolClass;
Tool class.
The fields default_width
and default_height
should be set only if a tool
dialog requires a different initial size from it would request (due to
shrinkable widgets). Since GwyTool keeps dialog sizes stored in settings
and restores them automatically, these values essentially apply only to the
first use of a tool.
GObjectClass parent_class ; |
|
const gchar *stock_id ; |
Tool icon stock id. |
const gchar *tooltip ; |
Tooltip. |
const gchar *title ; |
Tool dialog title. |
const gchar *prefix ; |
Prefix in settings to store automatically remembered tool state
under, should be of the form "/module/mytool" .
|
gint default_width ; |
Default initial window width, normally unset. |
gint default_height ; |
Default initial window height, normally unset. |
show () |
Tool show virtual method. Most tools do not need to override it, unless they wish to handle lazy updates themselves. |
hide () |
Tool hide virtual method. Most tools do not need to override it. |
data_switched () |
Data switched virtual method. |
response () |
Dialog response virtual method. Hiding an closing is normally handled in the base class, particular tools can handle only responses from their specific buttons. |
reserved1 () |
|
reserved2 () |
|
reserved3 () |
|
reserved4 () |
void gwy_tool_add_hide_button (GwyTool *tool, gboolean set_default);
Adds a Hide button to a tool dialog.
All tools should have a Hide button added by this method. The reason why it is not added automatically is because the usual placement of the Hide button is next to the execution button (Apply), which is not present for informational-only tools. In that case Hide should become the default dialog button.
tool : |
A tool. |
set_default : |
Whether hide should become the default tool dialog response. |
gboolean gwy_tool_is_visible (GwyTool *tool);
Checks whether a tool dialog is visible.
void gwy_tool_data_switched (GwyTool *tool, GwyDataView *data_view);
Instructs a tool to switch to another data view.
This involves set up of the top layer of data_view
and/or its selection
to the mode appropriate for tool
.
tool : |
A tool. |
data_view : |
A data view. It can be NULL , too.
|
const gchar* gwy_tool_class_get_title (GwyToolClass *klass);
Gets the title of a tool class (this is a class method).
The title is normally used as a tool dialog title.
klass : |
A tool class. |
Returns : | The title as a string owned by the tool class, untranslated. |
const gchar* gwy_tool_class_get_stock_id (GwyToolClass *klass);
Gets the icon stock id of a tool class (this is a class method).
klass : |
A tool class. |
Returns : | The stock id as a string owned by the tool class. |
const gchar* gwy_tool_class_get_tooltip (GwyToolClass *klass);
Gets the title of a tool class (this is a class method).
klass : |
A tool class. |
Returns : | The tooltip as a string owned by the tool class, untranslated. |