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.TextTag; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gtk.c.functions; 31 public import gtk.c.types; 32 33 34 /** 35 * A tag that can be applied to text contained in a `GtkTextBuffer`. 36 * 37 * You may wish to begin by reading the 38 * [text widget conceptual overview](section-text-widget.html), 39 * which gives an overview of all the objects and data types 40 * related to the text widget and how they work together. 41 * 42 * Tags should be in the [class@Gtk.TextTagTable] for a given 43 * `GtkTextBuffer` before using them with that buffer. 44 * 45 * [method@Gtk.TextBuffer.create_tag] is the best way to create tags. 46 * See “gtk4-demo” for numerous examples. 47 * 48 * For each property of `GtkTextTag`, there is a “set” property, e.g. 49 * “font-set” corresponds to “font”. These “set” properties reflect 50 * whether a property has been set or not. 51 * 52 * They are maintained by GTK and you should not set them independently. 53 */ 54 public class TextTag : ObjectG 55 { 56 /** the main Gtk struct */ 57 protected GtkTextTag* gtkTextTag; 58 59 /** Get the main Gtk struct */ 60 public GtkTextTag* getTextTagStruct(bool transferOwnership = false) 61 { 62 if (transferOwnership) 63 ownedRef = false; 64 return gtkTextTag; 65 } 66 67 /** the main Gtk struct as a void* */ 68 protected override void* getStruct() 69 { 70 return cast(void*)gtkTextTag; 71 } 72 73 /** 74 * Sets our main struct and passes it to the parent class. 75 */ 76 public this (GtkTextTag* gtkTextTag, bool ownedRef = false) 77 { 78 this.gtkTextTag = gtkTextTag; 79 super(cast(GObject*)gtkTextTag, ownedRef); 80 } 81 82 83 /** */ 84 public static GType getType() 85 { 86 return gtk_text_tag_get_type(); 87 } 88 89 /** 90 * Creates a `GtkTextTag`. 91 * 92 * Params: 93 * name = tag name, or %NULL 94 * 95 * Returns: a new `GtkTextTag` 96 * 97 * Throws: ConstructionException GTK+ fails to create the object. 98 */ 99 public this(string name) 100 { 101 auto __p = gtk_text_tag_new(Str.toStringz(name)); 102 103 if(__p is null) 104 { 105 throw new ConstructionException("null returned by new"); 106 } 107 108 this(cast(GtkTextTag*) __p, true); 109 } 110 111 /** 112 * Emits the [signal@Gtk.TextTagTable::tag-changed] signal on the 113 * `GtkTextTagTable` where the tag is included. 114 * 115 * The signal is already emitted when setting a `GtkTextTag` property. 116 * This function is useful for a `GtkTextTag` subclass. 117 * 118 * Params: 119 * sizeChanged = whether the change affects the `GtkTextView` layout 120 */ 121 public void changed(bool sizeChanged) 122 { 123 gtk_text_tag_changed(gtkTextTag, sizeChanged); 124 } 125 126 /** 127 * Get the tag priority. 128 * 129 * Returns: The tag’s priority. 130 */ 131 public int getPriority() 132 { 133 return gtk_text_tag_get_priority(gtkTextTag); 134 } 135 136 /** 137 * Sets the priority of a `GtkTextTag`. 138 * 139 * Valid priorities start at 0 and go to one less than 140 * [method@Gtk.TextTagTable.get_size]. Each tag in a table 141 * has a unique priority; setting the priority of one tag shifts 142 * the priorities of all the other tags in the table to maintain 143 * a unique priority for each tag. 144 * 145 * Higher priority tags “win” if two tags both set the same text 146 * attribute. When adding a tag to a tag table, it will be assigned 147 * the highest priority in the table by default; so normally the 148 * precedence of a set of tags is the order in which they were added 149 * to the table, or created with [method@Gtk.TextBuffer.create_tag], 150 * which adds the tag to the buffer’s table automatically. 151 * 152 * Params: 153 * priority = the new priority 154 */ 155 public void setPriority(int priority) 156 { 157 gtk_text_tag_set_priority(gtkTextTag, priority); 158 } 159 }