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