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 = gtk
28  * outFile = TextAttributes
29  * strct   = GtkTextAttributes
30  * realStrct=
31  * ctorStrct=
32  * clss    = TextAttributes
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_text_attributes_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- gtk.TextAttributes
47  * structWrap:
48  * 	- GtkTextAttributes* -> TextAttributes
49  * module aliases:
50  * local aliases:
51  * overrides:
52  */
53 
54 module gtk.TextAttributes;
55 
56 public  import gtkc.gtktypes;
57 
58 private import gtkc.gtk;
59 private import glib.ConstructionException;
60 private import gobject.ObjectG;
61 
62 private import gobject.Signals;
63 public  import gtkc.gdktypes;
64 
65 private import gtk.TextAttributes;
66 
67 
68 
69 
70 /**
71  * Description
72  * You may wish to begin by reading the text widget
73  * conceptual overview which gives an overview of all the objects and data
74  * types related to the text widget and how they work together.
75  * Tags should be in the GtkTextTagTable for a given GtkTextBuffer
76  * before using them with that buffer.
77  * gtk_text_buffer_create_tag() is the best way to create tags.
78  * See gtk-demo for numerous examples.
79  * The "invisible" property was not implemented for GTK+ 2.0.
80  * It is working (with minor issues) since 2.8.
81  */
82 public class TextAttributes
83 {
84 	
85 	/** the main Gtk struct */
86 	protected GtkTextAttributes* gtkTextAttributes;
87 	
88 	
89 	public GtkTextAttributes* getTextAttributesStruct()
90 	{
91 		return gtkTextAttributes;
92 	}
93 	
94 	
95 	/** the main Gtk struct as a void* */
96 	protected void* getStruct()
97 	{
98 		return cast(void*)gtkTextAttributes;
99 	}
100 	
101 	/**
102 	 * Sets our main struct and passes it to the parent class
103 	 */
104 	public this (GtkTextAttributes* gtkTextAttributes)
105 	{
106 		this.gtkTextAttributes = gtkTextAttributes;
107 	}
108 	
109 	/**
110 	 */
111 	int[string] connectedSignals;
112 	
113 	bool delegate(GObject*, GdkEvent*, GtkTextIter*, TextAttributes)[] onListeners;
114 	/**
115 	 * The ::event signal is emitted when an event occurs on a region of the
116 	 * buffer marked with this tag.
117 	 * TRUE to stop other handlers from being invoked for the
118 	 * event. FALSE to propagate the event further.
119 	 */
120 	void addOn(bool delegate(GObject*, GdkEvent*, GtkTextIter*, TextAttributes) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
121 	{
122 		if ( !("event" in connectedSignals) )
123 		{
124 			Signals.connectData(
125 			getStruct(),
126 			"event",
127 			cast(GCallback)&callBack,
128 			cast(void*)this,
129 			null,
130 			connectFlags);
131 			connectedSignals["event"] = 1;
132 		}
133 		onListeners ~= dlg;
134 	}
135 	extern(C) static gboolean callBack(GtkTextTag* tagStruct, GObject* object, GdkEvent* event, GtkTextIter* iter, TextAttributes _textAttributes)
136 	{
137 		foreach ( bool delegate(GObject*, GdkEvent*, GtkTextIter*, TextAttributes) dlg ; _textAttributes.onListeners )
138 		{
139 			if ( dlg(object, event, iter, _textAttributes) )
140 			{
141 				return 1;
142 			}
143 		}
144 		
145 		return 0;
146 	}
147 	
148 	
149 	/**
150 	 * Creates a GtkTextAttributes, which describes
151 	 * a set of properties on some text.
152 	 * Throws: ConstructionException GTK+ fails to create the object.
153 	 */
154 	public this ()
155 	{
156 		// GtkTextAttributes * gtk_text_attributes_new (void);
157 		auto p = gtk_text_attributes_new();
158 		if(p is null)
159 		{
160 			throw new ConstructionException("null returned by gtk_text_attributes_new()");
161 		}
162 		this(cast(GtkTextAttributes*) p);
163 	}
164 	
165 	/**
166 	 * Copies src and returns a new GtkTextAttributes.
167 	 * Returns: a copy of src
168 	 */
169 	public TextAttributes copy()
170 	{
171 		// GtkTextAttributes * gtk_text_attributes_copy (GtkTextAttributes *src);
172 		auto p = gtk_text_attributes_copy(gtkTextAttributes);
173 		
174 		if(p is null)
175 		{
176 			return null;
177 		}
178 		
179 		return ObjectG.getDObject!(TextAttributes)(cast(GtkTextAttributes*) p);
180 	}
181 	
182 	/**
183 	 * Copies the values from src to dest so that dest has the same values
184 	 * as src. Frees existing values in dest.
185 	 * Params:
186 	 * dest = another GtkTextAttributes
187 	 */
188 	public void copyValues(TextAttributes dest)
189 	{
190 		// void gtk_text_attributes_copy_values (GtkTextAttributes *src,  GtkTextAttributes *dest);
191 		gtk_text_attributes_copy_values(gtkTextAttributes, (dest is null) ? null : dest.getTextAttributesStruct());
192 	}
193 	
194 	/**
195 	 * Decrements the reference count on values, freeing the structure
196 	 * if the reference count reaches 0.
197 	 */
198 	public void unref()
199 	{
200 		// void gtk_text_attributes_unref (GtkTextAttributes *values);
201 		gtk_text_attributes_unref(gtkTextAttributes);
202 	}
203 	
204 	/**
205 	 * Increments the reference count on values.
206 	 * Returns: the GtkTextAttributes that were passed in
207 	 */
208 	public TextAttributes doref()
209 	{
210 		// GtkTextAttributes * gtk_text_attributes_ref (GtkTextAttributes *values);
211 		auto p = gtk_text_attributes_ref(gtkTextAttributes);
212 		
213 		if(p is null)
214 		{
215 			return null;
216 		}
217 		
218 		return ObjectG.getDObject!(TextAttributes)(cast(GtkTextAttributes*) p);
219 	}
220 }