Add a header for common types to avoid inclusion hell

This patch adds clutter-types.h, a header file containing some common
structures and enums, shared by different objects.
This commit is contained in:
Emmanuele Bassi 2007-07-26 13:13:23 +00:00
parent 7c29e3edbe
commit b7e063c3ce
7 changed files with 161 additions and 99 deletions

View File

@ -52,6 +52,7 @@ source_h = \
$(srcdir)/clutter-clone-texture.h \
$(srcdir)/clutter-color.h \
$(srcdir)/clutter-container.h \
$(srcdir)/clutter-effect.h \
$(srcdir)/clutter-entry.h \
$(srcdir)/clutter-event.h \
$(srcdir)/clutter-feature.h \
@ -68,7 +69,7 @@ source_h = \
$(srcdir)/clutter-texture.h \
$(srcdir)/clutter-timeline.h \
$(srcdir)/clutter-timeout-pool.h \
$(srcdir)/clutter-effect.h \
$(srcdir)/clutter-types.h \
$(srcdir)/clutter-units.h \
$(srcdir)/clutter-util.h \
$(srcdir)/clutter-vbox.h \

View File

@ -29,16 +29,14 @@
/* clutter-actor.h */
#include <glib-object.h>
#include <clutter/clutter-fixed.h>
#include <clutter/clutter-units.h>
#include <clutter/clutter-color.h>
#include <clutter/clutter-fixed.h>
#include <clutter/clutter-types.h>
#include <clutter/clutter-units.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_GEOMETRY (clutter_geometry_get_type ())
#define CLUTTER_TYPE_ACTOR_BOX (clutter_actor_box_get_type ())
#define CLUTTER_TYPE_VERTEX (clutter_vertex_get_type ())
#define CLUTTER_TYPE_ACTOR (clutter_actor_get_type ())
#define CLUTTER_ACTOR(obj) \
@ -60,49 +58,14 @@ G_BEGIN_DECLS
#define CLUTTER_ACTOR_IS_VISIBLE(e) (CLUTTER_ACTOR_IS_MAPPED (e) && \
CLUTTER_ACTOR_IS_REALIZED (e))
typedef enum { /*< prefix=CLUTTER_GRAVITY >*/
CLUTTER_GRAVITY_NONE = 0,
CLUTTER_GRAVITY_NORTH,
CLUTTER_GRAVITY_NORTH_EAST,
CLUTTER_GRAVITY_EAST,
CLUTTER_GRAVITY_SOUTH_EAST,
CLUTTER_GRAVITY_SOUTH,
CLUTTER_GRAVITY_SOUTH_WEST,
CLUTTER_GRAVITY_WEST,
CLUTTER_GRAVITY_NORTH_WEST,
CLUTTER_GRAVITY_CENTER
} ClutterGravity;
typedef struct _ClutterActor ClutterActor;
typedef struct _ClutterActorClass ClutterActorClass;
typedef struct _ClutterActorBox ClutterActorBox;
typedef struct _ClutterActorPrivate ClutterActorPrivate;
typedef struct _ClutterGeometry ClutterGeometry;
typedef struct _ClutterVertex ClutterVertex;
typedef void (*ClutterCallback) (ClutterActor *actor, gpointer data);
#define CLUTTER_CALLBACK(f) ((ClutterCallback) (f))
/**
* ClutterGeometry:
* @x: X coordinate of the top left corner of an actor
* @y: Y coordinate of the top left corner of an actor
* @width: width of an actor
* @height: height of an actor
*
* Rectangle containing an actor.
*/
struct _ClutterGeometry
{
/*< public >*/
gint x;
gint y;
guint width;
guint height;
};
GType clutter_geometry_get_type (void) G_GNUC_CONST;
/**
* ClutterActorFlags:
* @CLUTTER_ACTOR_MAPPED: the actor has been painted
@ -129,7 +92,8 @@ typedef enum
* #ClutterUnit<!-- -->s, that is are device-independent. If you want to obtain
* the box dimensions in pixels, use clutter_actor_get_geometry().
*/
struct _ClutterActorBox {
struct _ClutterActorBox
{
ClutterUnit x1;
ClutterUnit y1;
ClutterUnit x2;
@ -138,25 +102,6 @@ struct _ClutterActorBox {
GType clutter_actor_box_get_type (void) G_GNUC_CONST;
/**
* ClutterVertex:
* @x: X coordinate of the vertex
* @y: Y coordinate of the vertex
* @z: Z coordinate of the vertex
*
* Vertex of an actor in 3D space, expressed in device independent units.
*
* Since: 0.4
*/
struct _ClutterVertex
{
ClutterUnit x;
ClutterUnit y;
ClutterUnit z;
};
GType clutter_vertex_get_type (void) G_GNUC_CONST;
/**
* ClutterActor:
* @flags: #ClutterActorFlags

View File

@ -26,8 +26,9 @@
#ifndef __CLUTTER_BEHAVIOUR_ROTATE_H__
#define __CLUTTER_BEHAVIOUR_ROTATE_H__
#include <clutter/clutter-behaviour.h>
#include <clutter/clutter-alpha.h>
#include <clutter/clutter-behaviour.h>
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
@ -38,17 +39,6 @@ G_BEGIN_DECLS
#define CLUTTER_IS_BEHAVIOUR_ROTATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BEHAVIOUR_ROTATE))
#define CLUTTER_BEHAVIOUR_ROTATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((klass), CLUTTER_TYPE_BEHAVIOUR_ROTATE, ClutterBehaviourRotateClass))
typedef enum { /*< prefix=CLUTTER >*/
CLUTTER_X_AXIS,
CLUTTER_Y_AXIS,
CLUTTER_Z_AXIS
} ClutterRotateAxis;
typedef enum { /*< prefix=CLUTTER_ROTATE >*/
CLUTTER_ROTATE_CW,
CLUTTER_ROTATE_CCW
} ClutterRotateDirection;
typedef struct _ClutterBehaviourRotate ClutterBehaviourRotate;
typedef struct _ClutterBehaviourRotatePrivate ClutterBehaviourRotatePrivate;
typedef struct _ClutterBehaviourRotateClass ClutterBehaviourRotateClass;

View File

@ -28,9 +28,10 @@
#ifndef __CLUTTER_BEHAVIOUR_SCALE_H__
#define __CLUTTER_BEHAVIOUR_SCALE_H__
#include <clutter/clutter-actor.h>
#include <clutter/clutter-alpha.h>
#include <clutter/clutter-behaviour.h>
#include <clutter/clutter-actor.h>
#include <clutter/clutter-types.h>
G_BEGIN_DECLS

View File

@ -30,34 +30,10 @@
#include <glib-object.h>
#include <clutter/clutter-alpha.h>
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_KNOT (clutter_knot_get_type ())
typedef struct _ClutterKnot ClutterKnot;
/**
* ClutterKnot:
* @x: X coordinate of the knot
* @y: Y coordinate of the knot
*
* Point in a path behaviour.
*
* Since: 0.2
*/
struct _ClutterKnot
{
gint x;
gint y;
};
GType clutter_knot_get_type (void) G_GNUC_CONST;
ClutterKnot *clutter_knot_copy (const ClutterKnot *knot);
void clutter_knot_free (ClutterKnot *knot);
gboolean clutter_knot_equal (const ClutterKnot *knot_a,
const ClutterKnot *knot_b);
#define CLUTTER_TYPE_BEHAVIOUR clutter_behaviour_get_type()
#define CLUTTER_BEHAVIOUR(obj) \

148
clutter/clutter-types.h Normal file
View File

@ -0,0 +1,148 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* 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 2 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __CLUTTER_TYPES_H__
#define __CLUTTER_TYPES_H__
#include <glib-object.h>
#include <clutter/clutter-units.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_GEOMETRY (clutter_geometry_get_type ())
#define CLUTTER_TYPE_KNOT (clutter_knot_get_type ())
#define CLUTTER_TYPE_VERTEX (clutter_vertex_get_type ())
typedef enum { /*< prefix=CLUTTER_GRAVITY >*/
CLUTTER_GRAVITY_NONE = 0,
CLUTTER_GRAVITY_NORTH,
CLUTTER_GRAVITY_NORTH_EAST,
CLUTTER_GRAVITY_EAST,
CLUTTER_GRAVITY_SOUTH_EAST,
CLUTTER_GRAVITY_SOUTH,
CLUTTER_GRAVITY_SOUTH_WEST,
CLUTTER_GRAVITY_WEST,
CLUTTER_GRAVITY_NORTH_WEST,
CLUTTER_GRAVITY_CENTER
} ClutterGravity;
typedef struct _ClutterGeometry ClutterGeometry;
typedef struct _ClutterKnot ClutterKnot;
typedef struct _ClutterVertex ClutterVertex;
/**
* ClutterGeometry:
* @x: X coordinate of the top left corner of an actor
* @y: Y coordinate of the top left corner of an actor
* @width: width of an actor
* @height: height of an actor
*
* Rectangle containing an actor.
*/
struct _ClutterGeometry
{
/*< public >*/
gint x;
gint y;
guint width;
guint height;
};
GType clutter_geometry_get_type (void) G_GNUC_CONST;
/**
* ClutterVertex:
* @x: X coordinate of the vertex
* @y: Y coordinate of the vertex
* @z: Z coordinate of the vertex
*
* Vertex of an actor in 3D space, expressed in device independent units.
*
* Since: 0.4
*/
struct _ClutterVertex
{
ClutterUnit x;
ClutterUnit y;
ClutterUnit z;
};
GType clutter_vertex_get_type (void) G_GNUC_CONST;
/**
* ClutterKnot:
* @x: X coordinate of the knot
* @y: Y coordinate of the knot
*
* Point in a path behaviour.
*
* Since: 0.2
*/
struct _ClutterKnot
{
gint x;
gint y;
};
GType clutter_knot_get_type (void) G_GNUC_CONST;
ClutterKnot *clutter_knot_copy (const ClutterKnot *knot);
void clutter_knot_free (ClutterKnot *knot);
gboolean clutter_knot_equal (const ClutterKnot *knot_a,
const ClutterKnot *knot_b);
/**
* ClutterRotateAxis:
* @CLUTTER_X_AXIS: FIXME
* @CLUTTER_Y_AXIS: FIXME
* @CLUTTER_Z_AXIS: FIXME
*
* FIXME
*
* Since: 0.4
*/
typedef enum { /*< prefix=CLUTTER >*/
CLUTTER_X_AXIS,
CLUTTER_Y_AXIS,
CLUTTER_Z_AXIS
} ClutterRotateAxis;
/**
* ClutterRotateDirection:
* @CLUTTER_ROTATE_CW: Clockwise rotation
* @CLUTTER_ROTATE_CCW: Counter-clockwise rotation
*
* FIXME
*
* Since: 0.4
*/
typedef enum { /*< prefix=CLUTTER_ROTATE >*/
CLUTTER_ROTATE_CW,
CLUTTER_ROTATE_CCW
} ClutterRotateDirection;
G_END_DECLS
#endif /* __CLUTTER_TYPES_H__ */

View File

@ -57,6 +57,7 @@
#include "clutter-texture.h"
#include "clutter-timeout-pool.h"
#include "clutter-timeline.h"
#include "clutter-types.h"
#include "clutter-units.h"
#include "clutter-util.h"
#include "clutter-vbox.h"