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 = gtk3-Resource-Files.html 27 * outPack = gtk 28 * outFile = RcStyle 29 * strct = GtkRcStyle 30 * realStrct= 31 * ctorStrct= 32 * clss = RcStyle 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_rc_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - glib.ScannerG 48 * - gdk.Color 49 * - gtk.Settings 50 * - gtk.Style 51 * - gtk.Widget 52 * structWrap: 53 * - GScanner* -> ScannerG 54 * - GdkColor* -> Color 55 * - GtkRcStyle* -> RcStyle 56 * - GtkSettings* -> Settings 57 * - GtkStyle* -> Style 58 * - GtkWidget* -> Widget 59 * module aliases: 60 * local aliases: 61 * overrides: 62 */ 63 64 module gtk.RcStyle; 65 66 public import gtkc.gtktypes; 67 68 private import gtkc.gtk; 69 private import glib.ConstructionException; 70 private import gobject.ObjectG; 71 72 73 private import glib.Str; 74 private import glib.ScannerG; 75 private import gdk.Color; 76 private import gtk.Settings; 77 private import gtk.Style; 78 private import gtk.Widget; 79 80 81 82 private import gobject.ObjectG; 83 84 /** 85 * GTK+ provides resource file mechanism for configuring 86 * various aspects of the operation of a GTK+ program 87 * at runtime. 88 * 89 * Warning 90 * 91 * In GTK+ 3.0, resource files have been deprecated and replaced 92 * by CSS-like style sheets, which are understood by GtkCssProvider. 93 * 94 * Default files 95 * 96 * An application can cause GTK+ to parse a specific RC 97 * file by calling gtk_rc_parse(). In addition to this, 98 * certain files will be read at the end of gtk_init(). 99 * Unless modified, the files looked for will be 100 * <SYSCONFDIR>/gtk-2.0/gtkrc 101 * and .gtkrc-3.0 in the users home directory. 102 * (<SYSCONFDIR> defaults to 103 * /usr/local/etc. It can be changed with the 104 * --prefix or --sysconfdir options when 105 * configuring GTK+.) 106 * 107 * The set of these default files 108 * can be retrieved with gtk_rc_get_default_files() 109 * and modified with gtk_rc_add_default_file() and 110 * gtk_rc_set_default_files(). 111 * Additionally, the GTK2_RC_FILES environment variable 112 * can be set to a G_SEARCHPATH_SEPARATOR_S-separated list of files 113 * in order to overwrite the set of default files at runtime. 114 * 115 * For each RC file, in addition to the file itself, GTK+ will look for 116 * a locale-specific file that will be parsed after the main file. 117 * For instance, if LANG is set to ja_JP.ujis, 118 * when loading the default file ~/.gtkrc then GTK+ looks 119 * for ~/.gtkrc.ja_JP and ~/.gtkrc.ja, 120 * and parses the first of those that exists. 121 * 122 * <hr> 123 * 124 * Pathnames and patterns 125 * 126 * A resource file defines a number of styles and key bindings and 127 * attaches them to particular widgets. The attachment is done 128 * by the widget, widget_class, 129 * and class declarations. As an example 130 * of such a statement: 131 * 132 * $(DDOC_COMMENT example) 133 * 134 * attaches the style "my-entry-class" to all 135 * widgets whose widget path matches the 136 * pattern "mywindow.*.GtkEntry". 137 * That is, all GtkEntry widgets which are part of a GtkWindow named 138 * "mywindow". 139 * 140 * The patterns here are given in the standard shell glob syntax. 141 * The "?" wildcard matches any character, while 142 * "*" matches zero or more of any character. 143 * The three types of matching are against the widget path, the 144 * class path and the class hierarchy. Both the 145 * widget path and the class path consist of a "." 146 * separated list of all the parents of the widget and the widget itself 147 * from outermost to innermost. The difference is that in the widget path, 148 * the name assigned by gtk_widget_set_name() is used if present, otherwise 149 * the class name of the widget, while for the class path, the class name is 150 * always used. 151 * 152 * Since GTK+ 2.10, widget_class paths can also contain 153 * <classname> substrings, which are matching 154 * the class with the given name and any derived classes. For instance, 155 * 156 * $(DDOC_COMMENT example) 157 * 158 * will match GtkLabel widgets which are contained in any kind of menu item. 159 * 160 * So, if you have a GtkEntry named "myentry", inside of a 161 * horizontal box in a window named "mywindow", then the 162 * widget path is: "mywindow.GtkHBox.myentry" 163 * while the class path is: "GtkWindow.GtkHBox.GtkEntry". 164 * 165 * Matching against class is a little different. The pattern match is done 166 * against all class names in the widgets class hierarchy (not the layout 167 * hierarchy) in sequence, so the pattern: 168 * 169 * $(DDOC_COMMENT example) 170 * 171 * will match not just GtkButton widgets, but also GtkToggleButton and 172 * GtkCheckButton widgets, since those classes derive from GtkButton. 173 * 174 * Additionally, a priority can be specified for each pattern, and styles 175 * override other styles first by priority, then by pattern type and then 176 * by order of specification (later overrides earlier). The priorities 177 * that can be specified are (highest to lowest): 178 * 179 * highest 180 * rc 181 * theme 182 * application 183 * gtk 184 * lowest 185 * 186 * rc is the default for styles 187 * read from an RC file, theme 188 * is the default for styles read from theme RC files, 189 * application 190 * should be used for styles an application sets 191 * up, and gtk is used for styles 192 * that GTK+ creates internally. 193 * 194 * <hr> 195 * 196 * Theme gtkrc files 197 * 198 * Theme RC files are loaded first from under the ~/.themes/, 199 * then from the directory from gtk_rc_get_theme_dir(). The files looked at will 200 * be gtk-3.0/gtkrc. 201 * 202 * When the application prefers dark themes 203 * (see the "gtk-application-prefer-dark-theme" property for details), 204 * gtk-3.0/gtkrc-dark will be loaded first, and if not present 205 * gtk-3.0/gtkrc will be loaded. 206 * 207 * <hr> 208 * 209 * Optimizing RC Style Matches 210 * 211 * Everytime a widget is created and added to the layout hierarchy of a GtkWindow 212 * ("anchored" to be exact), a list of matching RC styles out of all RC styles read 213 * in so far is composed. 214 * For this, every RC style is matched against the widgets class path, 215 * the widgets name path and widgets inheritance hierarchy. 216 * As a consequence, significant slowdown can be caused by utilization of many 217 * RC styles and by using RC style patterns that are slow or complicated to match 218 * against a given widget. 219 * The following ordered list provides a number of advices (prioritized by 220 * effectiveness) to reduce the performance overhead associated with RC style 221 * matches: 222 * 223 * Move RC styles for specific applications into RC files dedicated to those 224 * applications and parse application specific RC files only from 225 * applications that are affected by them. 226 * This reduces the overall amount of RC styles that have to be considered 227 * for a match across a group of applications. 228 * 229 * Merge multiple styles which use the same matching rule, for instance: 230 * 231 * $(DDOC_COMMENT example) 232 * 233 * is faster to match as: 234 * 235 * $(DDOC_COMMENT example) 236 * 237 * Use of wildcards should be avoided, this can reduce the individual RC style 238 * match to a single integer comparison in most cases. 239 * 240 * To avoid complex recursive matching, specification of full class names 241 * (for class matches) or full path names (for 242 * widget and widget_class matches) 243 * is to be preferred over shortened names 244 * containing "*" or "?". 245 * 246 * If at all necessary, wildcards should only be used at the tail or head 247 * of a pattern. This reduces the match complexity to a string comparison 248 * per RC style. 249 * 250 * When using wildcards, use of "?" should be preferred 251 * over "*". This can reduce the matching complexity from 252 * O(n^2) to O(n). For example "Gtk*Box" can be turned into 253 * "Gtk?Box" and will still match GtkHBox and GtkVBox. 254 * 255 * The use of "*" wildcards should be restricted as much 256 * as possible, because matching "A*B*C*RestString" can 257 * result in matching complexities of O(n^2) worst case. 258 * 259 * <hr> 260 * 261 * Toplevel declarations 262 * 263 * An RC file is a text file which is composed of a sequence 264 * of declarations. '#' characters delimit comments and 265 * the portion of a line after a '#' is ignored when parsing 266 * an RC file. 267 * 268 * The possible toplevel declarations are: 269 * 270 * binding name 271 * { ... } 272 * 273 * Declares a binding set. 274 * 275 * class pattern 276 * [ style | binding ][ : priority ] 277 * name 278 * 279 * Specifies a style or binding set for a particular 280 * branch of the inheritance hierarchy. 281 * 282 * include filename 283 * 284 * Parses another file at this point. If 285 * filename is not an absolute filename, 286 * it is searched in the directories of the currently open RC files. 287 * 288 * GTK+ also tries to load a 289 * locale-specific variant of 290 * the included file. 291 * 292 * module_path path 293 * 294 * Sets a path (a list of directories separated 295 * by colons) that will be searched for theme engines referenced in 296 * RC files. 297 * 298 * pixmap_path path 299 * 300 * Sets a path (a list of directories separated 301 * by colons) that will be searched for pixmaps referenced in 302 * RC files. 303 * 304 * im_module_file pathname 305 * 306 * Sets the pathname for the IM modules file. Setting this from RC files 307 * is deprecated; you should use the environment variable GTK_IM_MODULE_FILE 308 * instead. 309 * 310 * style name [ = 311 * parent ] { ... } 312 * 313 * Declares a style. 314 * 315 * widget pattern 316 * [ style | binding ][ : priority ] 317 * name 318 * 319 * Specifies a style or binding set for a particular 320 * group of widgets by matching on the widget pathname. 321 * 322 * widget_class pattern 323 * [ style | binding ][ : priority ] 324 * name 325 * 326 * Specifies a style or binding set for a particular 327 * group of widgets by matching on the class pathname. 328 * 329 * setting = value 330 * 331 * Specifies a value for a setting. 332 * Note that settings in RC files are overwritten by system-wide settings 333 * (which are managed by an XSettings manager on X11). 334 * 335 * <hr> 336 * 337 * Styles 338 * 339 * A RC style is specified by a style 340 * declaration in a RC file, and then bound to widgets 341 * with a widget, widget_class, 342 * or class declaration. All styles 343 * applying to a particular widget are composited together 344 * with widget declarations overriding 345 * widget_class declarations which, in 346 * turn, override class declarations. 347 * Within each type of declaration, later declarations override 348 * earlier ones. 349 * 350 * Within a style declaration, the possible 351 * elements are: 352 * 353 * bg[state] = 354 * color 355 * 356 * Sets the color used for the background of most widgets. 357 * 358 * fg[state] = 359 * color 360 * 361 * Sets the color used for the foreground of most widgets. 362 * 363 * base[state] = 364 * color 365 * 366 * Sets the color used for the background of widgets displaying 367 * editable text. This color is used for the background 368 * of, among others, GtkText, GtkEntry, GtkList, and GtkCList. 369 * 370 * text[state] = 371 * color 372 * 373 * Sets the color used for foreground of widgets using 374 * base for the background color. 375 * 376 * xthickness = 377 * number 378 * 379 * Sets the xthickness, which is used for various horizontal padding 380 * values in GTK+. 381 * 382 * ythickness = 383 * number 384 * 385 * Sets the ythickness, which is used for various vertical padding 386 * values in GTK+. 387 * 388 * bg_pixmap[state] = 389 * pixmap 390 * 391 * Sets a background pixmap to be used in place of 392 * the bg color (or for GtkText, 393 * in place of the base color. The special 394 * value "<parent>" may be used to indicate that the widget should 395 * use the same background pixmap as its parent. The special value 396 * "<none>" may be used to indicate no background pixmap. 397 * 398 * font = font 399 * 400 * Starting with GTK+ 2.0, the "font" and "fontset" 401 * declarations are ignored; use "font_name" declarations instead. 402 * 403 * fontset = font 404 * 405 * Starting with GTK+ 2.0, the "font" and "fontset" 406 * declarations are ignored; use "font_name" declarations instead. 407 * 408 * font_name = font 409 * 410 * Sets the font for a widget. font must be 411 * a Pango font name, e.g. "Sans Italic 10". 412 * For details about Pango font names, see 413 * pango_font_description_from_string(). 414 * 415 * stock["stock-id"] = { icon source specifications } 416 * 417 * Defines the icon for a stock item. 418 * 419 * color["color-name"] = color specification 420 * 421 * Since 2.10, this element can be used to defines symbolic colors. See below for 422 * the syntax of color specifications. 423 * 424 * engine "engine" { engine-specific 425 * settings } 426 * 427 * Defines the engine to be used when drawing with this style. 428 * 429 * class::property = value 430 * 431 * Sets a style property for a widget class. 432 * 433 * The colors and background pixmaps are specified as a function of the 434 * state of the widget. The states are: 435 * 436 * NORMAL 437 * 438 * A color used for a widget in its normal state. 439 * 440 * ACTIVE 441 * 442 * A variant of the NORMAL color used when the 443 * widget is in the GTK_STATE_ACTIVE state, and also for 444 * the trough of a ScrollBar, tabs of a NoteBook 445 * other than the current tab and similar areas. 446 * Frequently, this should be a darker variant 447 * of the NORMAL color. 448 * 449 * PRELIGHT 450 * 451 * A color used for widgets in the GTK_STATE_PRELIGHT state. This 452 * state is the used for Buttons and MenuItems 453 * that have the mouse cursor over them, and for 454 * their children. 455 * 456 * SELECTED 457 * 458 * A color used to highlight data selected by the user. 459 * for instance, the selected items in a list widget, and the 460 * selection in an editable widget. 461 * 462 * INSENSITIVE 463 * 464 * A color used for the background of widgets that have 465 * been set insensitive with gtk_widget_set_sensitive(). 466 * 467 * Colors can be specified as a string containing a color name (GTK+ knows 468 * all names from the X color database /usr/lib/X11/rgb.txt), 469 * in one of the hexadecimal forms rrrrggggbbbb, 470 * rrrgggbbb, rrggbb, 471 * or rgb, where r, 472 * g and b are 473 * hex digits, or they can be specified as a triplet 474 * { r, g, 475 * b}, where r, 476 * g and b are either integers in 477 * the range 0-65535 or floats in the range 0.0-1.0. 478 * 479 * Since 2.10, colors can also be specified by refering to a symbolic color, as 480 * follows: @color-name, or by using expressions to combine 481 * colors. The following expressions are currently supported: 482 * 483 * mix (factor, color1, color2) 484 * 485 * Computes a new color by mixing color1 and 486 * color2. The factor 487 * determines how close the new color is to color1. 488 * A factor of 1.0 gives pure color1, a factor of 489 * 0.0 gives pure color2. 490 * 491 * shade (factor, color) 492 * 493 * Computes a lighter or darker variant of color. 494 * A factor of 1.0 leaves the color unchanged, smaller 495 * factors yield darker colors, larger factors yield lighter colors. 496 * 497 * lighter (color) 498 * 499 * This is an abbreviation for 500 * shade (1.3, color). 501 * 502 * darker (color) 503 * 504 * This is an abbreviation for 505 * shade (0.7, color). 506 * 507 * Here are some examples of color expressions: 508 * 509 * $(DDOC_COMMENT example) 510 * 511 * In a stock definition, icon sources are specified as a 512 * 4-tuple of image filename or icon name, text direction, widget state, and size, in that 513 * order. Each icon source specifies an image filename or icon name to use with a given 514 * direction, state, and size. Filenames are specified as a string such 515 * as "itemltr.png", while icon names (looked up 516 * in the current icon theme), are specified with a leading 517 * @, such as @"item-ltr". 518 * The * character can be used as a 519 * wildcard, and if direction/state/size are omitted they default to 520 * *. So for example, the following specifies different icons to 521 * use for left-to-right and right-to-left languages: 522 * 523 * $(DDOC_COMMENT example) 524 * 525 * This could be abbreviated as follows: 526 * 527 * $(DDOC_COMMENT example) 528 * 529 * You can specify custom icons for specific sizes, as follows: 530 * 531 * $(DDOC_COMMENT example) 532 * 533 * The sizes that come with GTK+ itself are "gtk-menu", 534 * "gtk-small-toolbar", "gtk-large-toolbar", 535 * "gtk-button", "gtk-dialog". Applications 536 * can define other sizes. 537 * 538 * It's also possible to use custom icons for a given state, for example: 539 * 540 * $(DDOC_COMMENT example) 541 * 542 * When selecting an icon source to use, GTK+ will consider text direction most 543 * important, state second, and size third. It will select the best match based on 544 * those criteria. If an attribute matches exactly (e.g. you specified 545 * PRELIGHT or specified the size), GTK+ won't modify the image; 546 * if the attribute matches with a wildcard, GTK+ will scale or modify the image to 547 * match the state and size the user requested. 548 * 549 * <hr> 550 * 551 * Key bindings 552 * 553 * Key bindings allow the user to specify actions to be 554 * taken on particular key presses. The form of a binding 555 * set declaration is: 556 * 557 * $(DDOC_COMMENT example) 558 * 559 * key is a string consisting of a 560 * series of modifiers followed by the name of a key. The 561 * modifiers can be: 562 * 563 * <alt> 564 * <ctl> 565 * <control> 566 * <meta> 567 * <hyper> 568 * <super> 569 * <mod1> 570 * <mod2> 571 * <mod3> 572 * <mod4> 573 * <mod5> 574 * <release> 575 * <shft> 576 * <shift> 577 * 578 * <shft> is an alias for 579 * <shift>, 580 * <ctl> is an alias for 581 * <control>, 582 * and 583 * <alt> is an alias for 584 * <mod1>. 585 * 586 * The action that is bound to the key is a sequence 587 * of signal names (strings) followed by parameters for 588 * each signal. The signals must be action signals. 589 * (See g_signal_new()). Each parameter can be 590 * a float, integer, string, or unquoted string 591 * representing an enumeration value. The types of 592 * the parameters specified must match the types of the 593 * parameters of the signal. 594 * 595 * Binding sets are connected to widgets in the same manner as styles, 596 * with one difference: Binding sets override other binding sets first 597 * by pattern type, then by priority and then by order of specification. 598 * The priorities that can be specified and their default values are the 599 * same as for styles. 600 */ 601 public class RcStyle : ObjectG 602 { 603 604 /** the main Gtk struct */ 605 protected GtkRcStyle* gtkRcStyle; 606 607 608 public GtkRcStyle* getRcStyleStruct() 609 { 610 return gtkRcStyle; 611 } 612 613 614 /** the main Gtk struct as a void* */ 615 protected override void* getStruct() 616 { 617 return cast(void*)gtkRcStyle; 618 } 619 620 /** 621 * Sets our main struct and passes it to the parent class 622 */ 623 public this (GtkRcStyle* gtkRcStyle) 624 { 625 super(cast(GObject*)gtkRcStyle); 626 this.gtkRcStyle = gtkRcStyle; 627 } 628 629 protected override void setStruct(GObject* obj) 630 { 631 super.setStruct(obj); 632 gtkRcStyle = cast(GtkRcStyle*)obj; 633 } 634 635 deprecated: 636 637 /** 638 */ 639 640 /** 641 * Warning 642 * gtk_rc_scanner_new has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead 643 */ 644 public static ScannerG scannerNew() 645 { 646 // GScanner * gtk_rc_scanner_new (void); 647 auto p = gtk_rc_scanner_new(); 648 649 if(p is null) 650 { 651 return null; 652 } 653 654 return ObjectG.getDObject!(ScannerG)(cast(GScanner*) p); 655 } 656 657 /** 658 * Warning 659 * gtk_rc_get_style has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkStyleContext instead 660 * Finds all matching RC styles for a given widget, 661 * composites them together, and then creates a 662 * GtkStyle representing the composite appearance. 663 * (GTK+ actually keeps a cache of previously 664 * created styles, so a new style may not be 665 * created.) 666 * Params: 667 * widget = a GtkWidget 668 * Returns: the resulting style. No refcount is added to the returned style, so if you want to save this style around, you should add a reference yourself. [transfer none] 669 */ 670 public static Style getStyle(Widget widget) 671 { 672 // GtkStyle * gtk_rc_get_style (GtkWidget *widget); 673 auto p = gtk_rc_get_style((widget is null) ? null : widget.getWidgetStruct()); 674 675 if(p is null) 676 { 677 return null; 678 } 679 680 return ObjectG.getDObject!(Style)(cast(GtkStyle*) p); 681 } 682 683 /** 684 * Warning 685 * gtk_rc_get_style_by_paths has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkStyleContext instead 686 * Creates up a GtkStyle from styles defined in a RC file by providing 687 * the raw components used in matching. This function may be useful 688 * when creating pseudo-widgets that should be themed like widgets but 689 * don't actually have corresponding GTK+ widgets. An example of this 690 * would be items inside a GNOME canvas widget. 691 * Params: 692 * settings = a GtkSettings object 693 * widgetPath = the widget path to use when looking up the 694 * style, or NULL if no matching against the widget path should be done. [allow-none] 695 * classPath = the class path to use when looking up the style, 696 * or NULL if no matching against the class path should be done. [allow-none] 697 * type = a type that will be used along with parent types of this type 698 * when matching against class styles, or G_TYPE_NONE 699 * Returns: A style created by matching with the supplied paths, or NULL if nothing matching was specified and the default style should be used. The returned value is owned by GTK+ as part of an internal cache, so you must call g_object_ref() on the returned value if you want to keep a reference to it. [transfer none] 700 */ 701 public static Style getStyleByPaths(Settings settings, string widgetPath, string classPath, GType type) 702 { 703 // GtkStyle * gtk_rc_get_style_by_paths (GtkSettings *settings, const char *widget_path, const char *class_path, GType type); 704 auto p = gtk_rc_get_style_by_paths((settings is null) ? null : settings.getSettingsStruct(), Str.toStringz(widgetPath), Str.toStringz(classPath), type); 705 706 if(p is null) 707 { 708 return null; 709 } 710 711 return ObjectG.getDObject!(Style)(cast(GtkStyle*) p); 712 } 713 714 /** 715 * Warning 716 * gtk_rc_parse has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead. 717 * Parses a given resource file. 718 * Params: 719 * filename = the filename of a file to parse. If filename is not absolute, it 720 * is searched in the current directory. 721 */ 722 public static void parse(string filename) 723 { 724 // void gtk_rc_parse (const gchar *filename); 725 gtk_rc_parse(Str.toStringz(filename)); 726 } 727 728 /** 729 * Warning 730 * gtk_rc_parse_string has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead. 731 * Parses resource information directly from a string. 732 * Params: 733 * rcString = a string to parse. 734 */ 735 public static void parseString(string rcString) 736 { 737 // void gtk_rc_parse_string (const gchar *rc_string); 738 gtk_rc_parse_string(Str.toStringz(rcString)); 739 } 740 741 /** 742 * Warning 743 * gtk_rc_reparse_all has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead. 744 * If the modification time on any previously read file for the 745 * default GtkSettings has changed, discard all style information 746 * and then reread all previously read RC files. 747 * Returns: TRUE if the files were reread. 748 */ 749 public static int reparseAll() 750 { 751 // gboolean gtk_rc_reparse_all (void); 752 return gtk_rc_reparse_all(); 753 } 754 755 /** 756 * Warning 757 * gtk_rc_reparse_all_for_settings has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead. 758 * If the modification time on any previously read file 759 * for the given GtkSettings has changed, discard all style information 760 * and then reread all previously read RC files. 761 * Params: 762 * settings = a GtkSettings 763 * forceLoad = load whether or not anything changed 764 * Returns: TRUE if the files were reread. 765 */ 766 public static int reparseAllForSettings(Settings settings, int forceLoad) 767 { 768 // gboolean gtk_rc_reparse_all_for_settings (GtkSettings *settings, gboolean force_load); 769 return gtk_rc_reparse_all_for_settings((settings is null) ? null : settings.getSettingsStruct(), forceLoad); 770 } 771 772 /** 773 * Warning 774 * gtk_rc_reset_styles has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead. 775 * This function recomputes the styles for all widgets that use a 776 * particular GtkSettings object. (There is one GtkSettings object 777 * per GdkScreen, see gtk_settings_get_for_screen()); It is useful 778 * when some global parameter has changed that affects the appearance 779 * of all widgets, because when a widget gets a new style, it will 780 * both redraw and recompute any cached information about its 781 * appearance. As an example, it is used when the default font size 782 * set by the operating system changes. Note that this function 783 * doesn't affect widgets that have a style set explicitely on them 784 * with gtk_widget_set_style(). 785 * Since 2.4 786 * Params: 787 * settings = a GtkSettings 788 */ 789 public static void resetStyles(Settings settings) 790 { 791 // void gtk_rc_reset_styles (GtkSettings *settings); 792 gtk_rc_reset_styles((settings is null) ? null : settings.getSettingsStruct()); 793 } 794 795 /** 796 * Warning 797 * gtk_rc_add_default_file has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkStyleContext with a custom GtkStyleProvider instead 798 * Adds a file to the list of files to be parsed at the 799 * end of gtk_init(). 800 * Params: 801 * filename = the pathname to the file. If filename 802 * is not absolute, it is searched in the current directory. [type filename] 803 */ 804 public static void addDefaultFile(string filename) 805 { 806 // void gtk_rc_add_default_file (const gchar *filename); 807 gtk_rc_add_default_file(Str.toStringz(filename)); 808 } 809 810 /** 811 * Warning 812 * gtk_rc_get_default_files has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkStyleContext instead 813 * Retrieves the current list of RC files that will be parsed 814 * at the end of gtk_init(). 815 * Returns: A NULL-terminated array of filenames. This memory is owned by GTK+ and must not be freed by the application. If you want to store this information, you should make a copy. [transfer none][array zero-terminated=1][element-type filename] 816 */ 817 public static string[] getDefaultFiles() 818 { 819 // gchar ** gtk_rc_get_default_files (void); 820 return Str.toStringArray(gtk_rc_get_default_files()); 821 } 822 823 /** 824 * Warning 825 * gtk_rc_set_default_files has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkStyleContext with a custom GtkStyleProvider instead 826 * Sets the list of files that GTK+ will read at the 827 * end of gtk_init(). 828 * Params: 829 * filenames = A 830 * NULL-terminated list of filenames. [array zero-terminated=1][element-type filename] 831 */ 832 public static void setDefaultFiles(string[] filenames) 833 { 834 // void gtk_rc_set_default_files (gchar **filenames); 835 gtk_rc_set_default_files(Str.toStringzArray(filenames)); 836 } 837 838 /** 839 * Warning 840 * gtk_rc_parse_color has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead 841 * Parses a color in the format expected 842 * in a RC file. 843 * Note that theme engines should use gtk_rc_parse_color_full() in 844 * order to support symbolic colors. 845 * Params: 846 * scanner = a GScanner 847 * color = a pointer to a GdkColor structure in which to store 848 * the result. [out] 849 * Returns: G_TOKEN_NONE if parsing succeeded, otherwise the token that was expected but not found 850 */ 851 public static uint parseColor(ScannerG scanner, Color color) 852 { 853 // guint gtk_rc_parse_color (GScanner *scanner, GdkColor *color); 854 return gtk_rc_parse_color((scanner is null) ? null : scanner.getScannerGStruct(), (color is null) ? null : color.getColorStruct()); 855 } 856 857 /** 858 * Warning 859 * gtk_rc_parse_color_full has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead 860 * Parses a color in the format expected 861 * in a RC file. If style is not NULL, it will be consulted to resolve 862 * references to symbolic colors. 863 * Since 2.12 864 * Params: 865 * scanner = a GScanner 866 * style = a GtkRcStyle, or NULL. [allow-none] 867 * color = a pointer to a GdkColor structure in which to store 868 * the result. [out] 869 * Returns: G_TOKEN_NONE if parsing succeeded, otherwise the token that was expected but not found 870 */ 871 public static uint parseColorFull(ScannerG scanner, RcStyle style, Color color) 872 { 873 // guint gtk_rc_parse_color_full (GScanner *scanner, GtkRcStyle *style, GdkColor *color); 874 return gtk_rc_parse_color_full((scanner is null) ? null : scanner.getScannerGStruct(), (style is null) ? null : style.getRcStyleStruct(), (color is null) ? null : color.getColorStruct()); 875 } 876 877 /** 878 * Warning 879 * gtk_rc_parse_state has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead 880 * Parses a GtkStateType variable from the format expected 881 * in a RC file. 882 * Params: 883 * scanner = a GScanner (must be initialized for parsing an RC file) 884 * state = A pointer to a GtkStateType variable in which to 885 * store the result. [out] 886 * Returns: G_TOKEN_NONE if parsing succeeded, otherwise the token that was expected but not found. 887 */ 888 public static uint parseState(ScannerG scanner, out GtkStateType state) 889 { 890 // guint gtk_rc_parse_state (GScanner *scanner, GtkStateType *state); 891 return gtk_rc_parse_state((scanner is null) ? null : scanner.getScannerGStruct(), &state); 892 } 893 894 /** 895 * Warning 896 * gtk_rc_parse_priority has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead 897 * Parses a GtkPathPriorityType variable from the format expected 898 * in a RC file. 899 * Params: 900 * scanner = a GtkScanner (must be initialized for parsing an RC file) 901 * priority = A pointer to GtkPathPriorityType variable in which 902 * to store the result. 903 * Returns: G_TOKEN_NONE if parsing succeeded, otherwise the token that was expected but not found. 904 */ 905 public static uint parsePriority(ScannerG scanner, out GtkPathPriorityType priority) 906 { 907 // guint gtk_rc_parse_priority (GScanner *scanner, GtkPathPriorityType *priority); 908 return gtk_rc_parse_priority((scanner is null) ? null : scanner.getScannerGStruct(), &priority); 909 } 910 911 /** 912 * Warning 913 * gtk_rc_find_module_in_path has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead. 914 * Searches for a theme engine in the GTK+ search path. This function 915 * is not useful for applications and should not be used. 916 * Params: 917 * moduleFile = name of a theme engine 918 * Returns: The filename, if found (must be freed with g_free()), otherwise NULL. [type filename] 919 */ 920 public static string findModuleInPath(string moduleFile) 921 { 922 // gchar * gtk_rc_find_module_in_path (const gchar *module_file); 923 return Str.toString(gtk_rc_find_module_in_path(Str.toStringz(moduleFile))); 924 } 925 926 /** 927 * Warning 928 * gtk_rc_find_pixmap_in_path has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead. 929 * Looks up a file in pixmap path for the specified GtkSettings. 930 * If the file is not found, it outputs a warning message using 931 * g_warning() and returns NULL. 932 * Params: 933 * settings = a GtkSettings 934 * scanner = Scanner used to get line number information for the 935 * warning message, or NULL 936 * pixmapFile = name of the pixmap file to locate. 937 * Returns: the filename. [type filename] 938 */ 939 public static string findPixmapInPath(Settings settings, ScannerG scanner, string pixmapFile) 940 { 941 // gchar * gtk_rc_find_pixmap_in_path (GtkSettings *settings, GScanner *scanner, const gchar *pixmap_file); 942 return Str.toString(gtk_rc_find_pixmap_in_path((settings is null) ? null : settings.getSettingsStruct(), (scanner is null) ? null : scanner.getScannerGStruct(), Str.toStringz(pixmapFile))); 943 } 944 945 /** 946 * Warning 947 * gtk_rc_get_module_dir has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead. 948 * Returns a directory in which GTK+ looks for theme engines. 949 * For full information about the search for theme engines, 950 * see the docs for GTK_PATH in 951 * Running GTK+ Applications(3). 952 * Returns: the directory. (Must be freed with g_free()). [type filename] 953 */ 954 public static string getModuleDir() 955 { 956 // gchar * gtk_rc_get_module_dir (void); 957 return Str.toString(gtk_rc_get_module_dir()); 958 } 959 960 /** 961 * Warning 962 * gtk_rc_get_im_module_path has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead. 963 * Obtains the path in which to look for IM modules. See the documentation 964 * of the GTK_PATH 965 * environment variable for more details about looking up modules. This 966 * function is useful solely for utilities supplied with GTK+ and should 967 * not be used by applications under normal circumstances. 968 * Returns: a newly-allocated string containing the path in which to look for IM modules. [type filename] 969 */ 970 public static string getImModulePath() 971 { 972 // gchar * gtk_rc_get_im_module_path (void); 973 return Str.toString(gtk_rc_get_im_module_path()); 974 } 975 976 /** 977 * Warning 978 * gtk_rc_get_im_module_file has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead. 979 * Obtains the path to the IM modules file. See the documentation 980 * of the GTK_IM_MODULE_FILE 981 * environment variable for more details. 982 * Returns: a newly-allocated string containing the name of the file listing the IM modules available for loading. [type filename] 983 */ 984 public static string getImModuleFile() 985 { 986 // gchar * gtk_rc_get_im_module_file (void); 987 return Str.toString(gtk_rc_get_im_module_file()); 988 } 989 990 /** 991 * Warning 992 * gtk_rc_get_theme_dir has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead. 993 * Returns the standard directory in which themes should 994 * be installed. (GTK+ does not actually use this directory 995 * itself.) 996 * Returns: The directory (must be freed with g_free()). 997 */ 998 public static string getThemeDir() 999 { 1000 // gchar * gtk_rc_get_theme_dir (void); 1001 return Str.toString(gtk_rc_get_theme_dir()); 1002 } 1003 1004 /** 1005 * Warning 1006 * gtk_rc_style_new has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead. 1007 * Creates a new GtkRcStyle with no fields set and 1008 * a reference count of 1. 1009 * Returns: the newly-created GtkRcStyle 1010 */ 1011 public static RcStyle styleNew() 1012 { 1013 // GtkRcStyle * gtk_rc_style_new (void); 1014 auto p = gtk_rc_style_new(); 1015 1016 if(p is null) 1017 { 1018 return null; 1019 } 1020 1021 return ObjectG.getDObject!(RcStyle)(cast(GtkRcStyle*) p); 1022 } 1023 1024 /** 1025 * Warning 1026 * gtk_rc_style_copy has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead. 1027 * Makes a copy of the specified GtkRcStyle. This function 1028 * will correctly copy an RC style that is a member of a class 1029 * derived from GtkRcStyle. 1030 * Returns: the resulting GtkRcStyle. [transfer full] 1031 */ 1032 public RcStyle styleCopy() 1033 { 1034 // GtkRcStyle * gtk_rc_style_copy (GtkRcStyle *orig); 1035 auto p = gtk_rc_style_copy(gtkRcStyle); 1036 1037 if(p is null) 1038 { 1039 return null; 1040 } 1041 1042 return ObjectG.getDObject!(RcStyle)(cast(GtkRcStyle*) p); 1043 } 1044 }