Resource Files

Resource Files

Synopsis

#include <gtk/gtk.h>

                    GtkRcStyle;
enum                GtkRcFlags;
enum                GtkRcTokenType;
GScanner*           gtk_rc_scanner_new                  (void);
GtkStyle*           gtk_rc_get_style                    (GtkWidget *widget);
GtkStyle*           gtk_rc_get_style_by_paths           (GtkSettings *settings,
                                                         const char *widget_path,
                                                         const char *class_path,
                                                         GType type);
void                gtk_rc_parse                        (const gchar *filename);
void                gtk_rc_parse_string                 (const gchar *rc_string);
gboolean            gtk_rc_reparse_all                  (void);
gboolean            gtk_rc_reparse_all_for_settings     (GtkSettings *settings,
                                                         gboolean force_load);
void                gtk_rc_reset_styles                 (GtkSettings *settings);
void                gtk_rc_add_default_file             (const gchar *filename);
gchar**             gtk_rc_get_default_files            (void);
void                gtk_rc_set_default_files            (gchar **filenames);
guint               gtk_rc_parse_color                  (GScanner *scanner,
                                                         GdkColor *color);
guint               gtk_rc_parse_color_full             (GScanner *scanner,
                                                         GtkRcStyle *style,
                                                         GdkColor *color);
guint               gtk_rc_parse_state                  (GScanner *scanner,
                                                         GtkStateType *state);
guint               gtk_rc_parse_priority               (GScanner *scanner,
                                                         GtkPathPriorityType *priority);
gchar*              gtk_rc_find_module_in_path          (const gchar *module_file);
gchar*              gtk_rc_find_pixmap_in_path          (GtkSettings *settings,
                                                         GScanner *scanner,
                                                         const gchar *pixmap_file);
gchar*              gtk_rc_get_module_dir               (void);
gchar*              gtk_rc_get_im_module_path           (void);
gchar*              gtk_rc_get_im_module_file           (void);
gchar*              gtk_rc_get_theme_dir                (void);
GtkRcStyle*         gtk_rc_style_new                    (void);
GtkRcStyle*         gtk_rc_style_copy                   (GtkRcStyle *orig);

Description

Details

GtkRcStyle

typedef struct {
  GObject parent_instance;


  gchar *name;
  gchar *bg_pixmap_name[5];
  PangoFontDescription *font_desc;

  GtkRcFlags color_flags[5];
  GdkColor   fg[5];
  GdkColor   bg[5];
  GdkColor   text[5];
  GdkColor   base[5];

  gint xthickness;
  gint ythickness;
} GtkRcStyle;


enum GtkRcFlags

typedef enum
{
  GTK_RC_FG		= 1 << 0,
  GTK_RC_BG		= 1 << 1,
  GTK_RC_TEXT		= 1 << 2,
  GTK_RC_BASE		= 1 << 3
} GtkRcFlags;


enum GtkRcTokenType

typedef enum {
  GTK_RC_TOKEN_INVALID = G_TOKEN_LAST,
  GTK_RC_TOKEN_INCLUDE,
  GTK_RC_TOKEN_NORMAL,
  GTK_RC_TOKEN_ACTIVE,
  GTK_RC_TOKEN_PRELIGHT,
  GTK_RC_TOKEN_SELECTED,
  GTK_RC_TOKEN_INSENSITIVE,
  GTK_RC_TOKEN_FG,
  GTK_RC_TOKEN_BG,
  GTK_RC_TOKEN_TEXT,
  GTK_RC_TOKEN_BASE,
  GTK_RC_TOKEN_XTHICKNESS,
  GTK_RC_TOKEN_YTHICKNESS,
  GTK_RC_TOKEN_FONT,
  GTK_RC_TOKEN_FONTSET,
  GTK_RC_TOKEN_FONT_NAME,
  GTK_RC_TOKEN_BG_PIXMAP,
  GTK_RC_TOKEN_PIXMAP_PATH,
  GTK_RC_TOKEN_STYLE,
  GTK_RC_TOKEN_BINDING,
  GTK_RC_TOKEN_BIND,
  GTK_RC_TOKEN_WIDGET,
  GTK_RC_TOKEN_WIDGET_CLASS,
  GTK_RC_TOKEN_CLASS,
  GTK_RC_TOKEN_LOWEST,
  GTK_RC_TOKEN_GTK,
  GTK_RC_TOKEN_APPLICATION,
  GTK_RC_TOKEN_THEME,
  GTK_RC_TOKEN_RC,
  GTK_RC_TOKEN_HIGHEST,
  GTK_RC_TOKEN_ENGINE,
  GTK_RC_TOKEN_MODULE_PATH,
  GTK_RC_TOKEN_IM_MODULE_PATH,
  GTK_RC_TOKEN_IM_MODULE_FILE,
  GTK_RC_TOKEN_STOCK,
  GTK_RC_TOKEN_LTR,
  GTK_RC_TOKEN_RTL,
  GTK_RC_TOKEN_COLOR,
  GTK_RC_TOKEN_UNBIND,
  GTK_RC_TOKEN_LAST
} GtkRcTokenType;

Warning

GtkRcTokenType is deprecated and should not be used in newly-written code.


gtk_rc_scanner_new ()

GScanner*           gtk_rc_scanner_new                  (void);

Warning

gtk_rc_scanner_new has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead

Returns :


gtk_rc_get_style ()

GtkStyle*           gtk_rc_get_style                    (GtkWidget *widget);

Warning

gtk_rc_get_style has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkStyleContext instead

Finds all matching RC styles for a given widget, composites them together, and then creates a GtkStyle representing the composite appearance. (GTK+ actually keeps a cache of previously created styles, so a new style may not be created.)

widget :

a GtkWidget

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]

gtk_rc_get_style_by_paths ()

GtkStyle*           gtk_rc_get_style_by_paths           (GtkSettings *settings,
                                                         const char *widget_path,
                                                         const char *class_path,
                                                         GType type);

Warning

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

Creates up a GtkStyle from styles defined in a RC file by providing the raw components used in matching. This function may be useful when creating pseudo-widgets that should be themed like widgets but don't actually have corresponding GTK+ widgets. An example of this would be items inside a GNOME canvas widget.

The action of gtk_rc_get_style() is similar to:

settings :

a GtkSettings object

widget_path :

the widget path to use when looking up the style, or NULL if no matching against the widget path should be done. [allow-none]

class_path :

the class path to use when looking up the style, or NULL if no matching against the class path should be done. [allow-none]

type :

a type that will be used along with parent types of this type when matching against class styles, or G_TYPE_NONE

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]

gtk_rc_parse ()

void                gtk_rc_parse                        (const gchar *filename);

Warning

gtk_rc_parse is deprecated and should not be used in newly-written code.

filename :


gtk_rc_parse_string ()

void                gtk_rc_parse_string                 (const gchar *rc_string);

Warning

gtk_rc_parse_string is deprecated and should not be used in newly-written code.

rc_string :


gtk_rc_reparse_all ()

gboolean            gtk_rc_reparse_all                  (void);

Warning

gtk_rc_reparse_all is deprecated and should not be used in newly-written code.

If the modification time on any previously read file for the default GtkSettings has changed, discard all style information and then reread all previously read RC files.

Returns :

TRUE if the files were reread.

gtk_rc_reparse_all_for_settings ()

gboolean            gtk_rc_reparse_all_for_settings     (GtkSettings *settings,
                                                         gboolean force_load);

Warning

gtk_rc_reparse_all_for_settings is deprecated and should not be used in newly-written code.

If the modification time on any previously read file for the given GtkSettings has changed, discard all style information and then reread all previously read RC files.

settings :

a GtkSettings

force_load :

load whether or not anything changed

Returns :

TRUE if the files were reread.

gtk_rc_reset_styles ()

void                gtk_rc_reset_styles                 (GtkSettings *settings);

Warning

gtk_rc_reset_styles is deprecated and should not be used in newly-written code.

This function recomputes the styles for all widgets that use a particular GtkSettings object. (There is one GtkSettings object per GdkScreen, see gtk_settings_get_for_screen()); It is useful when some global parameter has changed that affects the appearance of all widgets, because when a widget gets a new style, it will both redraw and recompute any cached information about its appearance. As an example, it is used when the default font size set by the operating system changes. Note that this function doesn't affect widgets that have a style set explicitely on them with gtk_widget_set_style().

settings :

a GtkSettings

Since 2.4


gtk_rc_add_default_file ()

void                gtk_rc_add_default_file             (const gchar *filename);

Warning

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

Adds a file to the list of files to be parsed at the end of gtk_init().

filename :

the pathname to the file. If filename is not absolute, it is searched in the current directory. [type filename]

gtk_rc_get_default_files ()

gchar**             gtk_rc_get_default_files            (void);

Warning

gtk_rc_get_default_files has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkStyleContext instead

Retrieves the current list of RC files that will be parsed at the end of gtk_init().

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]

gtk_rc_set_default_files ()

void                gtk_rc_set_default_files            (gchar **filenames);

Warning

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

Sets the list of files that GTK+ will read at the end of gtk_init().

filenames :

A NULL-terminated list of filenames. [array zero-terminated=1][element-type filename]

gtk_rc_parse_color ()

guint               gtk_rc_parse_color                  (GScanner *scanner,
                                                         GdkColor *color);

Warning

gtk_rc_parse_color has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead

Parses a color in the format expected in a RC file.

Note that theme engines should use gtk_rc_parse_color_full() in order to support symbolic colors.

scanner :

a GScanner

color :

a pointer to a GdkColor structure in which to store the result. [out]

Returns :

G_TOKEN_NONE if parsing succeeded, otherwise the token that was expected but not found

gtk_rc_parse_color_full ()

guint               gtk_rc_parse_color_full             (GScanner *scanner,
                                                         GtkRcStyle *style,
                                                         GdkColor *color);

Warning

gtk_rc_parse_color_full has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead

Parses a color in the format expected in a RC file. If style is not NULL, it will be consulted to resolve references to symbolic colors.

scanner :

a GScanner

style :

a GtkRcStyle, or NULL. [allow-none]

color :

a pointer to a GdkColor structure in which to store the result. [out]

Returns :

G_TOKEN_NONE if parsing succeeded, otherwise the token that was expected but not found

Since 2.12


gtk_rc_parse_state ()

guint               gtk_rc_parse_state                  (GScanner *scanner,
                                                         GtkStateType *state);

Warning

gtk_rc_parse_state has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead

state :

. [out]

Returns :


gtk_rc_parse_priority ()

guint               gtk_rc_parse_priority               (GScanner *scanner,
                                                         GtkPathPriorityType *priority);

Warning

gtk_rc_parse_priority has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkCssProvider instead

priority :

. [out]

Returns :


gtk_rc_find_module_in_path ()

gchar*              gtk_rc_find_module_in_path          (const gchar *module_file);

Warning

gtk_rc_find_module_in_path is deprecated and should not be used in newly-written code.

Searches for a theme engine in the GTK+ search path. This function is not useful for applications and should not be used.

module_file :

name of a theme engine

Returns :

The filename, if found (must be freed with g_free()), otherwise NULL. [type filename]

gtk_rc_find_pixmap_in_path ()

gchar*              gtk_rc_find_pixmap_in_path          (GtkSettings *settings,
                                                         GScanner *scanner,
                                                         const gchar *pixmap_file);

Warning

gtk_rc_find_pixmap_in_path is deprecated and should not be used in newly-written code.

Looks up a file in pixmap path for the specified GtkSettings. If the file is not found, it outputs a warning message using g_warning() and returns NULL.

settings :

a GtkSettings

scanner :

Scanner used to get line number information for the warning message, or NULL

pixmap_file :

name of the pixmap file to locate.

Returns :

the filename. [type filename]

gtk_rc_get_module_dir ()

gchar*              gtk_rc_get_module_dir               (void);

Warning

gtk_rc_get_module_dir is deprecated and should not be used in newly-written code.

Returns a directory in which GTK+ looks for theme engines. For full information about the search for theme engines, see the docs for GTK_PATH in Running GTK+ Applications(3).

Returns :

the directory. (Must be freed with g_free()). [type filename]

gtk_rc_get_im_module_path ()

gchar*              gtk_rc_get_im_module_path           (void);

Warning

gtk_rc_get_im_module_path is deprecated and should not be used in newly-written code.

Obtains the path in which to look for IM modules. See the documentation of the GTK_PATH environment variable for more details about looking up modules. This function is useful solely for utilities supplied with GTK+ and should not be used by applications under normal circumstances.

Returns :

a newly-allocated string containing the path in which to look for IM modules. [type filename]

gtk_rc_get_im_module_file ()

gchar*              gtk_rc_get_im_module_file           (void);

Warning

gtk_rc_get_im_module_file is deprecated and should not be used in newly-written code.

Obtains the path to the IM modules file. See the documentation of the GTK_IM_MODULE_FILE environment variable for more details.

Returns :

a newly-allocated string containing the name of the file listing the IM modules available for loading. [type filename]

gtk_rc_get_theme_dir ()

gchar*              gtk_rc_get_theme_dir                (void);

Warning

gtk_rc_get_theme_dir is deprecated and should not be used in newly-written code.

Returns :


gtk_rc_style_new ()

GtkRcStyle*         gtk_rc_style_new                    (void);

Warning

gtk_rc_style_new is deprecated and should not be used in newly-written code.

Returns :


gtk_rc_style_copy ()

GtkRcStyle*         gtk_rc_style_copy                   (GtkRcStyle *orig);

Warning

gtk_rc_style_copy is deprecated and should not be used in newly-written code.

Makes a copy of the specified GtkRcStyle. This function will correctly copy an RC style that is a member of a class derived from GtkRcStyle.

orig :

the style to copy

Returns :

the resulting GtkRcStyle. [transfer full]