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 	/** */
80 	public static GType getType()
81 	{
82 		return gtk_text_attributes_get_type();
83 	}
84 
85 	/**
86 	 * Creates a #GtkTextAttributes, which describes
87 	 * a set of properties on some text.
88 	 *
89 	 * Return: a new #GtkTextAttributes,
90 	 *     free with gtk_text_attributes_unref().
91 	 *
92 	 * Throws: ConstructionException GTK+ fails to create the object.
93 	 */
94 	public this()
95 	{
96 		auto p = gtk_text_attributes_new();
97 		
98 		if(p is null)
99 		{
100 			throw new ConstructionException("null returned by new");
101 		}
102 		
103 		this(cast(GtkTextAttributes*) p);
104 	}
105 
106 	/**
107 	 * Copies @src and returns a new #GtkTextAttributes.
108 	 *
109 	 * Return: a copy of @src,
110 	 *     free with gtk_text_attributes_unref()
111 	 */
112 	public TextAttributes copy()
113 	{
114 		auto p = gtk_text_attributes_copy(gtkTextAttributes);
115 		
116 		if(p is null)
117 		{
118 			return null;
119 		}
120 		
121 		return ObjectG.getDObject!(TextAttributes)(cast(GtkTextAttributes*) p);
122 	}
123 
124 	/**
125 	 * Copies the values from @src to @dest so that @dest has
126 	 * the same values as @src. Frees existing values in @dest.
127 	 *
128 	 * Params:
129 	 *     dest = another #GtkTextAttributes
130 	 */
131 	public void copyValues(TextAttributes dest)
132 	{
133 		gtk_text_attributes_copy_values(gtkTextAttributes, (dest is null) ? null : dest.getTextAttributesStruct());
134 	}
135 
136 	/**
137 	 * Increments the reference count on @values.
138 	 *
139 	 * Return: the #GtkTextAttributes that were passed in
140 	 */
141 	public TextAttributes doref()
142 	{
143 		auto p = gtk_text_attributes_ref(gtkTextAttributes);
144 		
145 		if(p is null)
146 		{
147 			return null;
148 		}
149 		
150 		return ObjectG.getDObject!(TextAttributes)(cast(GtkTextAttributes*) p);
151 	}
152 
153 	/**
154 	 * Decrements the reference count on @values, freeing the structure
155 	 * if the reference count reaches 0.
156 	 */
157 	public void unref()
158 	{
159 		gtk_text_attributes_unref(gtkTextAttributes);
160 	}
161 }