GwyTool — Base class for tools
void | gwy_tool_add_hide_button () |
void | gwy_tool_show () |
void | gwy_tool_hide () |
gboolean | gwy_tool_is_visible () |
void | gwy_tool_data_switched () |
void | gwy_tool_spectra_switched () |
void | gwy_tool_restore_screen_position () |
const gchar * | gwy_tool_class_get_title () |
const gchar * | gwy_tool_class_get_stock_id () |
const gchar * | gwy_tool_class_get_tooltip () |
enum | GwyToolResponseType |
struct | GwyTool |
struct | GwyToolClass |
GObject ╰── GwyTool ╰── GwyPlainTool
#include <app/gwyapp.h>
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. |
void
gwy_tool_show (GwyTool *tool
);
Shows a tool's dialog.
tool |
A tool. |
void
gwy_tool_hide (GwyTool *tool
);
Hides a tool's dialog.
tool |
A tool. |
gboolean
gwy_tool_is_visible (GwyTool *tool
);
Checks whether a tool dialog is visible.
tool |
A tool. |
TRUE
if tool dialog is visible, FALSE
if it is hidden.
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 |
void gwy_tool_spectra_switched (GwyTool *tool
,GwySpectra *spectra
);
Instructs a tool to switch to another spectra object.
Bad things may happen when the spectra does not belong to the same container as the currently active channel.
tool |
A tool. |
|
spectra |
A spectra object. It can be |
Since: 2.7
void
gwy_tool_restore_screen_position (GwyTool *tool
);
Restores tool's dialog screen and position.
This function must be called when the tool dialog is not mapped yet. The position is remembered within a session (not in the settings) for each tool class. In Gwyddion, the program, at most one instance of each tool exists so there is no abiguity which dialog position should be saved and restored.
tool |
A tool. |
Since: 2.33
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. |
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. |
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. |
The tooltip as a string owned by the tool class, untranslated.
Common tool dialog responses.
They do not have any special meaning for GwyTool (yet?), nonetheless you are encouraged to use them for consistency.
Clear selection response. |
||
Update calculated values (if not instant) response. |
struct GwyTool;
struct GwyToolClass { 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 (*spectra_switched)(GwyTool *tool, GwySpectra *spectra); void (*reserved2)(void); void (*reserved3)(void); void *priv; };
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.
Tool icon stock id. |
||
Tooltip. |
||
Tool dialog title. |
||
Prefix in settings to store automatically remembered tool state
under, should be of the form |
||
Default initial window width, normally unset. |
||
Default initial window height, normally unset. |
||
Tool show virtual method. Most tools do not need to override it, unless they wish to handle lazy updates themselves. |
||
Tool hide virtual method. Most tools do not need to override it. |
||
Data switched virtual method. |
||
Dialog response virtual method. Hiding an closing is normally handled in the base class, particular tools can handle only responses from their specific buttons. |
||