X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/657bb8fc94acd80433435209eedb03a80189aeb9..50843c96920d8d1a56140deed00bb3d1792038ed:/src/uibuilder.h?ds=sidebyside diff --git a/src/uibuilder.h b/src/uibuilder.h index 24191d83..cc399ce3 100644 --- a/src/uibuilder.h +++ b/src/uibuilder.h @@ -90,6 +90,10 @@ typedef enum { // Also easier for colours to be set via a function call rather than a static assignment typedef VikLayerParamData (*VikLayerDefaultFunc) ( void ); +// Convert between the value held internally and the value used for display +// e.g. keep the internal value in seconds yet use days in the display +typedef VikLayerParamData (*VikLayerConvertFunc) ( VikLayerParamData ); + typedef struct { VikLayerTypeEnum layer; const gchar *name; @@ -101,6 +105,8 @@ typedef struct { gpointer extra_widget_data; const gchar *tooltip; VikLayerDefaultFunc default_value; + VikLayerConvertFunc convert_to_display; + VikLayerConvertFunc convert_to_internal; } VikLayerParam; enum { @@ -135,6 +141,17 @@ typedef struct { VikLayerParamData vik_lpd_true_default ( void ); VikLayerParamData vik_lpd_false_default ( void ); +typedef enum { + UI_CHG_LAYER = 0, + UI_CHG_PARAM, + UI_CHG_PARAM_ID, + UI_CHG_WIDGETS, + UI_CHG_LABELS, + UI_CHG_LAST +} ui_change_index; + +typedef gpointer ui_change_values[UI_CHG_LAST]; + GtkWidget *a_uibuilder_new_widget ( VikLayerParam *param, VikLayerParamData data ); VikLayerParamData a_uibuilder_widget_get_value ( GtkWidget *widget, VikLayerParam *param ); gint a_uibuilder_properties_factory ( const gchar *dialog_name, @@ -143,11 +160,12 @@ gint a_uibuilder_properties_factory ( const gchar *dialog_name, guint16 params_count, gchar **groups, guint8 groups_count, - gboolean (*setparam) (gpointer,guint16,VikLayerParamData,gpointer,gboolean), + gboolean (*setparam) (gpointer,guint16,VikLayerParamData,gpointer,gboolean), // AKA VikLayerFuncSetParam in viklayer.h gpointer pass_along1, gpointer pass_along2, - VikLayerParamData (*getparam) (gpointer,guint16,gboolean), - gpointer pass_along_getparam ); + VikLayerParamData (*getparam) (gpointer,guint16,gboolean), // AKA VikLayerFuncGetParam in viklayer.h + gpointer pass_along_getparam, + void (*changeparam) (GtkWidget*, ui_change_values) ); // AKA VikLayerFuncChangeParam in viklayer.h /* pass_along1 and pass_along2 are for set_param first and last params */ VikLayerParamData *a_uibuilder_run_dialog ( const gchar *dialog_name, GtkWindow *parent, VikLayerParam *params, @@ -157,6 +175,27 @@ VikLayerParamData *a_uibuilder_run_dialog ( const gchar *dialog_name, GtkWindow /* frees data from last (if ness) */ void a_uibuilder_free_paramdatas ( VikLayerParamData *paramdatas, VikLayerParam *params, guint16 params_count ); +/* + * Since combo boxes are used in various places + * keep the code reasonably tidy and only have one ifdef to cater for the naming variances + */ +#if GTK_CHECK_VERSION (2, 24, 0) +#define vik_combo_box_text_new gtk_combo_box_text_new +#define vik_combo_box_text_append(X,Y) gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(X),Y) +#else +#define vik_combo_box_text_new gtk_combo_box_new_text +#define vik_combo_box_text_append(X,Y) gtk_combo_box_append_text(GTK_COMBO_BOX(X),Y) +#endif + +// Consider adding sort options such as by time +// However use within the treeview then is more complicated as one would need to store that data in the treeview... +typedef enum { + VL_SO_NONE = 0, + VL_SO_ALPHABETICAL_ASCENDING, + VL_SO_ALPHABETICAL_DESCENDING, + VL_SO_LAST +} vik_layer_sort_order_t; + G_END_DECLS #endif