2013-10-11 23:07:35 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 - Juan Ferrer Toribio
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GVN_PARAM_SPEC_H
|
|
|
|
#define GVN_PARAM_SPEC_H
|
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
|
|
|
|
#define GVN_PARAM_SPEC_LOG_DOMAIN (g_quark_from_string ("GvnParamSpec"))
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GVN_TYPE_PARAM_SPEC:
|
|
|
|
*
|
|
|
|
* The #GType for a boxed type holding a #GvnParamSpec.
|
|
|
|
**/
|
|
|
|
#define GVN_TYPE_PARAM_SPEC (gvn_param_spec_get_type ())
|
|
|
|
|
|
|
|
typedef struct _GvnParamSpec GvnParamSpec;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GvnParamSpec:
|
|
|
|
* @gtype: Type of the param
|
|
|
|
* @editable: %TRUE if value is editable
|
|
|
|
* @null: %TRUE if value can be of type %GVN_TYPE_NULL
|
|
|
|
* @def: Default value
|
|
|
|
**/
|
|
|
|
struct _GvnParamSpec
|
|
|
|
{
|
|
|
|
GType gtype;
|
|
|
|
gboolean editable;
|
|
|
|
gboolean null;
|
|
|
|
GValue * def;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GvnParamError:
|
|
|
|
* @GVN_PARAM_SPEC_ERROR_NOT_EDITABLE: The value can not be edited
|
|
|
|
* @GVN_PARAM_SPEC_ERROR_NOT_NULL: The value can not be NULL
|
|
|
|
* @GVN_PARAM_SPEC_ERROR_WRONG_TYPE: The value have a wrong type
|
|
|
|
**/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GVN_PARAM_SPEC_ERROR_NOT_EDITABLE = 1
|
|
|
|
,GVN_PARAM_SPEC_ERROR_NOT_NULL
|
|
|
|
,GVN_PARAM_SPEC_ERROR_WRONG_TYPE
|
|
|
|
}
|
|
|
|
GvnParamError;
|
|
|
|
|
|
|
|
GType gvn_param_spec_get_type ();
|
|
|
|
GvnParamSpec * gvn_param_spec_new ();
|
|
|
|
GvnParamSpec * gvn_param_spec_new_with_attrs (GType gtype, gboolean editable, gboolean null, const GValue * def);
|
2014-07-16 14:12:57 +00:00
|
|
|
GType gvn_param_spec_get_gtype (const GvnParamSpec * self);
|
|
|
|
void gvn_param_spec_set_gtype (GvnParamSpec * self, GType gtype);
|
|
|
|
gboolean gvn_param_spec_get_editable (const GvnParamSpec * self);
|
|
|
|
void gvn_param_spec_set_editable (GvnParamSpec * self, gboolean editable);
|
|
|
|
gboolean gvn_param_spec_get_null (const GvnParamSpec * self);
|
|
|
|
void gvn_param_spec_set_null (GvnParamSpec * self, gboolean null);
|
|
|
|
const GValue * gvn_param_spec_get_default (const GvnParamSpec * self);
|
|
|
|
void gvn_param_spec_set_default (GvnParamSpec * self, const GValue * def);
|
|
|
|
void gvn_param_spec_merge (GvnParamSpec * self, const GvnParamSpec * merge);
|
|
|
|
gboolean gvn_param_spec_ccopy_value (const GvnParamSpec * self, const GValue * src, GValue * dst);
|
|
|
|
gboolean gvn_param_spec_validate (const GvnParamSpec * self, const GValue * value, GError ** err);
|
|
|
|
void gvn_param_spec_unset (GvnParamSpec * self);
|
|
|
|
GvnParamSpec * gvn_param_spec_copy (const GvnParamSpec * self);
|
|
|
|
void gvn_param_spec_free (GvnParamSpec * self);
|
2013-10-11 23:07:35 +00:00
|
|
|
|
|
|
|
#endif
|