1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = 
27  * outPack = pango
28  * outFile = PgColor
29  * strct   = PangoColor
30  * realStrct=
31  * ctorStrct=
32  * clss    = PgColor
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- pango_color_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * structWrap:
48  * 	- PangoColor* -> PgColor
49  * module aliases:
50  * local aliases:
51  * overrides:
52  * 	- toString
53  */
54 
55 module pango.PgColor;
56 
57 public  import gtkc.pangotypes;
58 
59 private import gtkc.pango;
60 private import glib.ConstructionException;
61 private import gobject.ObjectG;
62 
63 
64 private import glib.Str;
65 
66 
67 
68 
69 /**
70  * Attributed text is used in a number of places in Pango. It
71  * is used as the input to the itemization process and also when
72  * creating a PangoLayout. The data types and functions in
73  * this section are used to represent and manipulate sets
74  * of attributes applied to a portion of text.
75  */
76 public class PgColor
77 {
78 	
79 	/** the main Gtk struct */
80 	protected PangoColor* pangoColor;
81 	
82 	
83 	public PangoColor* getPgColorStruct()
84 	{
85 		return pangoColor;
86 	}
87 	
88 	
89 	/** the main Gtk struct as a void* */
90 	protected void* getStruct()
91 	{
92 		return cast(void*)pangoColor;
93 	}
94 	
95 	/**
96 	 * Sets our main struct and passes it to the parent class
97 	 */
98 	public this (PangoColor* pangoColor)
99 	{
100 		this.pangoColor = pangoColor;
101 	}
102 	
103 	/**
104 	 */
105 	
106 	/**
107 	 * Fill in the fields of a color from a string specification. The
108 	 * string can either one of a large set of standard names. (Taken
109 	 * from the X11 rgb.txt file), or it can be a hex value in the
110 	 * form '#rgb' '#rrggbb' '#rrrgggbbb' or '#rrrrggggbbbb' where
111 	 * 'r', 'g' and 'b' are hex digits of the red, green, and blue
112 	 * components of the color, respectively. (White in the four
113 	 * forms is '#fff' '#ffffff' '#fffffffff' and '#ffffffffffff')
114 	 * Params:
115 	 * spec = a string specifying the new color
116 	 * Returns: TRUE if parsing of the specifier succeeded, otherwise false.
117 	 */
118 	public int parse(string spec)
119 	{
120 		// gboolean pango_color_parse (PangoColor *color,  const char *spec);
121 		return pango_color_parse(pangoColor, Str.toStringz(spec));
122 	}
123 	
124 	/**
125 	 * Creates a copy of src, which should be freed with
126 	 * pango_color_free(). Primarily used by language bindings,
127 	 * not that useful otherwise (since colors can just be copied
128 	 * by assignment in C).
129 	 * Returns: the newly allocated PangoColor, which should be freed with pango_color_free(), or NULL if src was NULL.
130 	 */
131 	public PgColor copy()
132 	{
133 		// PangoColor * pango_color_copy (const PangoColor *src);
134 		auto p = pango_color_copy(pangoColor);
135 		
136 		if(p is null)
137 		{
138 			return null;
139 		}
140 		
141 		return ObjectG.getDObject!(PgColor)(cast(PangoColor*) p);
142 	}
143 	
144 	/**
145 	 * Frees a color allocated by pango_color_copy().
146 	 */
147 	public void free()
148 	{
149 		// void pango_color_free (PangoColor *color);
150 		pango_color_free(pangoColor);
151 	}
152 	
153 	/**
154 	 * Returns a textual specification of color in the hexadecimal form
155 	 * #rrrrggggbbbb, where r,
156 	 * g and b are hex digits representing
157 	 * the red, green, and blue components respectively.
158 	 * Since 1.16
159 	 * Returns: a newly-allocated text string that must be freed with g_free().
160 	 */
161 	public override string toString()
162 	{
163 		// gchar * pango_color_to_string (const PangoColor *color);
164 		return Str.toString(pango_color_to_string(pangoColor));
165 	}
166 }