gtkmm: Gtk::CssSection Class Reference

gtkmm 4.16.0

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gtk::CssSection Class Referencefinal

Defines a part of a CSS document. More...

`#include <gtkmm/csssection.h>`

## Public Member Functions
void | reference () const
| Increment the reference count for this object.
void | unreference () const
| Decrement the reference count for this object.
GtkCssSection * | gobj ()
| Provides access to the underlying C instance.
const GtkCssSection * | gobj () const
| Provides access to the underlying C instance.
GtkCssSection * | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
| CssSection ()=delete
| CssSection (const CssSection &)=delete
CssSection & | operator= (const CssSection &)=delete
Glib::ustring | to_string () const
| Prints the section into a human-readable text form.
Glib::RefPtr< CssSection > | get_parent ()
| Gets the parent section for the given `section`.
Glib::RefPtr< const CssSection > | get_parent () const
| Gets the parent section for the given `section`.
Glib::RefPtr< Gio::File > | get_file ()
| Gets the file that section was parsed from.
Glib::RefPtr< const Gio::File > | get_file () const
| Gets the file that section was parsed from.
Glib::RefPtr< Glib::Bytes > | get_bytes () const
| Gets the bytes that section was parsed from.
CssLocation | get_start_location () const
| Returns the location in the CSS document where this section starts.
CssLocation | get_end_location () const
| Returns the location in the CSS document where this section ends.

## Static Public Member Functions
static Glib::RefPtr< CssSection > | create (const Glib::RefPtr< Gio::File > & file, const CssLocation &start, const CssLocation &end)
| Creates a new `Gtk::CssSection` referring to the section in the given `file` from the `start` location to the `end` location.
static Glib::RefPtr< CssSection > | create (const Glib::RefPtr< Gio::File > & file, const Glib::RefPtr< const Glib::Bytes > & bytes, const CssLocation &start, const CssLocation &end)
| Creates a new `Gtk::CssSection` referring to the section in the given `file` or the given `bytes` from the `start` location to the `end` location.

## Protected Member Functions
void | operator delete (void *, std::size_t)

## Related Symbols
(Note that these are not member symbols.)
Glib::RefPtr< Gtk::CssSection > | wrap (GtkCssSection * object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Defines a part of a CSS document.

Because sections are nested into one another, you can use get_parent() to get the containing region.

A CssSection is input data to a Gtk::CssProvider::signal_parsing_error() handler.

Since gtkmm 3.16

## Constructor & Destructor Documentation

## ◆ CssSection() [1/2]

Gtk::CssSection::CssSection | ( |  | ) |
| delete

## ◆ CssSection() [2/2]

Gtk::CssSection::CssSection | ( | const CssSection & |  | ) |
| delete

## Member Function Documentation

## ◆ create() [1/2]

static Glib::RefPtr< CssSection > Gtk::CssSection::create | ( | const Glib::RefPtr< Gio::File > & | file,
|  | const CssLocation & | start,
|  | const CssLocation & | end )
| static

Creates a new `Gtk::CssSection` referring to the section in the given `file` from the `start` location to the `end` location.

Parameters

  file | The file this section refers to.
  start | The start location.
  end | The end location.

Returns
  A new `Gtk::CssSection`.

## ◆ create() [2/2]

static Glib::RefPtr< CssSection > Gtk::CssSection::create | ( | const Glib::RefPtr< Gio::File > & | file,
|  | const Glib::RefPtr< const Glib::Bytes > & | bytes,
|  | const CssLocation & | start,
|  | const CssLocation & | end )
| static

Creates a new `Gtk::CssSection` referring to the section in the given `file` or the given `bytes` from the `start` location to the `end` location.

Since gtkmm 4.16

Parameters

  file | The file this section refers to.
  bytes | The bytes this sections refers to.
  start | The start location.
  end | The end location.

Returns
  A new `Gtk::CssSection`.

## ◆ get_bytes()

Glib::RefPtr< Glib::Bytes > Gtk::CssSection::get_bytes | ( |  | ) | const

Gets the bytes that section was parsed from.

Since gtkmm 4.16

Returns
  The `Bytes` from which the `section` was parsed.

## ◆ get_end_location()

CssLocation Gtk::CssSection::get_end_location | ( |  | ) | const

Returns the location in the CSS document where this section ends.

Returns
  The end location of this section.

## ◆ get_file() [1/2]

Glib::RefPtr< Gio::File > Gtk::CssSection::get_file | ( |  | ) |

Gets the file that section was parsed from.

If no such file exists, for example because the CSS was loaded via Gtk::CssProvider::load_from_data(), then `nullptr` is returned.

Returns
  The `Gio::File` from which the `section` was parsed.

## ◆ get_file() [2/2]

Glib::RefPtr< const Gio::File > Gtk::CssSection::get_file | ( |  | ) | const

Gets the file that section was parsed from.

If no such file exists, for example because the CSS was loaded via Gtk::CssProvider::load_from_data(), then `nullptr` is returned.

Returns
  The `Gio::File` from which the `section` was parsed.

## ◆ get_parent() [1/2]

Glib::RefPtr< CssSection > Gtk::CssSection::get_parent | ( |  | ) |

Gets the parent section for the given `section`.

The parent section is the section that contains this `section`. A special case are sections of type `Gtk::CssSection::Type::DOCUMEN`T. Their parent will either be `nullptr` if they are the original CSS document that was loaded by Gtk::CssProvider::load_from_file() or a section of type `Gtk::CssSection::Type::IMPORT` if it was loaded with an `@a import` rule from a different file.

Returns
  The parent section.

## ◆ get_parent() [2/2]

Glib::RefPtr< const CssSection > Gtk::CssSection::get_parent | ( |  | ) | const

Gets the parent section for the given `section`.

The parent section is the section that contains this `section`. A special case are sections of type `Gtk::CssSection::Type::DOCUMEN`T. Their parent will either be `nullptr` if they are the original CSS document that was loaded by Gtk::CssProvider::load_from_file() or a section of type `Gtk::CssSection::Type::IMPORT` if it was loaded with an `@a import` rule from a different file.

Returns
  The parent section.

## ◆ get_start_location()

CssLocation Gtk::CssSection::get_start_location | ( |  | ) | const

Returns the location in the CSS document where this section starts.

Returns
  The start location of this section.

## ◆ gobj() [1/2]

GtkCssSection * Gtk::CssSection::gobj | ( |  | ) |

Provides access to the underlying C instance.

## ◆ gobj() [2/2]

const GtkCssSection * Gtk::CssSection::gobj | ( |  | ) | const

Provides access to the underlying C instance.

## ◆ gobj_copy()

GtkCssSection * Gtk::CssSection::gobj_copy | ( |  | ) | const

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

## ◆ operator delete()

void Gtk::CssSection::operator delete | ( | void * | ,
|  | std::size_t | )
| protected

## ◆ operator=()

CssSection & Gtk::CssSection::operator= | ( | const CssSection & |  | ) |
| delete

## ◆ reference()

void Gtk::CssSection::reference | ( |  | ) | const

Increment the reference count for this object.

You should never need to do this manually - use the object via a RefPtr instead.

## ◆ to_string()

Glib::ustring Gtk::CssSection::to_string | ( |  | ) | const

Prints the section into a human-readable text form.

This is a form like `gtk.css:32:1-23` to denote line 32, characters 1 to 23 in the file gtk.css.

Returns
  A new string.

## ◆ unreference()

void Gtk::CssSection::unreference | ( |  | ) | const

Decrement the reference count for this object.

You should never need to do this manually - use the object via a RefPtr instead.

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gtk::CssSection > wrap | ( | GtkCssSection * | object,
|  | bool | take_copy = false )
| related

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

Parameters

  object | The C instance.
  take_copy | False 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.