Gwyddion – Free SPM (AFM, SNOM/NSOM, STM, MFM, …) data analysis software

GwyTool (HEAD)

GwyTool — Base class for tools

Functions

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 ()

Types and Values

enum GwyToolResponseType
struct GwyTool
struct GwyToolClass

Object Hierarchy

    GObject
    ╰── GwyTool
        ╰── GwyPlainTool

Includes

#include <app/gwyapp.h>

Description

Functions

gwy_tool_add_hide_button ()

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.

Parameters

tool

A tool.

 

set_default

Whether hide should become the default tool dialog response.

 

gwy_tool_show ()

void
gwy_tool_show (GwyTool *tool);

Shows a tool's dialog.

Parameters

tool

A tool.

 

gwy_tool_hide ()

void
gwy_tool_hide (GwyTool *tool);

Hides a tool's dialog.

Parameters

tool

A tool.

 

gwy_tool_is_visible ()

gboolean
gwy_tool_is_visible (GwyTool *tool);

Checks whether a tool dialog is visible.

Parameters

tool

A tool.

 

Returns

TRUE if tool dialog is visible, FALSE if it is hidden.

gwy_tool_data_switched ()

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 .

Parameters

tool

A tool.

 

data_view

A data view. It can be NULL, too.

 

gwy_tool_spectra_switched ()

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.

Parameters

tool

A tool.

 

spectra

A spectra object. It can be NULL, too.

 

Since: 2.7

gwy_tool_restore_screen_position ()

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.

Parameters

tool

A tool.

 

Since: 2.33

gwy_tool_class_get_title ()

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.

Parameters

klass

A tool class.

 

Returns

The title as a string owned by the tool class, untranslated.

gwy_tool_class_get_stock_id ()

const gchar *
gwy_tool_class_get_stock_id (GwyToolClass *klass);

Gets the icon stock id of a tool class (this is a class method).

Parameters

klass

A tool class.

 

Returns

The stock id as a string owned by the tool class.

gwy_tool_class_get_tooltip ()

const gchar *
gwy_tool_class_get_tooltip (GwyToolClass *klass);

Gets the title of a tool class (this is a class method).

Parameters

klass

A tool class.

 

Returns

The tooltip as a string owned by the tool class, untranslated.

Types and Values

enum GwyToolResponseType

Common tool dialog responses.

They do not have any special meaning for GwyTool (yet?), nonetheless you are encouraged to use them for consistency.

Members

GWY_TOOL_RESPONSE_CLEAR

Clear selection response.

 

GWY_TOOL_RESPONSE_UPDATE

Update calculated values (if not instant) response.

 

struct GwyTool

struct GwyTool;

struct GwyToolClass

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.

Members

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.

 

spectra_switched ()

   

reserved2 ()

   

reserved3 ()

   

void *priv;

   
© David Nečas and Petr Klapetek

Home Download News Features Screenshots Documentation Communicate Participate Resources Publications Applications Site Map

Valid XHTML 1.0 Valid CSS