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