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  * Description
71  * Attributed text is used in a number of places in Pango. It
72  * is used as the input to the itemization process and also when
73  * creating a PangoLayout. The data types and functions in
74  * this section are used to represent and manipulate sets
75  * of attributes applied to a portion of text.
76  */
77 public class PgColor
78 {
79 	
80 	/** the main Gtk struct */
81 	protected PangoColor* pangoColor;
82 	
83 	
84 	public PangoColor* getPgColorStruct()
85 	{
86 		return pangoColor;
87 	}
88 	
89 	
90 	/** the main Gtk struct as a void* */
91 	protected void* getStruct()
92 	{
93 		return cast(void*)pangoColor;
94 	}
95 	
96 	/**
97 	 * Sets our main struct and passes it to the parent class
98 	 */
99 	public this (PangoColor* pangoColor)
100 	{
101 		this.pangoColor = pangoColor;
102 	}
103 	
104 	/**
105 	 */
106 	
107 	/**
108 	 * Fill in the fields of a color from a string specification. The
109 	 * string can either one of a large set of standard names. (Taken
110 	 * from the X11 rgb.txt file), or it can be a hex value in the
111 	 * form '#rgb' '#rrggbb' '#rrrgggbbb' or '#rrrrggggbbbb' where
112 	 * 'r', 'g' and 'b' are hex digits of the red, green, and blue
113 	 * components of the color, respectively. (White in the four
114 	 * forms is '#fff' '#ffffff' '#fffffffff' and '#ffffffffffff')
115 	 * Params:
116 	 * spec = a string specifying the new color
117 	 * Returns: TRUE if parsing of the specifier succeeded, otherwise false.
118 	 */
119 	public int parse(string spec)
120 	{
121 		// gboolean pango_color_parse (PangoColor *color,  const char *spec);
122 		return pango_color_parse(pangoColor, Str.toStringz(spec));
123 	}
124 	
125 	/**
126 	 * Creates a copy of src, which should be freed with
127 	 * pango_color_free(). Primarily used by language bindings,
128 	 * not that useful otherwise (since colors can just be copied
129 	 * by assignment in C).
130 	 * Returns: the newly allocated PangoColor, which should be freed with pango_color_free(), or NULL if src was NULL.
131 	 */
132 	public PgColor copy()
133 	{
134 		// PangoColor * pango_color_copy (const PangoColor *src);
135 		auto p = pango_color_copy(pangoColor);
136 		
137 		if(p is null)
138 		{
139 			return null;
140 		}
141 		
142 		return ObjectG.getDObject!(PgColor)(cast(PangoColor*) p);
143 	}
144 	
145 	/**
146 	 * Frees a color allocated by pango_color_copy().
147 	 */
148 	public void free()
149 	{
150 		// void pango_color_free (PangoColor *color);
151 		pango_color_free(pangoColor);
152 	}
153 	
154 	/**
155 	 * Returns a textual specification of color in the hexadecimal form
156 	 * #rrrrggggbbbb, where r,
157 	 * g and b are hex digits representing
158 	 * the red, green, and blue components respectively.
159 	 * Since 1.16
160 	 * Returns: a newly-allocated text string that must be freed with g_free().
161 	 */
162 	public override string toString()
163 	{
164 		// gchar * pango_color_to_string (const PangoColor *color);
165 		return Str.toString(pango_color_to_string(pangoColor));
166 	}
167 }