GwyDataChooser — Data object choosers
gboolean | (*GwyDataChooserFilterFunc) () |
GtkWidget * | gwy_data_chooser_new_channels () |
GtkWidget * | gwy_data_chooser_new_volumes () |
GtkWidget * | gwy_data_chooser_new_graphs () |
GtkWidget * | gwy_data_chooser_new_xyzs () |
GtkWidget * | gwy_data_chooser_new_curve_maps () |
GwyAppDataId * | gwy_app_data_id_new () |
GwyAppDataId * | gwy_app_data_id_copy () |
void | gwy_app_data_id_free () |
gboolean | gwy_data_chooser_set_active () |
GwyContainer * | gwy_data_chooser_get_active () |
gboolean | gwy_data_chooser_set_active_id () |
gboolean | gwy_data_chooser_get_active_id () |
void | gwy_data_chooser_set_filter () |
const gchar * | gwy_data_chooser_get_none () |
void | gwy_data_chooser_set_none () |
GtkTreeModel * | gwy_data_chooser_get_filter () |
void | gwy_data_chooser_refilter () |
#define | GWY_APP_DATA_ID_NONE |
GwyAppDataId | |
GwyDataChooser | |
GwyDataChooserClass |
GObject ╰── GInitiallyUnowned ╰── GtkObject ╰── GtkWidget ╰── GtkContainer ╰── GtkBin ╰── GtkComboBox ╰── GwyDataChooser
GwyDataChooser implements AtkImplementorIface, GtkBuildable, GtkCellLayout and GtkCellEditable.
#include <app/gwyapp.h>
GwyDataChooser is an base data object chooser class. Choosers for particular data objects can be created with
functions like gwy_data_chooser_new_channels()
or gwy_data_chooser_new_volumes()
and then manipulated through
GwyDataChooser interface.
The widget type used to implement choosers is not a part of the interface and may be subject of future changes. In
any case GwyDataChooser has a "changed"
signal emitted when the selected item changes.
It is possible to offer only data objects matching some criteria. For example to offer only data fields compatible with another data field, one can use:
1 2 3 4 5 6 |
GtkWidget *chooser; GwyDataField *model; model = ...; chooser = gwy_data_chooser_new_channels(); gwy_data_chooser_set_filter(GWY_DATA_CHOOSER(chooser), compatible_field_filter, model, NULL); |
where the filter function looks like
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
static gboolean compatible_field_filter(GwyContainer *data, gint id, gpointer user_data) { GwyDataField *model, *data_field; GQuark quark; quark = gwy_app_get_data_key_for_id(id); data_field = gwy_container_get_object(data, quark); model = GWY_DATA_FIELD(user_data); return !gwy_data_field_check_compatibility(data_field, model, GWY_DATA_COMPATIBILITY_RES | GWY_DATA_COMPATIBILITY_REAL | GWY_DATA_COMPATIBILITY_LATERAL | GWY_DATA_COMPATIBILITY_VALUE); } |
gboolean (*GwyDataChooserFilterFunc) (GwyContainer *data
,gint id
,gpointer user_data
);
The type of data chooser filter function.
data |
Data container. |
|
id |
Id of particular data in |
|
user_data |
Data passed to |
TRUE
to display this data in the chooser, FALSE
to omit it.
GtkWidget *
gwy_data_chooser_new_channels (void
);
Creates a data chooser for data channels.
A new channel chooser. Nothing may be assumed about the type and properties of the returned widget as they can change in the future.
GtkWidget *
gwy_data_chooser_new_volumes (void
);
Creates a data chooser for volume data.
A new volume chooser. Nothing may be assumed about the type and properties of the returned widget as they can change in the future.
Since: 2.33
GtkWidget *
gwy_data_chooser_new_graphs (void
);
Creates a data chooser for graphs.
A new graph chooser. Nothing may be assumed about the type and properties of the returned widget as they can change in the future.
Since: 2.41
GtkWidget *
gwy_data_chooser_new_xyzs (void
);
Creates a data chooser for XYZ data.
A new XYZ data chooser. Nothing may be assumed about the type and properties of the returned widget as they can change in the future.
Since: 2.45
GtkWidget *
gwy_data_chooser_new_curve_maps (void
);
Creates a data chooser for curve map data.
A new curve map data chooser. Nothing may be assumed about the type and properties of the returned widget as they can change in the future.
Since: 2.60
GwyAppDataId * gwy_app_data_id_new (gint datano
,gint id
);
Creates a new data identifier on heap.
This is mostly useful for language bindings.
datano |
Numeric identifier of data container. Zero is used for none. |
|
id |
Numeric identifier of a specific data item, such as channel or graph number. Value -1 is used for none. |
Newly allocated data id. It must be freed with gwy_app_data_id_free()
.
Since: 2.47
GwyAppDataId *
gwy_app_data_id_copy (GwyAppDataId *dataid
);
Creates a copy of data identifier.
This is mostly useful for language bindings.
dataid |
Data identifier. |
Newly allocated data id. It must be freed with gwy_app_data_id_free()
.
Since: 2.47
void
gwy_app_data_id_free (GwyAppDataId *dataid
);
Frees a data identifier.
This is mostly useful for language bindings.
dataid |
Data identifier. |
Since: 2.47
gboolean gwy_data_chooser_set_active (GwyDataChooser *chooser
,GwyContainer *data
,gint id
);
Selects a data in a data chooser.
chooser |
A data chooser. |
|
data |
Container to select, |
|
id |
Id of particular data to select in |
TRUE
if selected item was set.
GwyContainer * gwy_data_chooser_get_active (GwyDataChooser *chooser
,gint *id
);
Gets the selected item in a data chooser.
chooser |
A data chooser. |
|
id |
Location to store selected data id to (may be |
The container selected data lies in, NULL
if nothing is selected or `none' item is selected.
gboolean gwy_data_chooser_set_active_id (GwyDataChooser *chooser
,const GwyAppDataId *id
);
Selects a data in a data chooser using numerical identifiers.
Passing NULL
as id
is permitted as a request to select the ‘none’ item.
chooser |
A data chooser. |
|
id |
Data item to select. |
TRUE
if selected item was set.
Since: 2.41
gboolean gwy_data_chooser_get_active_id (GwyDataChooser *chooser
,GwyAppDataId *id
);
Gets the selected item in a data chooser as numerical identifiers.
chooser |
A data chooser. |
|
id |
Location for the id selected data item. |
TRUE
if any actual data item is selected. FALSE
is nothing is selected or the ‘none’ item is selected.
Since: 2.41
void gwy_data_chooser_set_filter (GwyDataChooser *chooser
,GwyDataChooserFilterFunc filter
,gpointer user_data
,GtkDestroyNotify destroy
);
Sets the filter applied to a data chooser.
The display of an item corresponding to no data is controlled by gwy_data_chooser_set_none()
, filter
function is
only called for real data.
Use gwy_data_chooser_refilter()
to update the list if the filter depends on external state and that changes.
chooser |
A data chooser. |
|
filter |
The filter function. |
|
user_data |
The data passed to |
|
destroy |
Destroy notifier of |
const gchar *
gwy_data_chooser_get_none (GwyDataChooser *chooser
);
Gets the label of the item corresponding to no data.
chooser |
A data chooser. |
The label corresponding to no data, an empty string for the default label and NULL
if the chooser does
not display the no-data item.
void gwy_data_chooser_set_none (GwyDataChooser *chooser
,const gchar *none
);
Sets the label of the item corresponding to no data.
chooser |
A data chooser. |
|
none |
Label to use for item corresponding to no data. Passing |
GtkTreeModel *
gwy_data_chooser_get_filter (GwyDataChooser *chooser
);
Gets the tree model filter used in a data chooser.
In general, you should not access the filter directly. An exception being gtk_tree_model_filter_refilter()
when
the filtering functions given in gwy_data_chooser_set_filter()
depends on external state and that state changes.
However, gwy_data_chooser_refilter()
is usually more useful.
chooser |
A data chooser. |
The GtkTreeModelFilter object used by the chooser.
void
gwy_data_chooser_refilter (GwyDataChooser *chooser
);
Reruns the filter function of a data chooser.
This function is useful when the filtering functions given in gwy_data_chooser_set_filter()
depends on external
state and that state changes.
If the currently selected item becomes filtered out the chooser selects the no-data item if enabled. If the no-data item is disabled but the list contains some items then an arbitrary item is selected. At present, this means the first item in the list.
chooser |
A data chooser. |
Since: 2.41
#define GWY_APP_DATA_ID_NONE { 0, -1 }
Initialiser for GwyAppDataId that corresponds to no data.
The macro would be typically used in initialisation as
1 |
GwyAppDataId dataid = GWY_APP_DATA_ID_NONE; |
Since: 2.41
typedef struct { gint datano; gint id; } GwyAppDataId;
Auxiliary structure representing one data item in an open file.
The data container number can be obtained with gwy_app_data_browser_get()
and used to look up the container with
gwy_app_data_browser_get_number()
.
Numeric identifier of data container. Zero is used for none. |
||
Numeric identifier of a specific data item, such as channel or graph number. Value -1 is used for none. |
Since: 2.41
typedef struct _GwyDataChooser GwyDataChooser;
typedef struct _GwyDataChooserClass GwyDataChooserClass;