# Gdk::Drawable Class Reference

Drawing Primitives. More...

Inherits Glib::Object.

Inherited by Gdk::Window.

Collaboration diagram for Gdk::Drawable:
[legend]

List of all members.

## Public Member Functions

virtual | ~Drawable ()
GdkDrawable* | gobj ()
| Provides access to the underlying C GObject.
const GdkDrawable* | gobj () const
| Provides access to the underlying C GObject.
GdkDrawable* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Cairo::RefPtr< Cairo::Region > | get_clip_region () const
| Computes the region of a drawable that potentially can be written to by drawing primitives.
Cairo::RefPtr< Cairo::Region > | get_visible_region () const
| Computes the region of a drawable that is potentially visible.
Cairo::RefPtr< Cairo::Context > | create_cairo_context ()
| Creates a Cairo context for drawing to drawable.

## Static Public Member Functions

static Glib::RefPtr< Drawable > | create ()

## Protected Member Functions

| Drawable ()

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr< Gdk::Drawable > | wrap (GdkDrawable* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Drawing Primitives.

Gdk::Drawable is the base class for all of the objects that accept drawing commands. The available drawables include pixmaps, windows, and bitmaps. Drawable is abstract as there is no such type on the server side.

To use a drawable, create a concrete Drawable of the type you wish to use and a Gdk::GC (graphics context) for that Drawable. With the GC you can draw lines, text, arcs and such.

An alternative is to create a Cairo::Context with get_cairo_context() while you handle the 'exposed' event of the drawable. For more about this, please see "Using cairo with GTK+" in the "Common questions" section of the GTK+ Reference Manual.

## Constructor & Destructor Documentation

virtual Gdk::Drawable::~Drawable | ( |  | ) | `[virtual]`

Gdk::Drawable::Drawable | ( |  | ) | `[protected]`

## Member Function Documentation

static Glib::RefPtr<Drawable> Gdk::Drawable::create | ( |  | ) | `[static]`

Cairo::RefPtr<Cairo::Context> Gdk::Drawable::create_cairo_context | ( |  | ) |

Creates a Cairo context for drawing to drawable.

Returns:
  A newly created Cairo context.

Since gtkmm 2.10:

Cairo::RefPtr<Cairo::Region> Gdk::Drawable::get_clip_region | ( |  | ) | const

Computes the region of a drawable that potentially can be written to by drawing primitives.

This region will not take into account the clip region for the GC, and may also not take into account other factors such as if the window is obscured by other windows, but no area outside of this region will be affected by drawing primitives.

Returns:
  A Gdk::Region. This must be freed with gdk_region_destroy() when you are done.

Cairo::RefPtr<Cairo::Region> Gdk::Drawable::get_visible_region | ( |  | ) | const

Computes the region of a drawable that is potentially visible.

This does not necessarily take into account if the window is obscured by other windows, but no area outside of this region is visible.

Returns:
  A Gdk::Region. This must be freed with gdk_region_destroy() when you are done.

const GdkDrawable* Gdk::Drawable::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

Reimplemented in Gdk::Window.

GdkDrawable* Gdk::Drawable::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

Reimplemented in Gdk::Window.

GdkDrawable* Gdk::Drawable::gobj_copy | ( |  | ) |

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

Reimplemented in Gdk::Window.

## Friends And Related Function Documentation

Glib::RefPtr< Gdk::Drawable > wrap | ( | GdkDrawable * | 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.

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

- gdkmm/drawable.h