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 = CssSection 29 * strct = GtkCssSection 30 * realStrct= 31 * ctorStrct= 32 * clss = CssSection 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = GBoxed 38 * implements: 39 * prefixes: 40 * - gtk_css_section_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * - parsing-error 46 * imports: 47 * - gtkc.paths 48 * - gtkc.Loader 49 * - gio.File 50 * structWrap: 51 * - GFile* -> File 52 * - GtkCssSection* -> CssSection 53 * module aliases: 54 * local aliases: 55 * overrides: 56 */ 57 58 module gtk.CssSection; 59 60 public import gtkc.gtktypes; 61 62 private import gtkc.gtk; 63 private import glib.ConstructionException; 64 private import gobject.ObjectG; 65 66 private import gobject.Signals; 67 public import gtkc.gdktypes; 68 private import gtkc.paths; 69 private import gtkc.Loader; 70 private import gio.File; 71 72 73 private import gobject.Boxed; 74 75 /** 76 * GtkCssProvider is an object implementing the GtkStyleProvider interface. 77 * It is able to parse CSS-like 78 * input in order to style widgets. 79 * 80 * Default files 81 * 82 * An application can cause GTK+ to parse a specific CSS style sheet by 83 * calling gtk_css_provider_load_from_file() and adding the provider with 84 * gtk_style_context_add_provider() or gtk_style_context_add_provider_for_screen(). 85 * In addition, certain files will be read when GTK+ is initialized. First, 86 * the file $XDG_CONFIG_HOME/gtk-3.0/gtk.css 87 * is loaded if it exists. Then, GTK+ tries to load 88 * $HOME/.themes/theme-name/gtk-3.0/gtk.css, 89 * falling back to 90 * datadir/share/themes/theme-name/gtk-3.0/gtk.css, 91 * where theme-name is the name of the current theme 92 * (see the "gtk-theme-name" setting) and datadir 93 * is the prefix configured when GTK+ was compiled, unless overridden by the 94 * GTK_DATA_PREFIX environment variable. 95 * 96 * <hr> 97 * 98 * Style sheets 99 * 100 * The basic structure of the style sheets understood by this provider is 101 * a series of statements, which are either rule sets or '@-rules', separated 102 * by whitespace. 103 * 104 * A rule set consists of a selector and a declaration block, which is 105 * a series of declarations enclosed in curly braces ({ and }). The 106 * declarations are separated by semicolons (;). Multiple selectors can 107 * share the same declaration block, by putting all the separators in 108 * front of the block, separated by commas. 109 * 110 * $(DDOC_COMMENT example) 111 * 112 * <hr> 113 * 114 * Selectors 115 * 116 * Selectors work very similar to the way they do in CSS, with widget class 117 * names taking the role of element names, and widget names taking the role 118 * of IDs. When used in a selector, widget names must be prefixed with a 119 * '#' character. The '*' character represents the so-called universal 120 * selector, which matches any widget. 121 * 122 * To express more complicated situations, selectors can be combined in 123 * various ways: 124 * 125 * To require that a widget satisfies several conditions, 126 * combine several selectors into one by concatenating them. E.g. 127 * GtkButton#button1 matches a GtkButton widget 128 * with the name button1. 129 * 130 * To only match a widget when it occurs inside some other 131 * widget, write the two selectors after each other, separated by whitespace. 132 * E.g. GtkToolBar GtkButton matches GtkButton widgets 133 * that occur inside a GtkToolBar. 134 * 135 * In the previous example, the GtkButton is matched even 136 * if it occurs deeply nested inside the toolbar. To restrict the match 137 * to direct children of the parent widget, insert a '>' character between 138 * the two selectors. E.g. GtkNotebook > GtkLabel matches 139 * GtkLabel widgets that are direct children of a GtkNotebook. 140 * 141 * $(DDOC_COMMENT example) 142 * 143 * Widgets may also define style classes, which can be used for matching. 144 * When used in a selector, style classes must be prefixed with a '.' 145 * character. 146 * 147 * Refer to the documentation of individual widgets to learn which 148 * style classes they define and see the section called “Style classes and regions” 149 * for a list of all style classes used by GTK+ widgets. 150 * 151 * Note that there is some ambiguity in the selector syntax when it comes 152 * to differentiation widget class names from regions. GTK+ currently treats 153 * a string as a widget class name if it contains any uppercase characters 154 * (which should work for more widgets with names like GtkLabel). 155 * 156 * $(DDOC_COMMENT example) 157 * 158 * In complicated widgets like e.g. a GtkNotebook, it may be desirable 159 * to style different parts of the widget differently. To make this 160 * possible, container widgets may define regions, whose names 161 * may be used for matching in selectors. 162 * 163 * Some containers allow to further differentiate between regions by 164 * applying so-called pseudo-classes to the region. For example, the 165 * tab region in GtkNotebook allows to single out the first or last 166 * tab by using the :first-child or :last-child pseudo-class. 167 * When used in selectors, pseudo-classes must be prefixed with a 168 * ':' character. 169 * 170 * Refer to the documentation of individual widgets to learn which 171 * regions and pseudo-classes they define and see 172 * the section called “Style classes and regions” for a list of all regions 173 * used by GTK+ widgets. 174 * 175 * $(DDOC_COMMENT example) 176 * 177 * Another use of pseudo-classes is to match widgets depending on their 178 * state. This is conceptually similar to the :hover, :active or :focus 179 * pseudo-classes in CSS. The available pseudo-classes for widget states 180 * are :active, :prelight (or :hover), :insensitive, :selected, :focused 181 * and :inconsistent. 182 * 183 * $(DDOC_COMMENT example) 184 * 185 * Widget state pseudoclasses may only apply to the last element 186 * in a selector. 187 * 188 * To determine the effective style for a widget, all the matching rule 189 * sets are merged. As in CSS, rules apply by specificity, so the rules 190 * whose selectors more closely match a widget path will take precedence 191 * over the others. 192 * 193 * <hr> 194 * 195 * @ Rules 196 * 197 * GTK+'s CSS supports the @import rule, in order to load another 198 * CSS style sheet in addition to the currently parsed one. 199 * 200 * $(DDOC_COMMENT example) 201 * 202 * In order to extend key bindings affecting different widgets, GTK+ 203 * supports the @binding-set rule to parse a set of bind/unbind 204 * directives, see GtkBindingSet for the supported syntax. Note that 205 * the binding sets defined in this way must be associated with rule sets 206 * by setting the gtk-key-bindings style property. 207 * 208 * Customized key bindings are typically defined in a separate 209 * gtk-keys.css CSS file and GTK+ loads this file 210 * according to the current key theme, which is defined by the 211 * "gtk-key-theme-name" setting. 212 * 213 * $(DDOC_COMMENT example) 214 * 215 * GTK+ also supports an additional @define-color rule, in order 216 * to define a color name which may be used instead of color numeric 217 * representations. Also see the "gtk-color-scheme" setting 218 * for a way to override the values of these named colors. 219 * 220 * $(DDOC_COMMENT example) 221 * 222 * <hr> 223 * 224 * Symbolic colors 225 * 226 * Besides being able to define color names, the CSS parser is also able 227 * to read different color expressions, which can also be nested, providing 228 * a rich language to define colors which are derived from a set of base 229 * colors. 230 * 231 * $(DDOC_COMMENT example) 232 * 233 * The various ways to express colors in GTK+ CSS are: 234 * 235 * Syntax 236 * Explanation 237 * Examples 238 * 239 * rgb(r, g, b) 240 * An opaque color; r, g, b can be either integers between 241 * 0 and 255 or percentages 242 * 243 * rgb(128, 10, 54) 244 * rgb(20%, 30%, 0%) 245 * 246 * rgba(r, g, b, a) 247 * A translucent color; r, g, b are as in the previous row, 248 * a is a floating point number between 0 and 1 249 * 250 * rgba(255, 255, 0, 0.5) 251 * 252 * #xxyyzz 253 * 254 * An opaque color; xx, yy, zz are hexadecimal numbers 255 * specifying r, g, b variants with between 1 and 4 256 * hexadecimal digits per component are allowed 257 * 258 * #ff12ab 259 * #f0c 260 * 261 * @name 262 * Reference to a color that has been defined with 263 * @define-color 264 * 265 * @bg_color 266 * 267 * mix(color1, color2, f) 268 * A linear combination of color1 and color2. f is a 269 * floating point number between 0 and 1. 270 * 271 * mix(#ff1e0a, @bg_color, 0.8) 272 * 273 * shade(color, f) 274 * A lighter or darker variant of color. f is a 275 * floating point number. 276 * 277 * shade(@fg_color, 0.5) 278 * 279 * lighter(color) 280 * A lighter variant of color 281 * 282 * darker(color) 283 * A darker variant of color 284 * 285 * alpha(color, f) 286 * Modifies passed color's alpha by a factor f. f is a 287 * floating point number. f < 1.0 results in a more transparent 288 * color while f > 1.0 results in a more opaque color. 289 * 290 * alhpa(blue, 0.5) 291 * 292 * <hr> 293 * 294 * Gradients 295 * 296 * Linear or radial Gradients can be used as background images. 297 * 298 * A linear gradient along the line from (start_x, start_y) to 299 * (end_x, end_y) is specified using the syntax 300 * 301 * -gtk-gradient (linear, 302 * start_x start_y, end_x end_y, 303 * color-stop (position, color), 304 * ...) 305 * 306 * where start_x and end_x can be either a floating point number between 307 * 0 and 1 or one of the special values 'left', 'right' or 'center', start_y 308 * and end_y can be either a floating point number between 0 and 1 or one 309 * of the special values 'top', 'bottom' or 'center', position is a floating 310 * point number between 0 and 1 and color is a color expression (see above). 311 * The color-stop can be repeated multiple times to add more than one color 312 * stop. 'from (color)' and 'to (color)' can be used as abbreviations for 313 * color stops with position 0 and 1, respectively. 314 * 315 * $(DDOC_COMMENT example) 316 * 317 * $(DDOC_COMMENT example) 318 * 319 * A radial gradient along the two circles defined by (start_x, start_y, 320 * start_radius) and (end_x, end_y, end_radius) is specified using the 321 * syntax 322 * 323 * -gtk-gradient (radial, 324 * start_x start_y, start_radius, 325 * end_x end_y, end_radius, 326 * color-stop (position, color), 327 * ...) 328 * 329 * where start_radius and end_radius are floating point numbers and 330 * the other parameters are as before. 331 * 332 * $(DDOC_COMMENT example) 333 * 334 * $(DDOC_COMMENT example) 335 * 336 * <hr> 337 * 338 * Text shadow 339 * 340 * A shadow list can be applied to text or symbolic icons, using the CSS3 341 * text-shadow syntax, as defined in 342 * the CSS3 specification. 343 * 344 * A text shadow is specified using the syntax 345 * 346 * text-shadow: horizontal_offset vertical_offset [ blur_radius ] color 347 * 348 * The offset of the shadow is specified with the horizontal_offset and vertical_offset 349 * parameters. The optional blur radius is parsed, but it is currently not rendered by 350 * the GTK+ theming engine. 351 * 352 * To set a shadow on an icon, use the icon-shadow property instead, 353 * with the same syntax. 354 * 355 * To set multiple shadows on an element, you can specify a comma-separated list 356 * of shadow elements in the text-shadow or icon-shadow property. Shadows are 357 * always rendered front-back, i.e. the first shadow specified is on top of the 358 * others. Shadows can thus overlay each other, but they can never overlay the 359 * text or icon itself, which is always rendered on top of the shadow layer. 360 * 361 * <hr> 362 * 363 * Box shadow 364 * 365 * Themes can apply shadows on framed elements using the CSS3 box-shadow syntax, 366 * as defined in 367 * the CSS3 specification. 368 * 369 * A box shadow is specified using the syntax 370 * 371 * box-shadow: [ inset ] horizontal_offset vertical_offset [ blur_radius ] [ spread ] color 372 * 373 * A positive offset will draw a shadow that is offset to the right (down) of the box, 374 * a negative offset to the left (top). The optional spread parameter defines an additional 375 * distance to expand the shadow shape in all directions, by the specified radius. 376 * The optional blur radius parameter is parsed, but it is currently not rendered by 377 * the GTK+ theming engine. 378 * The inset parameter defines whether the drop shadow should be rendered inside or outside 379 * the box canvas. 380 * 381 * To set multiple box-shadows on an element, you can specify a comma-separated list 382 * of shadow elements in the box-shadow property. Shadows are always rendered 383 * front-back, i.e. the first shadow specified is on top of the others, so they may 384 * overlap other boxes or other shadows. 385 * 386 * <hr> 387 * 388 * Border images 389 * 390 * Images and gradients can also be used in slices for the purpose of creating 391 * scalable borders. 392 * For more information, see the CSS3 documentation for the border-image property, 393 * which can be found here. 394 * 395 * The parameters of the slicing process are controlled by 396 * four separate properties. Note that you can use the 397 * 398 * border-image 399 * 400 * shorthand property 401 * to set values for the three properties at the same time. 402 * 403 * border-image-source: url(path) 404 * (or border-image-source: -gtk-gradient(...)) 405 * 406 * : 407 * Specifies the source of the border image, and it can either 408 * be an URL or a gradient (see above). 409 * 410 * border-image-slice: top right bottom left 411 * 412 * The sizes specified by the top, right, bottom and left parameters 413 * are the offsets, in pixels, from the relevant edge where the image 414 * should be "cut off" to build the slices used for the rendering 415 * of the border. 416 * 417 * border-image-width: top right bottom left 418 * 419 * The sizes specified by the top, right, bottom and left parameters 420 * are inward distances from the border box edge, used to specify the 421 * rendered size of each slice determined by border-image-slice. 422 * If this property is not specified, the values of border-width will 423 * be used as a fallback. 424 * 425 * border-image-repeat: [stretch|repeat|round|space] ? 426 * [stretch|repeat|round|space] 427 * 428 * Specifies how the image slices should be rendered in the area 429 * outlined by border-width. 430 * The default (stretch) is to resize the slice to fill in the whole 431 * allocated area. 432 * If the value of this property is 'repeat', the image slice 433 * will be tiled to fill the area. 434 * If the value of this property is 'round', the image slice will 435 * be tiled to fill the area, and scaled to fit it exactly 436 * a whole number of times. 437 * If the value of this property is 'space', the image slice will 438 * be tiled to fill the area, and if it doesn't fit it exactly a whole 439 * number of times, the extra space is distributed as padding around 440 * the slices. 441 * If two options are specified, the first one affects 442 * the horizontal behaviour and the second one the vertical behaviour. 443 * If only one option is specified, it affects both. 444 * 445 * $(DDOC_COMMENT example) 446 * 447 * $(DDOC_COMMENT example) 448 * 449 * $(DDOC_COMMENT example) 450 * 451 * <hr> 452 * 453 * Styles can specify transitions that will be used to create a gradual 454 * change in the appearance when a widget state changes. The following 455 * syntax is used to specify transitions: 456 * 457 * duration [s|ms] [linear|ease|ease-in|ease-out|ease-in-out] [loop]? 458 * 459 * The duration is the amount of time that the animation will take for 460 * a complete cycle from start to end. If the loop option is given, the 461 * animation will be repated until the state changes again. 462 * The option after the duration determines the transition function from a 463 * small set of predefined functions. 464 * 465 * Figure 6. Linear transition 466 * 467 * Figure 7. Ease transition 468 * 469 * Figure 8. Ease-in-out transition 470 * 471 * Figure 9. Ease-in transition 472 * 473 * Figure 10. Ease-out transition 474 * 475 * <hr> 476 * 477 * Supported properties 478 * 479 * Properties are the part that differ the most to common CSS, 480 * not all properties are supported (some are planned to be 481 * supported eventually, some others are meaningless or don't 482 * map intuitively in a widget based environment). 483 * 484 * The currently supported properties are: 485 * 486 * Property name 487 * Syntax 488 * Maps to 489 * Examples 490 * 491 * engine 492 * engine-name 493 * GtkThemingEngine 494 * engine: clearlooks; 495 * engine: none; /+* use the default (i.e. builtin) engine) +/ 496 * 497 * background-color 498 * color (see above) 499 * GdkRGBA 500 * 501 * background-color: #fff; 502 * color: color1; 503 * background-color: shade (color1, 0.5); 504 * color: mix (color1, #f0f, 0.8); 505 * 506 * color 507 * 508 * border-top-color 509 * transparent|color (see above) 510 * 511 * border-right-color 512 * 513 * border-bottom-color 514 * 515 * border-left-color 516 * 517 * border-color 518 * [transparent|color]{1,4} 519 * 520 * font-family 521 * 522 * family [, family]* 523 * gchararray 524 * font-family: Sans, Arial; 525 * 526 * font-style 527 * [normal|oblique|italic] 528 * PANGO_TYPE_STYLE 529 * font-style: italic; 530 * 531 * font-variant 532 * [normal|small-caps] 533 * PANGO_TYPE_VARIANT 534 * font-variant: normal; 535 * 536 * font-weight 537 * [normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900] 538 * PANGO_TYPE_WEIGHT 539 * font-weight: bold; 540 * 541 * font-size 542 * Font size in point 543 * gint 544 * font-size: 13; 545 * 546 * font 547 * 548 * family [style] [size] 549 * PangoFontDescription 550 * font: Sans 15; 551 * 552 * margin-top 553 * integer 554 * gint 555 * margin-top: 0; 556 * 557 * margin-left 558 * integer 559 * gint 560 * margin-left: 1; 561 * 562 * margin-bottom 563 * integer 564 * gint 565 * margin-bottom: 2; 566 * 567 * margin-right 568 * integer 569 * gint 570 * margin-right: 4; 571 * 572 * margin 573 * 574 * width 575 * vertical_width horizontal_width 576 * top_width horizontal_width bottom_width 577 * top_width right_width bottom_width left_width 578 * 579 * GtkBorder 580 * 581 * margin: 5; 582 * margin: 5 10; 583 * margin: 5 10 3; 584 * margin: 5 10 3 5; 585 * 586 * padding-top 587 * integer 588 * gint 589 * padding-top: 5; 590 * 591 * padding-left 592 * integer 593 * gint 594 * padding-left: 5; 595 * 596 * padding-bottom 597 * integer 598 * gint 599 * padding-bottom: 5; 600 * 601 * padding-right 602 * integer 603 * gint 604 * padding-right: 5; 605 * 606 * padding 607 * 608 * background-image 609 * 610 * gradient (see above) or 611 * url(path) 612 * cairo_pattern_t 613 * 614 * -gtk-gradient (linear, 615 * left top, right top, 616 * from (#fff), to (#000)); 617 * -gtk-gradient (linear, 0.0 0.5, 0.5 1.0, 618 * from (#fff), 619 * color-stop (0.5, #f00), 620 * to (#000)); 621 * -gtk-gradient (radial, 622 * center center, 0.2, 623 * center center, 0.8, 624 * color-stop (0.0, #fff), 625 * color-stop (1.0, #000)); 626 * url ('background.png'); 627 * 628 * background-repeat 629 * [repeat|no-repeat] 630 * internal 631 * 632 * background-repeat: no-repeat; 633 * If not specified, the style doesn't respect the CSS3 634 * specification, since the background will be 635 * stretched to fill the area. 636 * 637 * border-top-width 638 * integer 639 * gint 640 * border-top-width: 5; 641 * 642 * border-left-width 643 * integer 644 * gint 645 * border-left-width: 5; 646 * 647 * border-bottom-width 648 * integer 649 * gint 650 * border-bottom-width: 5; 651 * 652 * border-right-width 653 * integer 654 * gint 655 * border-right-width: 5; 656 * 657 * border-width 658 * GtkBorder 659 * 660 * border-width: 1; 661 * border-width: 1 2; 662 * border-width: 1 2 3; 663 * border-width: 1 2 3 5; 664 * 665 * border-radius 666 * integer 667 * gint 668 * border-radius: 5; 669 * 670 * border-style 671 * [none|solid|inset|outset] 672 * GtkBorderStyle 673 * border-style: solid; 674 * 675 * border-image 676 * 677 * border image (see above) 678 * internal use only 679 * 680 * border-image: url("/path/to/image.png") 3 4 3 4 stretch; 681 * border-image: url("/path/to/image.png") 3 4 4 3 repeat stretch; 682 * 683 * text-shadow 684 * shadow list (see above) 685 * internal use only 686 * 687 * text-shadow: 1 1 0 blue, -4 -4 red; 688 * 689 * transition 690 * transition (see above) 691 * internal use only 692 * 693 * transition: 150ms ease-in-out; 694 * transition: 1s linear loop; 695 * 696 * gtk-key-bindings 697 * binding set name list 698 * internal use only 699 * 700 * gtk-bindings: binding1, binding2, ...; 701 * 702 * GtkThemingEngines can register their own, engine-specific style properties 703 * with the function gtk_theming_engine_register_property(). These properties 704 * can be set in CSS like other properties, using a name of the form 705 * 706 * -namespace-name 707 * 708 * , where namespace is typically 709 * the name of the theming engine, and name is the 710 * name of the property. Style properties that have been registered by widgets 711 * using gtk_widget_class_install_style_property() can also be set in this 712 * way, using the widget class name for namespace. 713 * 714 * $(DDOC_COMMENT example) 715 */ 716 public class CssSection : Boxed 717 { 718 719 /** the main Gtk struct */ 720 protected GtkCssSection* gtkCssSection; 721 722 723 /** Get the main Gtk struct */ 724 public GtkCssSection* getCssSectionStruct() 725 { 726 return gtkCssSection; 727 } 728 729 730 /** the main Gtk struct as a void* */ 731 protected void* getStruct() 732 { 733 return cast(void*)gtkCssSection; 734 } 735 736 /** 737 * Sets our main struct and passes it to the parent class 738 */ 739 public this (GtkCssSection* gtkCssSection) 740 { 741 this.gtkCssSection = gtkCssSection; 742 } 743 744 ~this () 745 { 746 if ( Linker.isLoaded(LIBRARY.GTK) && gtkCssSection !is null ) 747 { 748 gtk_css_section_unref(gtkCssSection); 749 } 750 } 751 752 /** 753 */ 754 755 /** 756 * Returns the line in the CSS document where this section end. 757 * The line number is 0-indexed, so the first line of the document 758 * will return 0. 759 * This value may change in future invocations of this function if 760 * section is not yet parsed completely. This will for example 761 * happen in the GtkCssProvider::parsing-error signal. 762 * The end position and line may be identical to the start 763 * position and line for sections which failed to parse anything 764 * successfully. 765 * Returns: the line number Since 3.2 766 */ 767 public uint getEndLine() 768 { 769 // guint gtk_css_section_get_end_line (const GtkCssSection *section); 770 return gtk_css_section_get_end_line(gtkCssSection); 771 } 772 773 /** 774 * Returns the offset in bytes from the start of the current line 775 * returned via gtk_css_section_get_end_line(). 776 * This value may change in future invocations of this function if 777 * section is not yet parsed completely. This will for example 778 * happen in the GtkCssProvider::parsing-error signal. 779 * The end position and line may be identical to the start 780 * position and line for sections which failed to parse anything 781 * successfully. 782 * Returns: the offset in bytes from the start of the line. Since 3.2 783 */ 784 public uint getEndPosition() 785 { 786 // guint gtk_css_section_get_end_position (const GtkCssSection *section); 787 return gtk_css_section_get_end_position(gtkCssSection); 788 } 789 790 /** 791 * Gets the file that section was parsed from. If no such file exists, 792 * for example because the CSS was loaded via 793 * gtk_css_provider_load_from_data(), then NULL is returned. 794 * Returns: the GFile that section was parsed from or NULL if section was parsed from other data. [transfer none] Since 3.2 795 */ 796 public File getFile() 797 { 798 // GFile * gtk_css_section_get_file (const GtkCssSection *section); 799 auto p = gtk_css_section_get_file(gtkCssSection); 800 801 if(p is null) 802 { 803 return null; 804 } 805 806 return ObjectG.getDObject!(File)(cast(GFile*) p); 807 } 808 809 /** 810 * Gets the parent section for the given section. The parent section is 811 * the section that contains this section. A special case are sections of 812 * type GTK_CSS_SECTION_DOCUMENT. Their parent will either be NULL 813 * if they are the original CSS document that was loaded by 814 * gtk_css_provider_load_from_file() or a section of type 815 * GTK_CSS_SECTION_IMPORT if it was loaded with an import rule from 816 * a different file. 817 * Returns: the parent section or NULL if none Since 3.2 818 */ 819 public CssSection getParent() 820 { 821 // GtkCssSection * gtk_css_section_get_parent (const GtkCssSection *section); 822 auto p = gtk_css_section_get_parent(gtkCssSection); 823 824 if(p is null) 825 { 826 return null; 827 } 828 829 return ObjectG.getDObject!(CssSection)(cast(GtkCssSection*) p); 830 } 831 832 /** 833 * Gets the type of information that section describes. 834 * Returns: the type of section Since 3.2 835 */ 836 public GtkCssSectionType getSectionType() 837 { 838 // GtkCssSectionType gtk_css_section_get_section_type (const GtkCssSection *section); 839 return gtk_css_section_get_section_type(gtkCssSection); 840 } 841 842 /** 843 * Returns the line in the CSS document where this section starts. 844 * The line number is 0-indexed, so the first line of the document 845 * will return 0. 846 * Returns: the line number Since 3.2 847 */ 848 public uint getStartLine() 849 { 850 // guint gtk_css_section_get_start_line (const GtkCssSection *section); 851 return gtk_css_section_get_start_line(gtkCssSection); 852 } 853 854 /** 855 * Returns the offset in bytes from the start of the current line 856 * returned via gtk_css_section_get_start_line(). 857 * Returns: the offset in bytes from the start of the line. Since 3.2 858 */ 859 public uint getStartPosition() 860 { 861 // guint gtk_css_section_get_start_position (const GtkCssSection *section); 862 return gtk_css_section_get_start_position(gtkCssSection); 863 } 864 865 /** 866 * Increments the reference count on section. 867 * Returns: section itself. Since 3.2 868 */ 869 public CssSection doref() 870 { 871 // GtkCssSection * gtk_css_section_ref (GtkCssSection *section); 872 auto p = gtk_css_section_ref(gtkCssSection); 873 874 if(p is null) 875 { 876 return null; 877 } 878 879 return ObjectG.getDObject!(CssSection)(cast(GtkCssSection*) p); 880 } 881 882 /** 883 * Decrements the reference count on section, freeing the 884 * structure if the reference count reaches 0. 885 */ 886 public void unref() 887 { 888 // void gtk_css_section_unref (GtkCssSection *section); 889 gtk_css_section_unref(gtkCssSection); 890 } 891 }