Logo Search packages:      
Sourcecode: libdesktop-agnostic version File versions  Download package

color.h

/* 
 * Extension to Gdk.Color which has support for an alpha channel.
 *
 * Copyright (C) 2008, 2009 Mark Lee <libdesktop-agnostic@lazymalevolence.com>
 *
 * 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.1 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 *
 * Author : Mark Lee <libdesktop-agnostic@lazymalevolence.com>
 */

#ifndef __LIBDESKTOP_AGNOSTIC_COLOR_H__
#define __LIBDESKTOP_AGNOSTIC_COLOR_H__

#include <glib.h>
#include <glib-object.h>
#include <gdk/gdk.h>
#include <stdlib.h>
#include <string.h>

G_BEGIN_DECLS


#define DESKTOP_AGNOSTIC_TYPE_COLOR (desktop_agnostic_color_get_type ())
#define DESKTOP_AGNOSTIC_COLOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_TYPE_COLOR, DesktopAgnosticColor))
#define DESKTOP_AGNOSTIC_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_TYPE_COLOR, DesktopAgnosticColorClass))
#define DESKTOP_AGNOSTIC_IS_COLOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_TYPE_COLOR))
#define DESKTOP_AGNOSTIC_IS_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_TYPE_COLOR))
#define DESKTOP_AGNOSTIC_COLOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_TYPE_COLOR, DesktopAgnosticColorClass))

typedef struct _DesktopAgnosticColor DesktopAgnosticColor;
typedef struct _DesktopAgnosticColorClass DesktopAgnosticColorClass;
typedef struct _DesktopAgnosticColorPrivate DesktopAgnosticColorPrivate;

typedef enum  {
      DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR_INVALID_INPUT,
      DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR_INVALID_ALPHA
} DesktopAgnosticColorParseError;
#define DESKTOP_AGNOSTIC_COLOR_PARSE_ERROR desktop_agnostic_color_parse_error_quark ()
/**
   * Note: cannot use ushort in properties as Value cannot be mapped to it.
   */
00054 struct _DesktopAgnosticColor {
      GObject parent_instance;
      DesktopAgnosticColorPrivate * priv;
      gushort alpha;
};

struct _DesktopAgnosticColorClass {
      GObjectClass parent_class;
};


GQuark desktop_agnostic_color_parse_error_quark (void);
DesktopAgnosticColor* desktop_agnostic_color_construct (GType object_type, const GdkColor* color, gushort alpha);
DesktopAgnosticColor* desktop_agnostic_color_new (const GdkColor* color, gushort alpha);
DesktopAgnosticColor* desktop_agnostic_color_construct_from_values (GType object_type, gushort red, gushort green, gushort blue, gushort alpha);
DesktopAgnosticColor* desktop_agnostic_color_new_from_values (gushort red, gushort green, gushort blue, gushort alpha);
DesktopAgnosticColor* desktop_agnostic_color_construct_from_string (GType object_type, const char* spec, GError** error);
DesktopAgnosticColor* desktop_agnostic_color_new_from_string (const char* spec, GError** error);
char* desktop_agnostic_color_to_html_color (DesktopAgnosticColor* self);
char* desktop_agnostic_color_to_string (DesktopAgnosticColor* self);
void desktop_agnostic_color_get_color (DesktopAgnosticColor* self, GdkColor* value);
void desktop_agnostic_color_set_color (DesktopAgnosticColor* self, GdkColor* value);
gint desktop_agnostic_color_get_red (DesktopAgnosticColor* self);
void desktop_agnostic_color_set_red (DesktopAgnosticColor* self, gint value);
gint desktop_agnostic_color_get_green (DesktopAgnosticColor* self);
void desktop_agnostic_color_set_green (DesktopAgnosticColor* self, gint value);
gint desktop_agnostic_color_get_blue (DesktopAgnosticColor* self);
void desktop_agnostic_color_set_blue (DesktopAgnosticColor* self, gint value);
GType desktop_agnostic_color_get_type (void);


G_END_DECLS

#endif

Generated by  Doxygen 1.6.0   Back to index