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