sl@0: /* sl@0: * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. sl@0: * sl@0: * This library is free software; you can redistribute it and/or sl@0: * modify it under the terms of the GNU Lesser General Public sl@0: * License as published by the Free Software Foundation; either sl@0: * version 2 of the License, or (at your option) any later version. sl@0: * sl@0: * This library is distributed in the hope that it will be useful, sl@0: * but WITHOUT ANY WARRANTY; without even the implied warranty of sl@0: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU sl@0: * Lesser General Public License for more details. sl@0: * sl@0: * You should have received a copy of the GNU Lesser General Public sl@0: * License along with this library; if not, write to the sl@0: * Free Software Foundation, Inc., 59 Temple Place - Suite 330, sl@0: * Boston, MA 02111-1307, USA. sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: #ifndef __DERIVED_H__ sl@0: #define __DERIVED_H__ sl@0: sl@0: #include sl@0: sl@0: #define MAMAN_TYPE_IBAZ (maman_ibaz_get_type ()) sl@0: #define MAMAN_IBAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_IBAZ, MamanIbaz)) sl@0: #define MAMAN_IS_IBAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_IBAZ)) sl@0: #define MAMAN_IBAZ_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), MAMAN_TYPE_IBAZ, MamanIbazInterface)) sl@0: sl@0: sl@0: typedef struct _MamanIbaz MamanIbaz; /* dummy object */ sl@0: typedef struct _MamanIbazInterface MamanIbazInterface; sl@0: sl@0: struct _MamanIbazInterface { sl@0: GTypeInterface parent; sl@0: sl@0: void (*do_action) (MamanIbaz *self); sl@0: }; sl@0: sl@0: GType maman_ibaz_get_type (void); sl@0: sl@0: void maman_ibaz_do_action (MamanIbaz *self); sl@0: sl@0: //that was the interface class sl@0: //now the derived class sl@0: sl@0: #include sl@0: sl@0: #define MAMAN_TYPE_BAZ (baz_type) sl@0: #define MAMAN_BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAZ, MamanBaz)) sl@0: #define MAMAN_BAZ_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MAMAN_TYPE_BAZ, MamanbazClass)) sl@0: #define MAMAN_IS_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAZ)) sl@0: #define MAMAN_IS_BAZ_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MAMAN_TYPE_BAZ)) sl@0: #define MAMAN_BAZ_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MAMAN_TYPE_BAZ, MamanbazClass)) sl@0: sl@0: sl@0: typedef struct _MamanBaz MamanBaz; sl@0: typedef struct _MamanBazClass MamanBazClass; sl@0: sl@0: struct _MamanBaz { sl@0: GObject parent; sl@0: int instance_member; sl@0: }; sl@0: sl@0: struct _MamanBazClass { sl@0: GObjectClass parent; sl@0: }; sl@0: sl@0: GType maman_baz_get_type (void); sl@0: sl@0: void baz_do_action (MamanBaz *self); sl@0: void baz_instance_init (GTypeInstance *instance, gpointer g_class); sl@0: void baz_interface_init (gpointer g_iface,gpointer iface_data); sl@0: sl@0: sl@0: sl@0: sl@0: #endif // __DERIVED_H__