PIKApp/libpikabase/pikaparamspecs.h

372 lines
13 KiB
C

/* LIBPIKA - The PIKA Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* pikaparamspecs.h
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <https://www.gnu.org/licenses/>.
*/
#if !defined (__PIKA_BASE_H_INSIDE__) && !defined (PIKA_BASE_COMPILATION)
#error "Only <libpikabase/pikabase.h> can be included directly."
#endif
#ifndef __PIKA_PARAM_SPECS_H__
#define __PIKA_PARAM_SPECS_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
/**
* PIKA_PARAM_NO_VALIDATE:
*
* Since 3.0
*/
/*
* Keep in sync with libpikaconfig/pikaconfig-params.h
*/
#define PIKA_PARAM_NO_VALIDATE (1 << (6 + G_PARAM_USER_SHIFT))
/**
* PIKA_PARAM_STATIC_STRINGS:
*
* Since: 2.4
**/
#define PIKA_PARAM_STATIC_STRINGS (G_PARAM_STATIC_NAME | \
G_PARAM_STATIC_NICK | \
G_PARAM_STATIC_BLURB)
/**
* PIKA_PARAM_READABLE:
*
* Since: 2.4
**/
#define PIKA_PARAM_READABLE (G_PARAM_READABLE | \
PIKA_PARAM_STATIC_STRINGS)
/**
* PIKA_PARAM_WRITABLE:
*
* Since: 2.4
**/
#define PIKA_PARAM_WRITABLE (G_PARAM_WRITABLE | \
PIKA_PARAM_STATIC_STRINGS)
/**
* PIKA_PARAM_READWRITE:
*
* Since: 2.4
**/
#define PIKA_PARAM_READWRITE (G_PARAM_READWRITE | \
PIKA_PARAM_STATIC_STRINGS)
/*
* PIKA_TYPE_PARAM_CHOICE
*/
#define PIKA_TYPE_PARAM_CHOICE (pika_param_choice_get_type ())
#define PIKA_PARAM_SPEC_CHOICE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), PIKA_TYPE_PARAM_CHOICE, PikaParamSpecChoice))
#define PIKA_IS_PARAM_SPEC_CHOICE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), PIKA_TYPE_PARAM_CHOICE))
typedef struct _PikaParamSpecChoice PikaParamSpecChoice;
struct _PikaParamSpecChoice
{
GParamSpecBoxed parent_instance;
gchar *default_value;
PikaChoice *choice;
};
GType pika_param_choice_get_type (void) G_GNUC_CONST;
GParamSpec * pika_param_spec_choice (const gchar *name,
const gchar *nick,
const gchar *blurb,
PikaChoice *choice,
const gchar *default_value,
GParamFlags flags);
/*
* PIKA_TYPE_ARRAY
*/
/**
* PikaArray:
* @data: (array length=length): pointer to the array's data.
* @length: length of @data, in bytes.
* @static_data: whether @data points to statically allocated memory.
**/
typedef struct _PikaArray PikaArray;
struct _PikaArray
{
guint8 *data;
gsize length;
gboolean static_data;
};
PikaArray * pika_array_new (const guint8 *data,
gsize length,
gboolean static_data);
PikaArray * pika_array_copy (const PikaArray *array);
void pika_array_free (PikaArray *array);
#define PIKA_TYPE_ARRAY (pika_array_get_type ())
#define PIKA_VALUE_HOLDS_ARRAY(value) (G_TYPE_CHECK_VALUE_TYPE ((value), PIKA_TYPE_ARRAY))
GType pika_array_get_type (void) G_GNUC_CONST;
/*
* PIKA_TYPE_PARAM_ARRAY
*/
#define PIKA_TYPE_PARAM_ARRAY (pika_param_array_get_type ())
#define PIKA_PARAM_SPEC_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), PIKA_TYPE_PARAM_ARRAY, PikaParamSpecArray))
#define PIKA_IS_PARAM_SPEC_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), PIKA_TYPE_PARAM_ARRAY))
typedef struct _PikaParamSpecArray PikaParamSpecArray;
struct _PikaParamSpecArray
{
GParamSpecBoxed parent_instance;
};
GType pika_param_array_get_type (void) G_GNUC_CONST;
GParamSpec * pika_param_spec_array (const gchar *name,
const gchar *nick,
const gchar *blurb,
GParamFlags flags);
/*
* PIKA_TYPE_INT32_ARRAY
*/
#define PIKA_TYPE_INT32_ARRAY (pika_int32_array_get_type ())
#define PIKA_VALUE_HOLDS_INT32_ARRAY(value) (G_TYPE_CHECK_VALUE_TYPE ((value), PIKA_TYPE_INT32_ARRAY))
GType pika_int32_array_get_type (void) G_GNUC_CONST;
/*
* PIKA_TYPE_PARAM_INT32_ARRAY
*/
#define PIKA_TYPE_PARAM_INT32_ARRAY (pika_param_int32_array_get_type ())
#define PIKA_PARAM_SPEC_INT32_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), PIKA_TYPE_PARAM_INT32_ARRAY, PikaParamSpecInt32Array))
#define PIKA_IS_PARAM_SPEC_INT32_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), PIKA_TYPE_PARAM_INT32_ARRAY))
typedef struct _PikaParamSpecInt32Array PikaParamSpecInt32Array;
struct _PikaParamSpecInt32Array
{
PikaParamSpecArray parent_instance;
};
GType pika_param_int32_array_get_type (void) G_GNUC_CONST;
GParamSpec * pika_param_spec_int32_array (const gchar *name,
const gchar *nick,
const gchar *blurb,
GParamFlags flags);
const gint32 * pika_value_get_int32_array (const GValue *value);
gint32 * pika_value_dup_int32_array (const GValue *value);
void pika_value_set_int32_array (GValue *value,
const gint32 *data,
gsize length);
void pika_value_set_static_int32_array (GValue *value,
const gint32 *data,
gsize length);
void pika_value_take_int32_array (GValue *value,
gint32 *data,
gsize length);
/*
* PIKA_TYPE_FLOAT_ARRAY
*/
#define PIKA_TYPE_FLOAT_ARRAY (pika_float_array_get_type ())
#define PIKA_VALUE_HOLDS_FLOAT_ARRAY(value) (G_TYPE_CHECK_VALUE_TYPE ((value), PIKA_TYPE_FLOAT_ARRAY))
GType pika_float_array_get_type (void) G_GNUC_CONST;
/*
* PIKA_TYPE_PARAM_FLOAT_ARRAY
*/
#define PIKA_TYPE_PARAM_FLOAT_ARRAY (pika_param_float_array_get_type ())
#define PIKA_PARAM_SPEC_FLOAT_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), PIKA_TYPE_PARAM_FLOAT_ARRAY, PikaParamSpecFloatArray))
#define PIKA_IS_PARAM_SPEC_FLOAT_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), PIKA_TYPE_PARAM_FLOAT_ARRAY))
typedef struct _PikaParamSpecFloatArray PikaParamSpecFloatArray;
struct _PikaParamSpecFloatArray
{
PikaParamSpecArray parent_instance;
};
GType pika_param_float_array_get_type (void) G_GNUC_CONST;
GParamSpec * pika_param_spec_float_array (const gchar *name,
const gchar *nick,
const gchar *blurb,
GParamFlags flags);
const gdouble * pika_value_get_float_array (const GValue *value);
gdouble * pika_value_dup_float_array (const GValue *value);
void pika_value_set_float_array (GValue *value,
const gdouble *data,
gsize length);
void pika_value_set_static_float_array (GValue *value,
const gdouble *data,
gsize length);
void pika_value_take_float_array (GValue *value,
gdouble *data,
gsize length);
/*
* PIKA_TYPE_RGB_ARRAY
*/
#define PIKA_TYPE_RGB_ARRAY (pika_rgb_array_get_type ())
#define PIKA_VALUE_HOLDS_RGB_ARRAY(value) (G_TYPE_CHECK_VALUE_TYPE ((value), PIKA_TYPE_RGB_ARRAY))
GType pika_rgb_array_get_type (void) G_GNUC_CONST;
/*
* PIKA_TYPE_PARAM_RGB_ARRAY
*/
#define PIKA_TYPE_PARAM_RGB_ARRAY (pika_param_rgb_array_get_type ())
#define PIKA_PARAM_SPEC_RGB_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), PIKA_TYPE_PARAM_RGB_ARRAY, PikaParamSpecRGBArray))
#define PIKA_IS_PARAM_SPEC_RGB_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), PIKA_TYPE_PARAM_RGB_ARRAY))
typedef struct _PikaParamSpecRGBArray PikaParamSpecRGBArray;
struct _PikaParamSpecRGBArray
{
GParamSpecBoxed parent_instance;
};
GType pika_param_rgb_array_get_type (void) G_GNUC_CONST;
GParamSpec * pika_param_spec_rgb_array (const gchar *name,
const gchar *nick,
const gchar *blurb,
GParamFlags flags);
const PikaRGB * pika_value_get_rgb_array (const GValue *value);
PikaRGB * pika_value_dup_rgb_array (const GValue *value);
void pika_value_set_rgb_array (GValue *value,
const PikaRGB *data,
gsize length);
void pika_value_set_static_rgb_array (GValue *value,
const PikaRGB *data,
gsize length);
void pika_value_take_rgb_array (GValue *value,
PikaRGB *data,
gsize length);
/*
* PIKA_TYPE_OBJECT_ARRAY
*/
/**
* PikaObjectArray:
* @object_type: #GType of the contained objects.
* @data: (array length=length): pointer to the array's data.
* @length: length of @data, in number of objects.
* @static_data: whether @data points to statically allocated memory.
**/
typedef struct _PikaObjectArray PikaObjectArray;
struct _PikaObjectArray
{
GType object_type;
GObject **data;
gsize length;
gboolean static_data;
};
PikaObjectArray * pika_object_array_new (GType object_type,
GObject **data,
gsize length,
gboolean static_data);
PikaObjectArray * pika_object_array_copy (const PikaObjectArray *array);
void pika_object_array_free (PikaObjectArray *array);
#define PIKA_TYPE_OBJECT_ARRAY (pika_object_array_get_type ())
#define PIKA_VALUE_HOLDS_OBJECT_ARRAY(value) (G_TYPE_CHECK_VALUE_TYPE ((value), PIKA_TYPE_OBJECT_ARRAY))
GType pika_object_array_get_type (void) G_GNUC_CONST;
/*
* PIKA_TYPE_PARAM_OBJECT_ARRAY
*/
#define PIKA_TYPE_PARAM_OBJECT_ARRAY (pika_param_object_array_get_type ())
#define PIKA_PARAM_SPEC_OBJECT_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), PIKA_TYPE_PARAM_OBJECT_ARRAY, PikaParamSpecObjectArray))
#define PIKA_IS_PARAM_SPEC_OBJECT_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), PIKA_TYPE_PARAM_OBJECT_ARRAY))
typedef struct _PikaParamSpecObjectArray PikaParamSpecObjectArray;
struct _PikaParamSpecObjectArray
{
GParamSpecBoxed parent_instance;
GType object_type;
};
GType pika_param_object_array_get_type (void) G_GNUC_CONST;
GParamSpec * pika_param_spec_object_array (const gchar *name,
const gchar *nick,
const gchar *blurb,
GType object_type,
GParamFlags flags);
GObject ** pika_value_get_object_array (const GValue *value);
GObject ** pika_value_dup_object_array (const GValue *value);
void pika_value_set_object_array (GValue *value,
GType object_type,
GObject **data,
gsize length);
void pika_value_set_static_object_array (GValue *value,
GType object_type,
GObject **data,
gsize length);
void pika_value_take_object_array (GValue *value,
GType object_type,
GObject **data,
gsize length);
G_END_DECLS
#endif /* __PIKA_PARAM_SPECS_H__ */