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