Logo Search packages:      
Sourcecode: gnome-compiz-manager version File versions

gcm-gl-color.c

/* Generated by GOB (v2.0.14)   (do not edit directly) */

/* End world hunger, donate to the World Food Programme, http://www.wfp.org */

#define GOB_VERSION_MAJOR 2
#define GOB_VERSION_MINOR 0
#define GOB_VERSION_PATCHLEVEL 14

#define selfp (self->_priv)

#include <string.h> /* memset() */

#include "gcm-gl-color.h"

#ifdef G_LIKELY
#define ___GOB_LIKELY(expr) G_LIKELY(expr)
#define ___GOB_UNLIKELY(expr) G_UNLIKELY(expr)
#else /* ! G_LIKELY */
#define ___GOB_LIKELY(expr) (expr)
#define ___GOB_UNLIKELY(expr) (expr)
#endif /* G_LIKELY */
/* self casting macros */
#define SELF(x) GCM_GL_COLOR(x)
#define SELF_CONST(x) GCM_GL_COLOR_CONST(x)
#define IS_SELF(x) GCM_IS_GL_COLOR(x)
#define TYPE_SELF GCM_TYPE_GL_COLOR
#define SELF_CLASS(x) GCM_GL_COLOR_CLASS(x)

#define SELF_GET_CLASS(x) GCM_GL_COLOR_GET_CLASS(x)

/* self typedefs */
typedef GCMGLColor Self;
typedef GCMGLColorClass SelfClass;

/* here are local prototypes */
static void gcm_gl_color_init (GCMGLColor * o) G_GNUC_UNUSED;
static void gcm_gl_color_class_init (GCMGLColorClass * c) G_GNUC_UNUSED;

/* pointer to the class of our parent */
static GObjectClass *parent_class = NULL;

/* Short form macros */
#define self_new_with_string gcm_gl_color_new_with_string
#define self_new_with_gdk_color gcm_gl_color_new_with_gdk_color
#define self_to_string gcm_gl_color_to_string
#define self_to_gdk_color gcm_gl_color_to_gdk_color
GType
gcm_gl_color_get_type (void)
{
      static GType type = 0;

      if ___GOB_UNLIKELY(type == 0) {
            static const GTypeInfo info = {
                  sizeof (GCMGLColorClass),
                  (GBaseInitFunc) NULL,
                  (GBaseFinalizeFunc) NULL,
                  (GClassInitFunc) gcm_gl_color_class_init,
                  (GClassFinalizeFunc) NULL,
                  NULL /* class_data */,
                  sizeof (GCMGLColor),
                  0 /* n_preallocs */,
                  (GInstanceInitFunc) gcm_gl_color_init,
                  NULL
            };

            type = g_type_register_static (G_TYPE_OBJECT, "GCMGLColor", &info, (GTypeFlags)0);
      }

      return type;
}

/* a macro for creating a new object of our type */
#define GET_NEW ((GCMGLColor *)g_object_new(gcm_gl_color_get_type(), NULL))

/* a function for creating a new object of our type */
#include <stdarg.h>
static GCMGLColor * GET_NEW_VARG (const char *first, ...) G_GNUC_UNUSED;
static GCMGLColor *
GET_NEW_VARG (const char *first, ...)
{
      GCMGLColor *ret;
      va_list ap;
      va_start (ap, first);
      ret = (GCMGLColor *)g_object_new_valist (gcm_gl_color_get_type (), first, ap);
      va_end (ap);
      return ret;
}

static void 
gcm_gl_color_init (GCMGLColor * o G_GNUC_UNUSED)
{
#define __GOB_FUNCTION__ "GCM:GL:Color::init"
}
#undef __GOB_FUNCTION__
static void 
gcm_gl_color_class_init (GCMGLColorClass * c G_GNUC_UNUSED)
{
#define __GOB_FUNCTION__ "GCM:GL:Color::class_init"

      parent_class = g_type_class_ref (G_TYPE_OBJECT);

}
#undef __GOB_FUNCTION__



#line 34 "gcm-gl-color.gob"
GCMGLColor * 
gcm_gl_color_new_with_string (gchar * color)
#line 111 "gcm-gl-color.c"
{
#define __GOB_FUNCTION__ "GCM:GL:Color::new_with_string"
#line 34 "gcm-gl-color.gob"
      g_return_val_if_fail (color != NULL, (GCMGLColor * )NULL);
#line 116 "gcm-gl-color.c"
{
#line 36 "gcm-gl-color.gob"
      
            gint c[4];
            
      if (sscanf(color, "#%2x%2x%2x%2x", &c[0], &c[1], &c[2], &c[3]) == 4)
      {
                  GCMGLColor * self = GET_NEW;
            
                  self->red = c[0] << 8 | c[0];
                  self->green = c[1] << 8 | c[1];
                  self->blue = c[2] << 8 | c[2];
                  self->alpha = c[3] << 8 | c[3];

                  return self;
      }

      return NULL;
      }}
#line 136 "gcm-gl-color.c"
#undef __GOB_FUNCTION__

#line 54 "gcm-gl-color.gob"
GCMGLColor * 
gcm_gl_color_new_with_gdk_color (GdkColor * color, guint16 alpha)
#line 142 "gcm-gl-color.c"
{
#define __GOB_FUNCTION__ "GCM:GL:Color::new_with_gdk_color"
#line 54 "gcm-gl-color.gob"
      g_return_val_if_fail (color != NULL, (GCMGLColor * )NULL);
#line 147 "gcm-gl-color.c"
{
#line 56 "gcm-gl-color.gob"
      
            GCMGLColor * self = GET_NEW;
            
            self->red = color->red;
            self->green = color->green;
            self->blue = color->blue;
            self->alpha = alpha;

            return self;
      }}
#line 160 "gcm-gl-color.c"
#undef __GOB_FUNCTION__

#line 67 "gcm-gl-color.gob"
gchar * 
gcm_gl_color_to_string (GCMGLColor * self)
#line 166 "gcm-gl-color.c"
{
#define __GOB_FUNCTION__ "GCM:GL:Color::to_string"
#line 67 "gcm-gl-color.gob"
      g_return_val_if_fail (self != NULL, (gchar * )NULL);
#line 67 "gcm-gl-color.gob"
      g_return_val_if_fail (GCM_IS_GL_COLOR (self), (gchar * )NULL);
#line 173 "gcm-gl-color.c"
{
#line 69 "gcm-gl-color.gob"
      
      return g_strdup_printf("#%.2x%.2x%.2x%.2x",
                                             self->red / 256, self->green / 256, 
                                             self->blue / 256, self->alpha / 256);
      }}
#line 181 "gcm-gl-color.c"
#undef __GOB_FUNCTION__

#line 75 "gcm-gl-color.gob"
GdkColor * 
gcm_gl_color_to_gdk_color (GCMGLColor * self)
#line 187 "gcm-gl-color.c"
{
#define __GOB_FUNCTION__ "GCM:GL:Color::to_gdk_color"
#line 75 "gcm-gl-color.gob"
      g_return_val_if_fail (self != NULL, (GdkColor * )0);
#line 75 "gcm-gl-color.gob"
      g_return_val_if_fail (GCM_IS_GL_COLOR (self), (GdkColor * )0);
#line 194 "gcm-gl-color.c"
{
#line 77 "gcm-gl-color.gob"
      
            GdkColor * color = g_new0(GdkColor, 1);
            
            color->red = self->red;
            color->green = self->green;
            color->blue = self->blue;
            
            return color;
      }}
#line 206 "gcm-gl-color.c"
#undef __GOB_FUNCTION__

Generated by  Doxygen 1.6.0   Back to index