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 module gtk.TextAttributes;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gtkc.Loader;
30 private import gtkc.gtk;
31 public  import gtkc.gtktypes;
32 private import gtkc.paths;
33 
34 
35 /**
36  * Using #GtkTextAttributes directly should rarely be necessary.
37  * It’s primarily useful with gtk_text_iter_get_attributes().
38  * As with most GTK+ structs, the fields in this struct should only
39  * be read, never modified directly.
40  */
41 public class TextAttributes
42 {
43 	/** the main Gtk struct */
44 	protected GtkTextAttributes* gtkTextAttributes;
45 
46 	/** Get the main Gtk struct */
47 	public GtkTextAttributes* getTextAttributesStruct()
48 	{
49 		return gtkTextAttributes;
50 	}
51 
52 	/** the main Gtk struct as a void* */
53 	protected void* getStruct()
54 	{
55 		return cast(void*)gtkTextAttributes;
56 	}
57 
58 	/**
59 	 * Sets our main struct and passes it to the parent class.
60 	 */
61 	public this (GtkTextAttributes* gtkTextAttributes)
62 	{
63 		this.gtkTextAttributes = gtkTextAttributes;
64 	}
65 
66 	~this ()
67 	{
68 		if (  Linker.isLoaded(LIBRARY.GTK) && gtkTextAttributes !is null )
69 		{
70 			gtk_text_attributes_unref(gtkTextAttributes);
71 		}
72 	}
73 	
74 	//TODO: properties ?
75 
76 	/**
77 	 */
78 
79 	public static GType getType()
80 	{
81 		return gtk_text_attributes_get_type();
82 	}
83 
84 	/**
85 	 * Creates a #GtkTextAttributes, which describes
86 	 * a set of properties on some text.
87 	 *
88 	 * Return: a new #GtkTextAttributes,
89 	 *     free with gtk_text_attributes_unref().
90 	 *
91 	 * Throws: ConstructionException GTK+ fails to create the object.
92 	 */
93 	public this()
94 	{
95 		auto p = gtk_text_attributes_new();
96 		
97 		if(p is null)
98 		{
99 			throw new ConstructionException("null returned by new");
100 		}
101 		
102 		this(cast(GtkTextAttributes*) p);
103 	}
104 
105 	/**
106 	 * Copies @src and returns a new #GtkTextAttributes.
107 	 *
108 	 * Return: a copy of @src,
109 	 *     free with gtk_text_attributes_unref()
110 	 */
111 	public TextAttributes copy()
112 	{
113 		auto p = gtk_text_attributes_copy(gtkTextAttributes);
114 		
115 		if(p is null)
116 		{
117 			return null;
118 		}
119 		
120 		return ObjectG.getDObject!(TextAttributes)(cast(GtkTextAttributes*) p);
121 	}
122 
123 	/**
124 	 * Copies the values from @src to @dest so that @dest has
125 	 * the same values as @src. Frees existing values in @dest.
126 	 *
127 	 * Params:
128 	 *     dest = another #GtkTextAttributes
129 	 */
130 	public void copyValues(TextAttributes dest)
131 	{
132 		gtk_text_attributes_copy_values(gtkTextAttributes, (dest is null) ? null : dest.getTextAttributesStruct());
133 	}
134 
135 	/**
136 	 * Increments the reference count on @values.
137 	 *
138 	 * Return: the #GtkTextAttributes that were passed in
139 	 */
140 	public TextAttributes doref()
141 	{
142 		auto p = gtk_text_attributes_ref(gtkTextAttributes);
143 		
144 		if(p is null)
145 		{
146 			return null;
147 		}
148 		
149 		return ObjectG.getDObject!(TextAttributes)(cast(GtkTextAttributes*) p);
150 	}
151 
152 	/**
153 	 * Decrements the reference count on @values, freeing the structure
154 	 * if the reference count reaches 0.
155 	 */
156 	public void unref()
157 	{
158 		gtk_text_attributes_unref(gtkTextAttributes);
159 	}
160 }