Gdk::Drawable Class Reference

Drawing Primitives. More...

Inherits Glib::Object.

Inherited by Gdk::Pixmap, and Gdk::Window.

Collaboration diagram for Gdk::Drawable:
Collaboration graph
[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.
void get_size (int& width, int& height) const
 Fills * width and * height with the size of drawable.
int get_depth () const
 Obtains the bit depth of the drawable, that is, the number of bits that make up a pixel in the drawable's visual.
void set_colormap (const Glib::RefPtr< Colormap >& colormap)
 Sets the colormap associated with drawable.
Glib::RefPtr< Colormapget_colormap ()
 Gets the colormap for drawable, if one is set; returns 0 otherwise.
Glib::RefPtr< Visualget_visual ()
 Gets the Gdk::Visual describing the pixel format of drawable.
Cairo::RefPtr< Cairo::Regionget_clip_region () const
 Computes the region of a drawable that potentially can be written to by drawing primitives.
Cairo::RefPtr< Cairo::Regionget_visible_region () const
 Computes the region of a drawable that is potentially visible.
Glib::RefPtr< Screenget_screen ()
 Gets the Gdk::Screen associated with a Gdk::Drawable.
Glib::RefPtr< const Screenget_screen () const
 Gets the Gdk::Screen associated with a Gdk::Drawable.
Glib::RefPtr< Displayget_display ()
 Gets the Gdk::Display associated with a Gdk::Drawable.
Glib::RefPtr< const Displayget_display () const
 Gets the Gdk::Display associated with a Gdk::Drawable.
Cairo::RefPtr< Cairo::Contextcreate_cairo_context ()
 Creates a Cairo context for drawing to drawable.

Static Public Member Functions

static Glib::RefPtr< Drawablecreate ()

Protected Member Functions

 Drawable ()

Related Functions

(Note that these are not member functions.)



Glib::RefPtr< Gdk::Drawablewrap (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.
Glib::RefPtr<Colormap> Gdk::Drawable::get_colormap (  ) 

Gets the colormap for drawable, if one is set; returns 0 otherwise.

Returns:
The colormap, or 0.
int Gdk::Drawable::get_depth (  )  const

Obtains the bit depth of the drawable, that is, the number of bits that make up a pixel in the drawable's visual.

Examples are 8 bits per pixel, 24 bits per pixel, etc.

Returns:
Number of bits per pixel.
Glib::RefPtr<const Display> Gdk::Drawable::get_display (  )  const

Gets the Gdk::Display associated with a Gdk::Drawable.

Since gtkmm 2.2:
Returns:
The Gdk::Display associated with drawable.
Glib::RefPtr<Display> Gdk::Drawable::get_display (  ) 

Gets the Gdk::Display associated with a Gdk::Drawable.

Since gtkmm 2.2:
Returns:
The Gdk::Display associated with drawable.
Glib::RefPtr<const Screen> Gdk::Drawable::get_screen (  )  const

Gets the Gdk::Screen associated with a Gdk::Drawable.

Since gtkmm 2.2:
Returns:
The Gdk::Screen associated with drawable.
Glib::RefPtr<Screen> Gdk::Drawable::get_screen (  ) 

Gets the Gdk::Screen associated with a Gdk::Drawable.

Since gtkmm 2.2:
Returns:
The Gdk::Screen associated with drawable.
void Gdk::Drawable::get_size ( int &  width,
int &  height 
) const

Fills * width and * height with the size of drawable.

width or height can be 0 if you only want the other one.

On the X11 platform, if drawable is a Gdk::Window, the returned size is the size reported in the most-recently-processed configure event, rather than the current size on the X server.

Parameters:
width Location to store drawable's width, or 0.
height Location to store drawable's height, or 0.
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.
Glib::RefPtr<Visual> Gdk::Drawable::get_visual (  ) 

Gets the Gdk::Visual describing the pixel format of drawable.

Returns:
A Gdk::Visual.
const GdkDrawable* Gdk::Drawable::gobj (  )  const [inline]

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

Reimplemented in Gdk::Pixmap, and Gdk::Window.

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

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

Reimplemented in Gdk::Pixmap, and 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::Pixmap, and Gdk::Window.

void Gdk::Drawable::set_colormap ( const Glib::RefPtr< Colormap >&  colormap  ) 

Sets the colormap associated with drawable.

Normally this will happen automatically when the drawable is created; you only need to use this function if the drawable-creating function did not have a way to determine the colormap, and you then use drawable operations that require a colormap. The colormap for all drawables and graphics contexts you intend to use together should match. i.e. when using a Gdk::GC to draw to a drawable, or copying one drawable to another, the colormaps should match.

Parameters:
colormap A Gdk::Colormap.

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:
Generated on Wed Sep 15 10:49:29 2010 for gtkmm by  doxygen 1.6.3