gtkmm 3.1.16
Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions

Gtk::CssProvider Class Reference

CSS-like styling for widgets, implementing the StyleProvider base class. More...

Inheritance diagram for Gtk::CssProvider:
Inheritance graph
[legend]
Collaboration diagram for Gtk::CssProvider:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~CssProvider ()
GtkCssProvider* gobj ()
 Provides access to the underlying C GObject.
const GtkCssProvider* gobj () const
 Provides access to the underlying C GObject.
GtkCssProvider* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::ustring to_string () const
 Convertes the provider into a string representation in CSS format.
bool load_from_data (const std::string& data)
 Loads data into this css provider, making it clear any previously loaded information.
bool load_from_file (const Glib::RefPtr< const Gio::File >& file)
 Loads the data contained in file into css_provider, making it clear any previously loaded information.
bool load_from_path (const std::string& path)
 Loads the data contained in path into css_provider, making it clear any previously loaded information.

Static Public Member Functions

static Glib::RefPtr< CssProvidercreate ()
static Glib::RefPtr< CssProviderget_default ()
 Returns the provider containing the style settings used as a fallback for all widgets.
static Glib::RefPtr< CssProviderget_named (const Glib::ustring& name, const Glib::ustring& variant)
 Loads a theme from the usual theme paths.

Protected Member Functions

 CssProvider ()

Related Functions

(Note that these are not member functions.)
Glib::RefPtr< Gtk::CssProviderwrap (GtkCssProvider* object, bool take_copy=false)
 A Glib::wrap() method for this object.

Detailed Description

CSS-like styling for widgets, implementing the StyleProvider base class.

It is able to parse <ulink url="http://www.w3.org/TR/CSS2">CSS</ulink>-like input in order to style widgets.

An application can cause GTK+ to parse a specific CSS style sheet by calling load_from_file() and adding the provider with StyleContext::add_provider() or StyleContext::add_provider_for_screen(). In addition, certain files will be read when GTK+ is initialized. See the <ulink url="http://library.gnome.org/devel/gtk3/unstable/GtkCssProvider.html#GtkCssProvider.description">GtkCssProvider documentation</ulink> for details of these default files and details of the stylesheets.

Since gtkmm 3.0:

Constructor & Destructor Documentation

virtual Gtk::CssProvider::~CssProvider ( ) [virtual]
Gtk::CssProvider::CssProvider ( ) [protected]

Member Function Documentation

static Glib::RefPtr<CssProvider> Gtk::CssProvider::create ( ) [static]
static Glib::RefPtr<CssProvider> Gtk::CssProvider::get_default ( ) [static]

Returns the provider containing the style settings used as a fallback for all widgets.

Returns:
The provider used for fallback styling. This memory is owned by GTK+, and you must not free it.
static Glib::RefPtr<CssProvider> Gtk::CssProvider::get_named ( const Glib::ustring name,
const Glib::ustring variant 
) [static]

Loads a theme from the usual theme paths.

Parameters:
nameA theme name.
variantVariant to load, for example, "dark", or 0 for the default.
Returns:
A Gtk::CssProvider with the theme loaded. This memory is owned by GTK+, and you must not free it.
const GtkCssProvider* Gtk::CssProvider::gobj ( ) const [inline]

Provides access to the underlying C GObject.

Reimplemented from Gtk::StyleProvider.

GtkCssProvider* Gtk::CssProvider::gobj ( ) [inline]

Provides access to the underlying C GObject.

Reimplemented from Gtk::StyleProvider.

GtkCssProvider* Gtk::CssProvider::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

bool Gtk::CssProvider::load_from_data ( const std::string data)

Loads data into this css provider, making it clear any previously loaded information.

Parameters:
dataCSS data loaded in memory.
Returns:
True if the data could be loaded.
bool Gtk::CssProvider::load_from_file ( const Glib::RefPtr< const Gio::File > &  file)

Loads the data contained in file into css_provider, making it clear any previously loaded information.

Parameters:
fileFile pointing to a file to load.
Returns:
true if the data could be loaded.
bool Gtk::CssProvider::load_from_path ( const std::string path)

Loads the data contained in path into css_provider, making it clear any previously loaded information.

Parameters:
pathThe path of a filename to load, in the GLib filename encoding.
Returns:
true if the data could be loaded.
Glib::ustring Gtk::CssProvider::to_string ( ) const

Convertes the provider into a string representation in CSS format.

Using load_from_data() with the return value from this function on a new provider created with new() will basicallu create a duplicate of this provider.

Returns:
A new string representing the provider.

Friends And Related Function Documentation

Glib::RefPtr< Gtk::CssProvider > wrap ( GtkCssProvider *  object,
bool  take_copy = false 
) [related]

A Glib::wrap() method for this object.

Parameters:
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns:
A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file: