Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::Gtk::RC Class Reference

A C++ wrapper class for the various resource file functions. More...

#include <xfc/gtk/rc.hh>

List of all members.

Static Public Member Functions

Accessors
Methods

Detailed Description

A C++ wrapper class for the various resource file functions.

GTK+ provides a resource file mechanism for configuring various aspects of the operation of a GTK+ program at runtime. XFC wraps the API for managing resource files into a one convenient class, called RC.

Default files

An application can cause GTK+ to parse a specific RC file by calling Gtk::RC::parse(). In addition to this, certain files will be read at the end of Main::init(). Unless modified, the files looked for will be <SYSCONFDIR>/gtk-2.0/gtkrc and .gtkrc-2.0 in the users home directory. (<SYSCONFDIR> defaults to /usr/local/etc. It can be changed with the --prefix or --sysconfdir options when configuring GTK+.)

The set of these default files can be retrieved with Gtk::RC::get_default_files() and modified with Gtk::RC::add_default_file() and Gtk::RC::set_default_files(). Additionally, the GTK2_RC_FILES environment variable can be set to a G_SEARCHPATH_SEPARATOR_S-separated list of files in order to overwrite the set of default files at runtime.

For each RC file, in addition to the file itself, GTK+ will look for a locale-specific file that will be parsed after the main file. For instance, if LANG is set to ja_JP.ujis, when loading the default file ~/.gtkrc then GTK+ looks for ~/.gtkrc.ja_JP and ~/.gtkrc.ja, and parses the first of those that exists.

For information on writing RC files, see the GTK+ reference documentation: Resource Files.


Member Function Documentation

void Xfc::Gtk::RC::add_default_file const String filename  )  [static]
 

Adds a file to the list of files to be parsed at the end of Main::init().

Parameters:
filename The pathname to the file.
If filename is not absolute, it is searched in the current directory.

String Xfc::Gtk::RC::find_pixmap_in_path const Settings settings,
const String pixmap_file,
const G::Scanner scanner = 0
[static]
 

Looks up a file in pixmap path for the specified Settings.

Parameters:
settings A Settings object.
pixmap_file The name of the pixmap file to locate.
scanner A scanner used to get line number information for the warning message, or null.
Returns:
The filename.
If the file is not found, it outputs a warning message using g_warning() and returns a null String.

std::vector<String> Xfc::Gtk::RC::get_default_files  )  [static]
 

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

Returns:
A vector of String that holds the list of filenames.

String Xfc::Gtk::RC::get_im_module_file  )  [static]
 

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

Returns:
A String containing the name of the file listing the IM modules available for loading.

String Xfc::Gtk::RC::get_module_dir  )  [static]
 

Returns a directory in which GTK+ looks for theme engines.

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

Style* Xfc::Gtk::RC::get_style const Widget widget  )  [static]
 

Finds all matching RC styles for a given widget, composites them together, and then creates a Style representing the composite appearance.

Parameters:
widget A GtkWidget.
Returns:
The resulting style.
GTK+ actually keeps a cache of previously created styles, so a new style may not be created. No refcount is added to the returned style, so if you want to save this style, you should add a reference yourself.

Style* Xfc::Gtk::RC::get_style_by_paths const Settings settings,
const String widget_path,
const String class_path,
GType  type
[static]
 

Creates a Style from styles defined in a RC file by providing the raw components used in matching.

Parameters:
settings A Settings 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.
class_path The class path to use when looking up the style, or null if no matching against the class path should be done.
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.
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 returned value is owned by GTK+ as part of an internal cache, so you must call ref() on the returned value if you want to keep a reference to it.

String Xfc::Gtk::RC::get_theme_dir  )  [static]
 

Returns the standard directory in which themes should be installed (GTK+ does not actually use this directory itself).

Returns:
The directory.

void Xfc::Gtk::RC::parse const String filename  )  [static]
 

Parses a given resource file.

Parameters:
filename The name of a file to parse.
If filename is not absolute, it is searched for in the current directory.

unsigned int Xfc::Gtk::RC::parse_color const G::Scanner scanner,
Gdk::Color color
[static]
 

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

Parameters:
scanner A Scanner.
color A reference to a Gdk::Color that will to store the result.
Returns:
G_TOKEN_NONE if parsing succeeded, otherwise the token that was expected but not found.

unsigned int Xfc::Gtk::RC::parse_state const G::Scanner scanner,
StateType state
[static]
 

Parses a StateType variable from the format expected in a RC file.

Parameters:
scanner A Scanner (must be initialized for parsing an RC file)
state A reference to a StateType variable in which to store the result.
Returns:
G_TOKEN_NONE if parsing succeeded, otherwise the token that was expected but not found.

void Xfc::Gtk::RC::parse_string const String rc_string  )  [static]
 

Parses resource information directly from a string.

Parameters:
rc_string A string to parse.

bool Xfc::Gtk::RC::reparse_all  )  [static]
 

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

Returns:
true if the files were reread.

bool Xfc::Gtk::RC::reparse_all_for_settings const Settings settings,
bool  force_load
[static]
 

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

Parameters:
settings A Settings object.
force_load If true load whether or not anything changed.
Returns:
true if the files were reread.

void Xfc::Gtk::RC::reset_styles const Settings settings  )  [static]
 

Recomputes the styles for all widgets that use a particular Settings object.

Parameters:
settings A Settings object.
There is one Gtk::Settings object per Gdk::Screen (see Gtk::Settings::get_for_screen()). This method 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().

void Xfc::Gtk::RC::set_default_files const std::vector< String > &  filenames  )  [static]
 

Sets the list of files that will be read at the end of Main::init().

Parameters:
filenames A vector of String that holds the list of filenames.


The documentation for this class was generated from the following file: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3