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.CssSection; 26 27 private import gio.File; 28 private import gio.FileIF; 29 private import gobject.ObjectG; 30 private import gtkc.Loader; 31 private import gtkc.gtk; 32 public import gtkc.gtktypes; 33 private import gtkc.paths; 34 35 36 /** 37 * Defines a part of a CSS document. Because sections are nested into 38 * one another, you can use gtk_css_section_get_parent() to get the 39 * containing region. 40 * 41 * Since: 3.2 42 */ 43 public class CssSection 44 { 45 /** the main Gtk struct */ 46 protected GtkCssSection* gtkCssSection; 47 48 /** Get the main Gtk struct */ 49 public GtkCssSection* getCssSectionStruct() 50 { 51 return gtkCssSection; 52 } 53 54 /** the main Gtk struct as a void* */ 55 protected void* getStruct() 56 { 57 return cast(void*)gtkCssSection; 58 } 59 60 /** 61 * Sets our main struct and passes it to the parent class. 62 */ 63 public this (GtkCssSection* gtkCssSection) 64 { 65 this.gtkCssSection = gtkCssSection; 66 } 67 68 ~this () 69 { 70 if ( Linker.isLoaded(LIBRARY.GTK) && gtkCssSection !is null ) 71 { 72 gtk_css_section_unref(gtkCssSection); 73 } 74 } 75 76 /** 77 */ 78 79 /** */ 80 public static GType getType() 81 { 82 return gtk_css_section_get_type(); 83 } 84 85 /** 86 * Returns the line in the CSS document where this section end. 87 * The line number is 0-indexed, so the first line of the document 88 * will return 0. 89 * This value may change in future invocations of this function if 90 * @section is not yet parsed completely. This will for example 91 * happen in the GtkCssProvider::parsing-error signal. 92 * The end position and line may be identical to the start 93 * position and line for sections which failed to parse anything 94 * successfully. 95 * 96 * Return: the line number 97 * 98 * Since: 3.2 99 */ 100 public uint getEndLine() 101 { 102 return gtk_css_section_get_end_line(gtkCssSection); 103 } 104 105 /** 106 * Returns the offset in bytes from the start of the current line 107 * returned via gtk_css_section_get_end_line(). 108 * This value may change in future invocations of this function if 109 * @section is not yet parsed completely. This will for example 110 * happen in the GtkCssProvider::parsing-error signal. 111 * The end position and line may be identical to the start 112 * position and line for sections which failed to parse anything 113 * successfully. 114 * 115 * Return: the offset in bytes from the start of the line. 116 * 117 * Since: 3.2 118 */ 119 public uint getEndPosition() 120 { 121 return gtk_css_section_get_end_position(gtkCssSection); 122 } 123 124 /** 125 * Gets the file that @section was parsed from. If no such file exists, 126 * for example because the CSS was loaded via 127 * @gtk_css_provider_load_from_data(), then %NULL is returned. 128 * 129 * Return: the #GFile that @section was parsed from 130 * or %NULL if @section was parsed from other data 131 * 132 * Since: 3.2 133 */ 134 public FileIF getFile() 135 { 136 auto p = gtk_css_section_get_file(gtkCssSection); 137 138 if(p is null) 139 { 140 return null; 141 } 142 143 return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p); 144 } 145 146 /** 147 * Gets the parent section for the given @section. The parent section is 148 * the section that contains this @section. A special case are sections of 149 * type #GTK_CSS_SECTION_DOCUMENT. Their parent will either be %NULL 150 * if they are the original CSS document that was loaded by 151 * gtk_css_provider_load_from_file() or a section of type 152 * #GTK_CSS_SECTION_IMPORT if it was loaded with an import rule from 153 * a different file. 154 * 155 * Return: the parent section or %NULL if none 156 * 157 * Since: 3.2 158 */ 159 public CssSection getParent() 160 { 161 auto p = gtk_css_section_get_parent(gtkCssSection); 162 163 if(p is null) 164 { 165 return null; 166 } 167 168 return ObjectG.getDObject!(CssSection)(cast(GtkCssSection*) p); 169 } 170 171 /** 172 * Gets the type of information that @section describes. 173 * 174 * Return: the type of @section 175 * 176 * Since: 3.2 177 */ 178 public GtkCssSectionType getSectionType() 179 { 180 return gtk_css_section_get_section_type(gtkCssSection); 181 } 182 183 /** 184 * Returns the line in the CSS document where this section starts. 185 * The line number is 0-indexed, so the first line of the document 186 * will return 0. 187 * 188 * Return: the line number 189 * 190 * Since: 3.2 191 */ 192 public uint getStartLine() 193 { 194 return gtk_css_section_get_start_line(gtkCssSection); 195 } 196 197 /** 198 * Returns the offset in bytes from the start of the current line 199 * returned via gtk_css_section_get_start_line(). 200 * 201 * Return: the offset in bytes from the start of the line. 202 * 203 * Since: 3.2 204 */ 205 public uint getStartPosition() 206 { 207 return gtk_css_section_get_start_position(gtkCssSection); 208 } 209 210 /** 211 * Increments the reference count on @section. 212 * 213 * Return: @section itself. 214 * 215 * Since: 3.2 216 */ 217 public CssSection doref() 218 { 219 auto p = gtk_css_section_ref(gtkCssSection); 220 221 if(p is null) 222 { 223 return null; 224 } 225 226 return ObjectG.getDObject!(CssSection)(cast(GtkCssSection*) p); 227 } 228 229 /** 230 * Decrements the reference count on @section, freeing the 231 * structure if the reference count reaches 0. 232 * 233 * Since: 3.2 234 */ 235 public void unref() 236 { 237 gtk_css_section_unref(gtkCssSection); 238 } 239 }