glib/tsrc/glib_nonstif/tests/gobject/mambaz.h
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
       
     3 *
       
     4 * This library is free software; you can redistribute it and/or
       
     5 * modify it under the terms of the GNU Lesser General Public
       
     6 * License as published by the Free Software Foundation; either
       
     7 * version 2 of the License, or (at your option) any later version.
       
     8 *
       
     9 * This library is distributed in the hope that it will be useful,
       
    10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    12 * Lesser General Public License for more details.
       
    13 *
       
    14 * You should have received a copy of the GNU Lesser General Public
       
    15 * License along with this library; if not, write to the
       
    16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    17 * Boston, MA 02111-1307, USA.
       
    18 *
       
    19 * Description:
       
    20 *
       
    21 */
       
    22 
       
    23 
       
    24 #ifndef __DERIVED_H__
       
    25 #define __DERIVED_H__
       
    26 
       
    27 #include <glib-object.h>
       
    28 
       
    29 #define MAMAN_TYPE_IBAZ                (maman_ibaz_get_type ())
       
    30 #define MAMAN_IBAZ(obj)                (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_IBAZ, MamanIbaz))
       
    31 #define MAMAN_IS_IBAZ(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_IBAZ))
       
    32 #define MAMAN_IBAZ_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), MAMAN_TYPE_IBAZ, MamanIbazInterface))
       
    33 
       
    34 
       
    35 typedef struct _MamanIbaz MamanIbaz; /* dummy object */
       
    36 typedef struct _MamanIbazInterface MamanIbazInterface;
       
    37 
       
    38 struct _MamanIbazInterface {
       
    39   GTypeInterface parent;
       
    40 
       
    41   void (*do_action) (MamanIbaz *self);
       
    42 };
       
    43 
       
    44 GType maman_ibaz_get_type (void);
       
    45 
       
    46 void maman_ibaz_do_action (MamanIbaz *self);
       
    47 
       
    48 //that was the interface class
       
    49 //now the derived class
       
    50 
       
    51 #include <glib-object.h>
       
    52 
       
    53 #define MAMAN_TYPE_BAZ             (baz_type)
       
    54 #define MAMAN_BAZ(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAZ, MamanBaz))
       
    55 #define MAMAN_BAZ_CLASS(vtable)    (G_TYPE_CHECK_CLASS_CAST ((vtable), MAMAN_TYPE_BAZ, MamanbazClass))
       
    56 #define MAMAN_IS_BAZ(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAZ))
       
    57 #define MAMAN_IS_BAZ_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MAMAN_TYPE_BAZ))
       
    58 #define MAMAN_BAZ_GET_CLASS(inst)  (G_TYPE_INSTANCE_GET_CLASS ((inst), MAMAN_TYPE_BAZ, MamanbazClass))
       
    59 
       
    60 
       
    61 typedef struct _MamanBaz MamanBaz;
       
    62 typedef struct _MamanBazClass MamanBazClass;
       
    63 
       
    64 struct _MamanBaz {
       
    65   GObject parent;
       
    66   int instance_member;
       
    67 };
       
    68 
       
    69 struct _MamanBazClass {
       
    70   GObjectClass parent;
       
    71 };
       
    72 
       
    73 GType maman_baz_get_type (void);
       
    74 
       
    75 void baz_do_action (MamanBaz *self);
       
    76 void baz_instance_init (GTypeInstance   *instance, gpointer         g_class);
       
    77 void baz_interface_init (gpointer   g_iface,gpointer   iface_data);
       
    78 
       
    79 
       
    80 
       
    81 
       
    82 #endif // __DERIVED_H__