diff options
Diffstat (limited to 'libs/gtkmm2/gdk/gdkmm')
82 files changed, 17568 insertions, 0 deletions
diff --git a/libs/gtkmm2/gdk/gdkmm/bitmap.cc b/libs/gtkmm2/gdk/gdkmm/bitmap.cc new file mode 100644 index 0000000000..27063537a6 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/bitmap.cc @@ -0,0 +1,71 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/bitmap.h> +#include <gdkmm/private/bitmap_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdk/gdkpixmap.h> +#include <gdkmm/window.h> + + +namespace Gdk +{ + +Bitmap::Bitmap(GdkBitmap* castitem) +: + Pixmap((GdkPixmap*) castitem) +{} + +Bitmap::Bitmap(const char* data, int width, int height) +: + Pixmap((GdkPixmap*) gdk_bitmap_create_from_data(0, data, width, height)) +{} + +Bitmap::Bitmap(const Glib::RefPtr<Drawable>& drawable, const char* data, int width, int height) +: + Pixmap((GdkPixmap*) gdk_bitmap_create_from_data(Glib::unwrap(drawable), data, width, height)) +{} + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + + +namespace Gdk +{ + + +Glib::RefPtr<Bitmap> Bitmap::create(const char* data, int width, int height) +{ + return Glib::RefPtr<Bitmap>( new Bitmap(data, width, height) ); +} +Glib::RefPtr<Bitmap> Bitmap::create(const Glib::RefPtr<Gdk::Drawable>& drawable, const char* data, int width, int height) +{ + return Glib::RefPtr<Bitmap>( new Bitmap(drawable, data, width, height) ); +} + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/bitmap.h b/libs/gtkmm2/gdk/gdkmm/bitmap.h new file mode 100644 index 0000000000..57dc9fb087 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/bitmap.h @@ -0,0 +1,79 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_BITMAP_H +#define _GDKMM_BITMAP_H + +#include <glibmm.h> + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdkmm/pixmap.h> +#include <gdk/gdkpixmap.h> + + +namespace Gdk +{ + +class Window; + +// In GDK, GdkBitmap has the same type as GdkPixmap. Both are typedefed +// to their base type GdkDrawable, but the real type is GdkPixmapObject. +// A GdkBitmap is a GdkPixmap with a depth of 1. + +/** Bitmaps are simply pixmaps with a depth of 1. (That is, they are monochrome bitmaps - each pixel can be either on or off). + */ +class Bitmap : public Gdk::Pixmap +{ + // The Bitmap type only really exists in gtkmm. We fake its existence + // with a custom Gdk::Pixmap_Class::wrap_new() -- see comments there. + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Bitmap CppObjectType; + typedef GdkBitmap BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + explicit Bitmap(GdkBitmap* castitem); + friend class Gdk::Pixmap_Class; +#endif + + Bitmap(const char* data, int width, int height); + + Bitmap(const Glib::RefPtr<Gdk::Drawable>& drawable, const char* data, int width, int height); + +public: + + static Glib::RefPtr<Bitmap> create(const char* data, int width, int height); + + + static Glib::RefPtr<Bitmap> create(const Glib::RefPtr<Gdk::Drawable>& drawable, const char* data, int width, int height); + + +}; + +} // namespace Gdk + + +#endif /* _GDKMM_BITMAP_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/color.cc b/libs/gtkmm2/gdk/gdkmm/color.cc new file mode 100644 index 0000000000..06c8e70cf5 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/color.cc @@ -0,0 +1,297 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/color.h> +#include <gdkmm/private/color_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdkmm/colormap.h> +#include <gdk/gdkcolor.h> +#include <gdk/gdkrgb.h> + +namespace Gdk +{ + +Color::Color() +{ + GdkColor tmp = { 0, 0, 0, 0, }; + gobject_ = gdk_color_copy(&tmp); +} + +Color::Color(const Glib::ustring& value) +{ + GdkColor tmp = { 0, 0, 0, 0, }; + gobject_ = gdk_color_copy(&tmp); + + set(value); +} + +void Color::set_grey(gushort value) +{ + gobject_->red = gobject_->green = gobject_->blue = value; +} + +void Color::set_grey_p(double g) +{ + gobject_->red = gobject_->green = gobject_->blue = (gushort)(g * 65535.0); +} + +void Color::set_rgb(gushort red_, gushort green_, gushort blue_) +{ + gobject_->red = red_; + gobject_->green = green_; + gobject_->blue = blue_; +} + +void Color::set_rgb_p(double red_, double green_, double blue_) +{ + gobject_->red = (gushort)(red_ * 65535.0); + gobject_->green = (gushort)(green_ * 65535.0); + gobject_->blue = (gushort)(blue_ * 65535.0); +} + +void Color::set_hsv(double h, double s, double v) +{ + //TODO: Comments/Documentation. I have no idea what this code does. murrayc. + + h /= 60.0; + int i = (int)h; + double p = v * (1 - s); + double q = v * (1 - s * (h - i)); + double t = v * (1 - s * (1 - h + i)); + + switch(i) + { + case 0: + set_rgb_p(v, t, p); + break; + case 1: + set_rgb_p(q, v, p); + break; + case 2: + set_rgb_p(p, v, t); + break; + case 3: + set_rgb_p(p, q, v); + break; + case 4: + set_rgb_p(t, p, v); + break; + default: + set_rgb_p(v, p, q); + } +} + +void Color::set_hsl(double h, double s, double l) +{ + //TODO: Comments/Documentation. I have no idea what this code does. murrayc. + + if(s == 0.0) + set_grey_p(l); + else + { + double t2 = (l < 0.5) ? l * (1.0 + s) : l + s - l * s; + double t1 = 2*l-t2; + h /= 360.0; + + double tr = h + 1.0/3.0; + double tg = h; + double tb = h - 1.0/3.0; + if (tb < 0) tb += 1.0; + + double r = 0.0, g = 0.0, b = 0.0; + + if (tr < 1.0/6.0) + r = t1 +(t2-t1) * 6 * tr; + else if (tr < 1.0/2.0) + r = t2; + else if (tr < 2.0/3.0) + r = t1+(t2-t1)*(2.0/3.0 - tr) * 6.0; + + if (tg < 1.0/6.0) + g = t1 + (t2 - t1) * 6 * tg; + else if (tg < 1.0/2.0) + g = t2; + else if (tg < 2.0/3.0) + g = t1+(t2-t1)*(2.0/3.0 - tg) * 6.0; + + if (tb < 1.0/6.0) + b = t1 +(t2-t1) * 6 * tb; + else if (tb < 1.0/2.0) + b = t2; + else if (tb < 2.0/3.0) + b = t1+(t2-t1)*(2.0/3.0 - tb) * 6.0; + + set_rgb_p(r, g, b); + } +} + +bool Color::set(const Glib::ustring& value) +{ + return gdk_color_parse(value.c_str(), gobj()); +} + +bool Color::parse(const Glib::ustring& spec) +{ + return set(spec); +} + +gushort Color::get_red() const +{ + return gobject_->red; +} + +gushort Color::get_green() const +{ + return gobject_->green; + +} +gushort Color::get_blue() const +{ + return gobject_->blue; +} + +void Color::set_red(gushort value) +{ + gobject_->red = value; +} + +void Color::set_green(gushort value) +{ + gobject_->green = value; +} + +void Color::set_blue(gushort value) +{ + gobject_->blue = value; +} + +void Color::rgb_find_color(const Glib::RefPtr<Gdk::Colormap>& map) +{ + gdk_rgb_find_color(map->gobj(), gobj()); +} + +guint Color::get_pixel() const +{ + return gobject_->pixel; +} + +double Color::get_red_p() const +{ + return gobject_->red / 65535.0; +} + +double Color::get_green_p() const +{ + return gobject_->green / 65535.0; +} + +double Color::get_blue_p() const +{ + return gobject_->blue / 65535.0; +} + + +} //namespace Gdk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gdk::Color wrap(GdkColor* object, bool take_copy) +{ + return Gdk::Color(object, take_copy); +} + +} // namespace Glib + + +namespace Gdk +{ + + +// static +GType Color::get_type() +{ + return gdk_color_get_type(); +} + + +Color::Color(const Color& other) +: + gobject_ ((other.gobject_) ? gdk_color_copy(other.gobject_) : 0) +{} + +Color::Color(GdkColor* gobject, bool make_a_copy) +: + // For BoxedType wrappers, make_a_copy is true by default. The static + // BoxedType wrappers must always take a copy, thus make_a_copy = true + // ensures identical behaviour if the default argument is used. + gobject_ ((make_a_copy && gobject) ? gdk_color_copy(gobject) : gobject) +{} + +Color& Color::operator=(const Color& other) +{ + Color temp (other); + swap(temp); + return *this; +} + +Color::~Color() +{ + if(gobject_) + gdk_color_free(gobject_); +} + +void Color::swap(Color& other) +{ + GdkColor *const temp = gobject_; + gobject_ = other.gobject_; + other.gobject_ = temp; +} + +GdkColor* Color::gobj_copy() const +{ + return gdk_color_copy(gobject_); +} + + +bool operator==(const Color& lhs, const Color& rhs) +{ + return (gdk_color_equal(lhs.gobj(), rhs.gobj()) != 0); +} + +bool operator!=(const Color& lhs, const Color& rhs) +{ + return (gdk_color_equal(lhs.gobj(), rhs.gobj()) == 0); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/color.h b/libs/gtkmm2/gdk/gdkmm/color.h new file mode 100644 index 0000000000..c40ff67f25 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/color.h @@ -0,0 +1,274 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_COLOR_H +#define _GDKMM_COLOR_H + +#include <glibmm.h> + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdk/gdkcolor.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GdkColor GdkColor; } +#endif + +namespace Gdk +{ + +class Colormap; + +/** Gdk::Color is used to describe an allocated or unallocated color. + * It contains the following data: + * pixel: For allocated colors, the value used to draw this color on the screen. + * red: The red component of the color. This is a value between 0 and 65535, with 65535 indicating full intensitiy. + * green: The green component of the color. + * blue: The blue component of the color. + */ +class Color +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Color CppObjectType; + typedef GdkColor BaseObjectType; + + static GType get_type() G_GNUC_CONST; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + + explicit Color(GdkColor* gobject, bool make_a_copy = true); + + Color(const Color& other); + Color& operator=(const Color& other); + + ~Color(); + + void swap(Color& other); + + ///Provides access to the underlying C instance. + GdkColor* gobj() { return gobject_; } + + ///Provides access to the underlying C instance. + const GdkColor* gobj() const { return gobject_; } + + ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. + GdkColor* gobj_copy() const; + +protected: + GdkColor* gobject_; + +private: + +public: + + + /** Instantiate a new Gdk::Color. + * You should then use the set methods and call Gdk::Colormap::alloc_color(). + */ + Color(); + + /** Instantiate a new Gdk::Color. + * The color is not allocated - you must call Gdk::Colormap::alloc_color() yourself. + * The text string can be in any of the forms accepted by XParseColor; these include names for a color from rgb.txt, + * such as DarkSlateGray, or a hex specification such as 305050. + * @param value the string specifying the color.. + */ + explicit Color(const Glib::ustring& value); + + /** Set a grey color, by using the same value for all color components. + * @param value The value to be used for the red, green, and blue components. + */ + void set_grey(gushort value); + void set_grey_p(double g); + + /** Set the color, by specifying red, green, and blue color component values. + * @param red_ The red component of the color. + * @param green_ The green component of the color. + * @param blue_ The blue component of the color. + */ + void set_rgb(gushort red_, gushort green_, gushort blue_); + + /** Set the color, by specifying red, green, and blue color component values, as percentages. + * @param red_ The red component of the color, as a percentage. + * @param green_ The green component of the color, as a percentage. + * @param blue_ The blue component of the color, as a percentage. + */ + void set_rgb_p(double red_, double green_, double blue_); + + void set_hsv(double h, double s, double v); + void set_hsl(double h, double s, double l); + + /** Parses a textual specification of a color and fills in the red, green, and blue values. + * The color is not allocated - you must call Gdk::Colormap::alloc_color() yourself. + * The text string can be in any of the forms accepted by XParseColor; these include names for a color from rgb.txt, + * such as DarkSlateGray, or a hex specification such as 305050. + * + * @param value the string specifying the color. + * @result true if the parsing succeeded. + */ + bool set(const Glib::ustring& value); + + #ifndef GDKMM_DEPRECATED + /** + * @deprecated See set(). + */ + bool parse(const Glib::ustring& spec); + #endif //GDKMM_DEPRECATED + + /** Get the red component of the color. + * @result The red component of the color. + */ + gushort get_red() const; + + /** Get the green component of the color. + * @result The green component of the color. + */ + gushort get_green() const; + + /** Get the blue component of the color. + * @result The blue component of the color. + */ + gushort get_blue() const; + + /** Set the red component of the color. + * @param value The red component of the color. + */ + void set_red(gushort value); + + /** Set the green component of the color. + * @param value The green component of the color. + */ + void set_green(gushort value); + + /** Set the blue component of the color. + * @param value The blue component of the color. + */ + void set_blue(gushort value); + + /** This will fill in the pixel field with the best matching pixel from a color cube. + * The color is then ready to be used for drawing, e.g. you can call Gdk::GC::set_foreground() which expects pixel to be initialized. + * Call this after setting the red, green, and blue fields. + * + * In many cases, you can avoid this whole issue by calling Gdk::GC::set_rgb_fg_color() or Gdk::GC::set_rgb_bg_color(), + * which do not expect pixels to be initialized in advance. If you use those methods, there's no need for this method(). + * + * @param map The colormap for the graphics context and drawable you're using to draw. If you're drawing to a Gtk::Widget, call Gtk::Widget::get_colormap(). + */ + void rgb_find_color(const Glib::RefPtr<Gdk::Colormap>& map); + + /** Get the pixel value, for allocated colors. + * @result For allocated colors, the value used to draw this color on the screen. + */ + guint get_pixel() const; + + /** Get the red component of the color, as a percentage. + * @result The red component of the color, as a percentage. + */ + double get_red_p() const; + + /** Get the green component of the color, as a percentage. + * @result The green component of the color, as a percentage. + */ + double get_green_p() const; + + /** Get the blue component of the color, as a percentage. + * @result The blue component of the color, as a percentage. + */ + double get_blue_p() const; + + +}; + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +/* These traits are for arrays of GdkColor structs -- not pointer arrays. + */ +struct ColorTraits +{ + typedef Gdk::Color CppType; + typedef GdkColor CType; + typedef GdkColor CTypeNonConst; + + static CType to_c_type (const CppType& obj) { return *obj.gobj(); } + static CType to_c_type (const CType& obj) { return obj; } + static CppType to_cpp_type (const CType& obj) { return CppType(const_cast<CType*>(&obj), true); } + static void release_c_type (const CType&) {} +}; +#endif //DOXYGEN_SHOULD_SKIP_THIS + +typedef Glib::ArrayHandle<Color,ColorTraits> ArrayHandle_Color; + +} // namespace Gdk + + +namespace Gdk +{ + +/** @relates Gdk::Color + * @param lhs The left-hand side + * @param rhs The right-hand side + * @result The result + */ +bool operator==(const Color& lhs, const Color& rhs); + +/** @relates Gdk::Color + * @param lhs The left-hand side + * @param rhs The right-hand side + * @result The result + */ +bool operator!=(const Color& lhs, const Color& rhs); + + +} // namespace Gdk + + +namespace Gdk +{ + +/** @relates Gdk::Color + * @param lhs The left-hand side + * @param rhs The right-hand side + */ +inline void swap(Color& lhs, Color& rhs) + { lhs.swap(rhs); } + +} // namespace Gdk + +namespace Glib +{ + +/** @relates Gdk::Color + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ +Gdk::Color wrap(GdkColor* object, bool take_copy = false); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template <> +class Value<Gdk::Color> : public Glib::Value_Boxed<Gdk::Color> +{}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + +#endif /* _GDKMM_COLOR_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/colormap.cc b/libs/gtkmm2/gdk/gdkmm/colormap.cc new file mode 100644 index 0000000000..af2d64aec1 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/colormap.cc @@ -0,0 +1,209 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/colormap.h> +#include <gdkmm/private/colormap_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdk/gdkcolor.h> + +namespace Gdk +{ + +Colormap::Colormap(const Glib::RefPtr<Visual>& visual, bool allocate) +: Glib::Object( G_OBJECT( gdk_colormap_new(visual->gobj(), (gboolean)allocate) ) ) + {} + +} /* namespace Gdk */ + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr<Gdk::Colormap> wrap(GdkColormap* object, bool take_copy) +{ + return Glib::RefPtr<Gdk::Colormap>( dynamic_cast<Gdk::Colormap*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Colormap_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Colormap_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_colormap_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Colormap_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Colormap_Class::wrap_new(GObject* object) +{ + return new Colormap((GdkColormap*)object); +} + + +/* The implementation: */ + +GdkColormap* Colormap::gobj_copy() +{ + reference(); + return gobj(); +} + +Colormap::Colormap(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Colormap::Colormap(GdkColormap* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Colormap::~Colormap() +{} + + +Colormap::CppClassType Colormap::colormap_class_; // initialize static member + +GType Colormap::get_type() +{ + return colormap_class_.init().get_type(); +} + +GType Colormap::get_base_type() +{ + return gdk_colormap_get_type(); +} + + +Glib::RefPtr<Colormap> Colormap::create(const Glib::RefPtr<Visual>& visual, bool allocate) +{ + return Glib::RefPtr<Colormap>( new Colormap(visual, allocate) ); +} +Glib::RefPtr<Colormap> Colormap::get_system() +{ + + Glib::RefPtr<Colormap> retvalue = Glib::wrap(gdk_colormap_get_system()); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +int Colormap::alloc_colors(ArrayHandle_Color& colors, int ncolors, bool writeable, bool best_match, Glib::ArrayHandle<bool>& success) +{ + return gdk_colormap_alloc_colors(gobj(), const_cast<GdkColor*>(colors.data()), ncolors, static_cast<int>(writeable), static_cast<int>(best_match), (gboolean*)(success.data())); +} + +bool Colormap::alloc_color(Color& color, bool writeable, bool best_match) +{ + return gdk_colormap_alloc_color(gobj(), (color).gobj(), static_cast<int>(writeable), static_cast<int>(best_match)); +} + +void Colormap::free_colors(Color& colors, int ncolors) +{ + gdk_colormap_free_colors(gobj(), (colors).gobj(), ncolors); +} + +void Colormap::query_color(gulong pixel, Color& result) +{ + gdk_colormap_query_color(gobj(), pixel, (result).gobj()); +} + +Glib::RefPtr<Visual> Colormap::get_visual() +{ + + Glib::RefPtr<Visual> retvalue = Glib::wrap(gdk_colormap_get_visual(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Visual> Colormap::get_visual() const +{ + + Glib::RefPtr<const Visual> retvalue = Glib::wrap(gdk_colormap_get_visual(const_cast<GdkColormap*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Screen> Colormap::get_screen() +{ + + Glib::RefPtr<Screen> retvalue = Glib::wrap(gdk_colormap_get_screen(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Screen> Colormap::get_screen() const +{ + + Glib::RefPtr<const Screen> retvalue = Glib::wrap(gdk_colormap_get_screen(const_cast<GdkColormap*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/colormap.h b/libs/gtkmm2/gdk/gdkmm/colormap.h new file mode 100644 index 0000000000..5f73acbf59 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/colormap.h @@ -0,0 +1,227 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_COLORMAP_H +#define _GDKMM_COLORMAP_H + +#include <glibmm.h> + +/* $Id$ */ + +/* box.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <glibmm/object.h> +#include <gdkmm/visual.h> +#include <gdkmm/color.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkColormap GdkColormap; +typedef struct _GdkColormapClass GdkColormapClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Colormap_Class; } // namespace Gdk +namespace Gdk +{ + +/** A Colormap is an object that contains the mapping between the color values stored in memory and the RGB values that are + * used to display color values. In general, colormaps only contain significant information for pseudo-color visuals, but + * even for other visual types, a colormap object is required in some circumstances. + * + * There are a couple of special colormaps that can be retrieved. The system colormap (retrieved with get_system()) is the + * default colormap of the system. If you are using GdkRGB, there is another colormap that is important - the colormap in + * which GdkRGB works, retrieved with Gdk::rgb_get_colormap(). However, when using GdkRGB, it is not generally necessary to + * allocate colors directly. + */ + +class Colormap : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Colormap CppObjectType; + typedef Colormap_Class CppClassType; + typedef GdkColormap BaseObjectType; + typedef GdkColormapClass BaseClassType; + +private: friend class Colormap_Class; + static CppClassType colormap_class_; + +private: + // noncopyable + Colormap(const Colormap&); + Colormap& operator=(const Colormap&); + +protected: + explicit Colormap(const Glib::ConstructParams& construct_params); + explicit Colormap(GdkColormap* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Colormap(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkColormap* gobj() { return reinterpret_cast<GdkColormap*>(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkColormap* gobj() const { return reinterpret_cast<GdkColormap*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkColormap* gobj_copy(); + +private: + + +protected: + explicit Colormap(const Glib::RefPtr<Visual>& visual, bool allocate); + +public: + + + static Glib::RefPtr<Colormap> create(const Glib::RefPtr<Visual>& visual, bool allocate); + + + /** Gets the system's default colormap for the default screen. (See + * gdk_colormap_get_system_for_screen()) + * @return The default colormap. + */ + static Glib::RefPtr<Colormap> get_system(); + + //_WRAP_METHOD(void change(int ncolors), gdk_colormap_change) + + // Both 'GdkColor* colors' and 'gboolean* success' are _array_ output arguments. + + + /** Allocates colors from a colormap. + * @param colors The color values to allocate. On return, the pixel + * values for allocated colors will be filled in. + * @param ncolors The number of colors in @a colors . + * @param writeable If <tt>true</tt>, the colors are allocated writeable + * (their values can later be changed using gdk_color_change()). + * Writeable colors cannot be shared between applications. + * @param best_match If <tt>true</tt>, GDK will attempt to do matching against + * existing colors if the colors cannot be allocated as requested. + * @param success An array of length @a ncolors . On return, this + * indicates whether the corresponding color in @a colors was + * successfully allocated or not. + * @return The number of colors that were not successfully + * allocated. + */ + int alloc_colors(ArrayHandle_Color& colors, int ncolors, bool writeable, bool best_match, Glib::ArrayHandle<bool>& success); + + + /** Allocates a single color from a colormap. + * @param color The color to allocate. On return the + * <structfield>pixel</structfield> field will be + * filled in if allocation succeeds. + * @param writeable If <tt>true</tt>, the color is allocated writeable + * (their values can later be changed using gdk_color_change()). + * Writeable colors cannot be shared between applications. + * @param best_match If <tt>true</tt>, GDK will attempt to do matching against + * existing colors if the color cannot be allocated as requested. + * @return <tt>true</tt> if the allocation succeeded. + */ + bool alloc_color(Color& color, bool writeable = false, bool best_match = true); + + /** Frees previously allocated colors. + * @param colors The colors to free. + * @param ncolors The number of colors in @a colors . + */ + void free_colors(Color& colors, int ncolors); + + /** Locates the RGB color in @a colormap corresponding to the given + * hardware pixel @a pixel . @a pixel must be a valid pixel in the + * colormap; it's a programmer error to call this function with a + * pixel which is not in the colormap. Hardware pixels are normally + * obtained from alloc_colors(), or from a Gdk::Image. (A + * Gdk::Image contains image data in hardware format, a Gdk::Pixbuf + * contains image data in a canonical 24-bit RGB format.) + * + * This function is rarely useful; it's used for example to + * implement the eyedropper feature in Gtk::ColorSelection. + * @param pixel Pixel value in hardware display format. + * @param result Gdk::Color with red, green, blue fields initialized. + */ + void query_color (gulong pixel, Color& result); + + + /** Returns the visual for which a given colormap was created. + * @return The visual of the colormap. + */ + Glib::RefPtr<Visual> get_visual(); + + /** Returns the visual for which a given colormap was created. + * @return The visual of the colormap. + */ + Glib::RefPtr<const Visual> get_visual() const; + + + /** Gets the screen for which this colormap was created. + * @return The screen for which this colormap was created. + * + * Since: 2.2. + */ + Glib::RefPtr<Screen> get_screen(); + + /** Gets the screen for which this colormap was created. + * @return The screen for which this colormap was created. + * + * Since: 2.2. + */ + Glib::RefPtr<const Screen> get_screen() const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::Colormap + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Gdk::Colormap> wrap(GdkColormap* object, bool take_copy = false); +} + + +#endif /* _GDKMM_COLORMAP_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/cursor.cc b/libs/gtkmm2/gdk/gdkmm/cursor.cc new file mode 100644 index 0000000000..1a8e639472 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/cursor.cc @@ -0,0 +1,161 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/cursor.h> +#include <gdkmm/private/cursor_p.h> + +#include <gdk/gdkenumtypes.h> +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdk/gdkcursor.h> + +namespace Gdk +{ + +Cursor::Cursor(CursorType cursor_type) +{ + gobject_ = gdk_cursor_new((GdkCursorType)cursor_type); +} + +Cursor::Cursor(const Glib::RefPtr<Pixmap>& source, const Glib::RefPtr<Pixmap>& mask, + const Color& fg, const Color& bg, + int x, int y) +{ + gobject_ = gdk_cursor_new_from_pixmap(source->gobj(), mask->gobj(), + const_cast<GdkColor*>(fg.gobj()), + const_cast<GdkColor*>(bg.gobj()), + x, y); +} + +Cursor::Cursor(const Glib::RefPtr<Display>& display, CursorType cursor_type) +{ + gobject_ = gdk_cursor_new_for_display(display->gobj(), (GdkCursorType)cursor_type); +} + +Cursor::Cursor(const Glib::RefPtr<Display>& display, const Glib::RefPtr<Pixbuf>& pixbuf, int x, int y) +{ + gobject_ = gdk_cursor_new_from_pixbuf(display->gobj(), pixbuf->gobj(), x, y); +} + +} //namespace Gdk + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Gdk::CursorType>::value_type() +{ + return gdk_cursor_type_get_type(); +} + + +namespace Glib +{ + +Gdk::Cursor wrap(GdkCursor* object, bool take_copy) +{ + return Gdk::Cursor(object, take_copy); +} + +} // namespace Glib + + +namespace Gdk +{ + + +// static +GType Cursor::get_type() +{ + return gdk_cursor_get_type(); +} + +Cursor::Cursor() +: + gobject_ (0) // Allows creation of invalid wrapper, e.g. for output arguments to methods. +{} + +Cursor::Cursor(const Cursor& other) +: + gobject_ ((other.gobject_) ? gdk_cursor_ref(other.gobject_) : 0) +{} + +Cursor::Cursor(GdkCursor* gobject, bool make_a_copy) +: + // For BoxedType wrappers, make_a_copy is true by default. The static + // BoxedType wrappers must always take a copy, thus make_a_copy = true + // ensures identical behaviour if the default argument is used. + gobject_ ((make_a_copy && gobject) ? gdk_cursor_ref(gobject) : gobject) +{} + +Cursor& Cursor::operator=(const Cursor& other) +{ + Cursor temp (other); + swap(temp); + return *this; +} + +Cursor::~Cursor() +{ + if(gobject_) + gdk_cursor_unref(gobject_); +} + +void Cursor::swap(Cursor& other) +{ + GdkCursor *const temp = gobject_; + gobject_ = other.gobject_; + other.gobject_ = temp; +} + +GdkCursor* Cursor::gobj_copy() const +{ + return gdk_cursor_ref(gobject_); +} + + +Glib::RefPtr<Display> Cursor::get_display() +{ + + Glib::RefPtr<Display> retvalue = Glib::wrap(gdk_cursor_get_display(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Display> Cursor::get_display() const +{ + + Glib::RefPtr<const Display> retvalue = Glib::wrap(gdk_cursor_get_display(const_cast<GdkCursor*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/cursor.h b/libs/gtkmm2/gdk/gdkmm/cursor.h new file mode 100644 index 0000000000..59ab2f827f --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/cursor.h @@ -0,0 +1,251 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_CURSOR_H +#define _GDKMM_CURSOR_H + +#include <glibmm.h> + +/* $Id$ */ + +/* drawable.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdkmm/color.h> +#include <gdkmm/bitmap.h> +#include <gdkmm/display.h> +#include <gdkmm/pixbuf.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GdkCursor GdkCursor; } +#endif + +namespace Gdk +{ + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum CursorType +{ + X_CURSOR = 0, + ARROW = 2, + BASED_ARROW_DOWN = 4, + BASED_ARROW_UP = 6, + BOAT = 8, + BOGOSITY = 10, + BOTTOM_LEFT_CORNER = 12, + BOTTOM_RIGHT_CORNER = 14, + BOTTOM_SIDE = 16, + BOTTOM_TEE = 18, + BOX_SPIRAL = 20, + CENTER_PTR = 22, + CIRCLE = 24, + CLOCK = 26, + COFFEE_MUG = 28, + CROSS = 30, + CROSS_REVERSE = 32, + CROSSHAIR = 34, + DIAMOND_CROSS = 36, + DOT = 38, + DOTBOX = 40, + DOUBLE_ARROW = 42, + DRAFT_LARGE = 44, + DRAFT_SMALL = 46, + DRAPED_BOX = 48, + EXCHANGE = 50, + FLEUR = 52, + GOBBLER = 54, + GUMBY = 56, + HAND1 = 58, + HAND2 = 60, + HEART = 62, + ICON = 64, + IRON_CROSS = 66, + LEFT_PTR = 68, + LEFT_SIDE = 70, + LEFT_TEE = 72, + LEFTBUTTON = 74, + LL_ANGLE = 76, + LR_ANGLE = 78, + MAN = 80, + MIDDLEBUTTON = 82, + MOUSE = 84, + PENCIL = 86, + PIRATE = 88, + PLUS = 90, + QUESTION_ARROW = 92, + RIGHT_PTR = 94, + RIGHT_SIDE = 96, + RIGHT_TEE = 98, + RIGHTBUTTON = 100, + RTL_LOGO = 102, + SAILBOAT = 104, + SB_DOWN_ARROW = 106, + SB_H_DOUBLE_ARROW = 108, + SB_LEFT_ARROW = 110, + SB_RIGHT_ARROW = 112, + SB_UP_ARROW = 114, + SB_V_DOUBLE_ARROW = 116, + SHUTTLE = 118, + SIZING = 120, + SPIDER = 122, + SPRAYCAN = 124, + STAR = 126, + TARGET = 128, + TCROSS = 130, + TOP_LEFT_ARROW = 132, + TOP_LEFT_CORNER = 134, + TOP_RIGHT_CORNER = 136, + TOP_SIDE = 138, + TOP_TEE = 140, + TREK = 142, + UL_ANGLE = 144, + UMBRELLA = 146, + UR_ANGLE = 148, + WATCH = 150, + XTERM = 152, + LAST_CURSOR = 153, + CURSOR_IS_PIXMAP = -1 +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::CursorType> : public Glib::Value_Enum<Gdk::CursorType> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +/** This represents a cursor. + */ +class Cursor +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Cursor CppObjectType; + typedef GdkCursor BaseObjectType; + + static GType get_type() G_GNUC_CONST; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + Cursor(); + + explicit Cursor(GdkCursor* gobject, bool make_a_copy = true); + + Cursor(const Cursor& other); + Cursor& operator=(const Cursor& other); + + ~Cursor(); + + void swap(Cursor& other); + + ///Provides access to the underlying C instance. + GdkCursor* gobj() { return gobject_; } + + ///Provides access to the underlying C instance. + const GdkCursor* gobj() const { return gobject_; } + + ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. + GdkCursor* gobj_copy() const; + +protected: + GdkCursor* gobject_; + +private: + + +public: + explicit Cursor(CursorType cursor_type); + Cursor(const Glib::RefPtr<Pixmap>& source, const Glib::RefPtr<Pixmap>& mask, + const Color& fg, const Color& bg, + int x, int y); + explicit Cursor(const Glib::RefPtr<Display>& display, CursorType cursor_type); + Cursor(const Glib::RefPtr<Display>& display, const Glib::RefPtr<Pixbuf>& pixbuf, int x, int y); + + + /** Returns the display on which the Gdk::Cursor is defined. + * @return The Gdk::Display associated to @a cursor + * + * Since: 2.2. + */ + Glib::RefPtr<Display> get_display(); + + /** Returns the display on which the Gdk::Cursor is defined. + * @return The Gdk::Display associated to @a cursor + * + * Since: 2.2. + */ + Glib::RefPtr<const Display> get_display() const; + + +}; + +} //namespace Gdk + + +namespace Gdk +{ + +/** @relates Gdk::Cursor + * @param lhs The left-hand side + * @param rhs The right-hand side + */ +inline void swap(Cursor& lhs, Cursor& rhs) + { lhs.swap(rhs); } + +} // namespace Gdk + +namespace Glib +{ + +/** @relates Gdk::Cursor + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ +Gdk::Cursor wrap(GdkCursor* object, bool take_copy = false); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template <> +class Value<Gdk::Cursor> : public Glib::Value_Boxed<Gdk::Cursor> +{}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + +#endif /* _GDKMM_CURSOR_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/device.cc b/libs/gtkmm2/gdk/gdkmm/device.cc new file mode 100644 index 0000000000..78d223a363 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/device.cc @@ -0,0 +1,204 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/device.h> +#include <gdkmm/private/device_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdk/gdkinput.h> + +namespace Gdk +{ + + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Gdk::InputMode>::value_type() +{ + return gdk_input_mode_get_type(); +} + +// static +GType Glib::Value<Gdk::InputSource>::value_type() +{ + return gdk_input_source_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr<Gdk::Device> wrap(GdkDevice* object, bool take_copy) +{ + return Glib::RefPtr<Gdk::Device>( dynamic_cast<Gdk::Device*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Device_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Device_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_device_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Device_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Device_Class::wrap_new(GObject* object) +{ + return new Device((GdkDevice*)object); +} + + +/* The implementation: */ + +GdkDevice* Device::gobj_copy() +{ + reference(); + return gobj(); +} + +Device::Device(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Device::Device(GdkDevice* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Device::~Device() +{} + + +Device::CppClassType Device::device_class_; // initialize static member + +GType Device::get_type() +{ + return device_class_.init().get_type(); +} + +GType Device::get_base_type() +{ + return gdk_device_get_type(); +} + + +Device::Device() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(device_class_.init())) +{ + } + +void Device::set_source(InputSource source) +{ + gdk_device_set_source(gobj(), ((GdkInputSource)(source))); +} + +bool Device::set_mode(InputMode mode) +{ + return gdk_device_set_mode(gobj(), ((GdkInputMode)(mode))); +} + +void Device::set_key(guint index_, guint keyval, ModifierType modifiers) +{ + gdk_device_set_key(gobj(), index_, keyval, ((GdkModifierType)(modifiers))); +} + +void Device::set_axis_use(guint index_, AxisUse use) +{ + gdk_device_set_axis_use(gobj(), index_, ((GdkAxisUse)(use))); +} + +void Device::get_state(const Glib::RefPtr<Window>& window, double& axes, ModifierType& mask) +{ + gdk_device_get_state(gobj(), Glib::unwrap(window), &(axes), ((GdkModifierType*) &(mask))); +} + +bool Device::get_history(const Glib::RefPtr<Window>& window, guint32 start, guint32 stop, GdkTimeCoord**& events, int& n_events) +{ + return gdk_device_get_history(gobj(), Glib::unwrap(window), start, stop, &(events), &n_events); +} + +bool Device::get_axis(double& axes, AxisUse use, double& value) const +{ + return gdk_device_get_axis(const_cast<GdkDevice*>(gobj()), &(axes), ((GdkAxisUse)(use)), &(value)); +} + +Glib::ustring Device::get_name() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gobj()->name); +} + +InputSource Device::get_source() const +{ + return ((InputSource)(gobj()->source)); +} + +InputMode Device::get_mode() const +{ + return ((InputMode)(gobj()->mode)); +} + +bool Device::get_has_cursor() const +{ + return gobj()->has_cursor; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/device.h b/libs/gtkmm2/gdk/gdkmm/device.h new file mode 100644 index 0000000000..c3146c0010 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/device.h @@ -0,0 +1,254 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DEVICE_H +#define _GDKMM_DEVICE_H + +#include <glibmm.h> + +/* $Id$ */ + +/* Copyright (C) 2002-2004 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdkmm/window.h> +#include <gdkmm/event.h> +#include <gdk/gdkinput.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkDevice GdkDevice; +typedef struct _GdkDeviceClass GdkDeviceClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Device_Class; } // namespace Gdk +namespace Gdk +{ + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum InputMode +{ + MODE_DISABLED, + MODE_SCREEN, + MODE_WINDOW +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::InputMode> : public Glib::Value_Enum<Gdk::InputMode> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum InputSource +{ + SOURCE_MOUSE, + SOURCE_PEN, + SOURCE_ERASER, + SOURCE_CURSOR +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::InputSource> : public Glib::Value_Enum<Gdk::InputSource> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +/** A Gdk::Device instance contains a detailed description of an extended input device. + */ + +class Device : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Device CppObjectType; + typedef Device_Class CppClassType; + typedef GdkDevice BaseObjectType; + typedef GdkDeviceClass BaseClassType; + +private: friend class Device_Class; + static CppClassType device_class_; + +private: + // noncopyable + Device(const Device&); + Device& operator=(const Device&); + +protected: + explicit Device(const Glib::ConstructParams& construct_params); + explicit Device(GdkDevice* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Device(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkDevice* gobj() { return reinterpret_cast<GdkDevice*>(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkDevice* gobj() const { return reinterpret_cast<GdkDevice*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkDevice* gobj_copy(); + +private: + + +protected: + Device(); + +public: + + + void set_source(InputSource source); + + bool set_mode(InputMode mode); + + void set_key(guint index_, guint keyval, ModifierType modifiers); + + void set_axis_use(guint index_, AxisUse use); + + void get_state(const Glib::RefPtr<Window>& window, double& axes, ModifierType& mask); + + /** Obtains the motion history for a device; given a starting and + * ending timestamp, return all events in the motion history for + * the device in the given range of time. Some windowing systems + * do not support motion history, in which case, <tt>false</tt> will + * be returned. (This is not distinguishable from the case where + * motion history is supported and no events were found.) + * @param window The window with respect to which which the event coordinates will be reported. + * @param start Starting timestamp for range of events to return. + * @param stop Ending timestamp for the range of events to return. + * @param events Location to store a newly-allocated array of Gdk::TimeCoord, or <tt>0</tt>. + * @param n_events Location to store the length of @a events , or <tt>0</tt>. + * @return <tt>true</tt> if the windowing system supports motion history and + * at least one event was found. + */ + bool get_history(const Glib::RefPtr<Window>& window, guint32 start, guint32 stop, GdkTimeCoord**& events, int& n_events); + + /** Interprets an array of double as axis values for a given device, + * and locates the value in the array for a given axis use. + * @param axes Pointer to an array of axes. + * @param use The use to look for. + * @param value Location to store the found value. + * @return <tt>true</tt> if the given axis use was found, otherwise <tt>false</tt>. + */ + bool get_axis(double& axes, AxisUse use, double& value) const; + + /** Gets the name of this device. + * @result The name of this device. + */ + Glib::ustring get_name() const; + + /** Gets the type of this device. + * @result The type of this device. + */ + InputSource get_source() const; + + /** Gets the mode of this device. + * @result The mode of this device. + */ + InputMode get_mode() const; + + /** Discover whether the pointer follows device motion. + * @result true if the pointer follows device motion. + */ + bool get_has_cursor() const; + + //TODO: Add suitable accessor for the information in these fields. For now, people must use gobj() and access them directly. + //gint num_axes the length of the axes array. + //GdkDeviceAxis *axes an array of GdkDeviceAxis, describing the axes of this device. + // + //gint num_keys the length of the keys array. + //GdkDeviceKey *keys an array of GdkDeviceKey, describing the mapped macro buttons of this device. + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Gdk + + +namespace Glib +{ + /** @relates Gdk::Device + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Gdk::Device> wrap(GdkDevice* object, bool take_copy = false); +} + + +#endif /* _GDKMM_DEVICE_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/display.cc b/libs/gtkmm2/gdk/gdkmm/display.cc new file mode 100644 index 0000000000..ff3f528fff --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/display.cc @@ -0,0 +1,596 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/display.h> +#include <gdkmm/private/display_p.h> + +#include <gdk/gdkenumtypes.h> +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdkmm/window.h> +#include <gdk/gdkdisplay.h> + +namespace Gdk +{ + +bool Display::set_selection_owner(const Glib::RefPtr<Window>& owner, Glib::ustring& selection, guint32 time_, bool send_event) +{ + return gdk_selection_owner_set_for_display(gobj(), owner->gobj(), Gdk::AtomString::to_c_type(selection), time_, (gboolean)send_event); +} + +Glib::RefPtr<Window> Display::get_selection_owner(const Glib::ustring& selection) +{ + return Glib::wrap( (GdkWindowObject*)gdk_selection_owner_get_for_display(gobj(), Gdk::AtomString::to_c_type(selection)) , true); +} + +void Display::selection_send_notify(guint32 requestor, Glib::ustring& selection, Glib::ustring& target, Glib::ustring& property, guint32 time_) +{ + gdk_selection_send_notify_for_display(gobj(), requestor, Gdk::AtomString::to_c_type(selection), Gdk::AtomString::to_c_type(target), Gdk::AtomString::to_c_type(property), time_); +} + +void Display::get_pointer(Glib::RefPtr<Screen>& screen, int& x, int& y, ModifierType& mask) +{ + GdkScreen* cScreen = 0; + GdkModifierType cMask = (GdkModifierType)mask; + gdk_display_get_pointer(gobj(), &cScreen, &x, &y, &cMask); + screen = Glib::wrap(cScreen); + mask = (ModifierType)cMask; +} + +void Display::get_pointer(int& x, int& y, ModifierType& mask) +{ + GdkModifierType cMask = (GdkModifierType)mask; + gdk_display_get_pointer(gobj(), 0, &x, &y, &cMask); + mask = (ModifierType)cMask; +} + + +Glib::RefPtr<Window> Display::get_window_at_pointer() +{ + + Glib::RefPtr<Window> retvalue = Glib::wrap((GdkWindowObject*)(gdk_display_get_window_at_pointer(gobj(), 0, 0))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Window> Display::get_window_at_pointer() const +{ + + Glib::RefPtr<const Window> retvalue = Glib::wrap((GdkWindowObject*)(gdk_display_get_window_at_pointer(const_cast<GdkDisplay*>(gobj()), 0, 0))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +GdkDisplayPointerHooks* Display::unset_pointer_hooks() +{ + return gdk_display_set_pointer_hooks(gobj(), 0 /* See GDK docs */); +} + + void Display::store_clipboard(const Glib::RefPtr<Gdk::Window>& clipboard_window, guint32 time_) + { + gdk_display_store_clipboard(gobj(), clipboard_window->gobj(), time_, 0 /* see the C docs */, 0); + } + + void Display::store_clipboard(const Glib::RefPtr<Gdk::Window>& clipboard_window, guint32 time_, const Glib::StringArrayHandle& targets) + { + //Put it into a real container that we can use: + std::vector<Glib::ustring> targets_copy = targets; + + //Create array of target GdkAtoms from target strings: + if(!targets_copy.empty()) + { + GdkAtom* pAtoms = new GdkAtom[targets_copy.size()]; + + for(guint i = 0; i < targets_copy.size(); ++i) + { + *pAtoms = Gdk::AtomString::to_c_type(targets_copy[i]); + } + + gdk_display_store_clipboard(gobj(), clipboard_window->gobj(), time_, 0 /* see the C docs */, 0); + + delete[] pAtoms; + } + } + +} //Gdk + + +namespace +{ + +void Display_signal_closed_callback(GdkDisplay* self, gboolean p0,void* data) +{ + using namespace Gdk; + typedef sigc::slot< void,bool > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast<SlotType*>(slot))(p0 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Display_signal_closed_info = +{ + "closed", + (GCallback) &Display_signal_closed_callback, + (GCallback) &Display_signal_closed_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr<Gdk::Display> wrap(GdkDisplay* object, bool take_copy) +{ + return Glib::RefPtr<Gdk::Display>( dynamic_cast<Gdk::Display*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Display_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Display_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_display_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Display_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->closed = &closed_callback; +} + + +void Display_Class::closed_callback(GdkDisplay* self, gboolean p0) +{ + CppObjectType *const obj = dynamic_cast<CppObjectType*>( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_closed(p0 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast<BaseClassType*>( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->closed) + (*base->closed)(self, p0); + } +} + + +Glib::ObjectBase* Display_Class::wrap_new(GObject* object) +{ + return new Display((GdkDisplay*)object); +} + + +/* The implementation: */ + +GdkDisplay* Display::gobj_copy() +{ + reference(); + return gobj(); +} + +Display::Display(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Display::Display(GdkDisplay* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Display::~Display() +{} + + +Display::CppClassType Display::display_class_; // initialize static member + +GType Display::get_type() +{ + return display_class_.init().get_type(); +} + +GType Display::get_base_type() +{ + return gdk_display_get_type(); +} + + +Display::Display() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(display_class_.init())) +{ + } + +Glib::RefPtr<Display> Display::open(const Glib::ustring& display_name) +{ + + Glib::RefPtr<Display> retvalue = Glib::wrap(gdk_display_open(display_name.c_str())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::ustring Display::get_name() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gdk_display_get_name(const_cast<GdkDisplay*>(gobj()))); +} + +int Display::get_n_screens() const +{ + return gdk_display_get_n_screens(const_cast<GdkDisplay*>(gobj())); +} + +Glib::RefPtr<Screen> Display::get_screen(int screen_num) +{ + + Glib::RefPtr<Screen> retvalue = Glib::wrap(gdk_display_get_screen(gobj(), screen_num)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Screen> Display::get_screen(int screen_num) const +{ + + Glib::RefPtr<const Screen> retvalue = Glib::wrap(gdk_display_get_screen(const_cast<GdkDisplay*>(gobj()), screen_num)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Screen> Display::get_default_screen() +{ + + Glib::RefPtr<Screen> retvalue = Glib::wrap(gdk_display_get_default_screen(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Screen> Display::get_default_screen() const +{ + + Glib::RefPtr<const Screen> retvalue = Glib::wrap(gdk_display_get_default_screen(const_cast<GdkDisplay*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +void Display::pointer_ungrab(guint32 timestamp) +{ + gdk_display_pointer_ungrab(gobj(), timestamp); +} + +void Display::keyboard_ungrab(guint32 timestamp) +{ + gdk_display_keyboard_ungrab(gobj(), timestamp); +} + +bool Display::pointer_is_grabbed() const +{ + return gdk_display_pointer_is_grabbed(const_cast<GdkDisplay*>(gobj())); +} + +void Display::beep() +{ + gdk_display_beep(gobj()); +} + +void Display::sync() +{ + gdk_display_sync(gobj()); +} + +void Display::close() +{ + gdk_display_close(gobj()); +} + +Glib::ListHandle< Glib::RefPtr<Device> > Display::list_devices() +{ + return Glib::ListHandle< Glib::RefPtr<Device> >(gdk_display_list_devices(gobj()), Glib::OWNERSHIP_DEEP); +} + +Glib::ListHandle< Glib::RefPtr<const Device> > Display::list_devices() const +{ + return Glib::ListHandle< Glib::RefPtr<const Device> >(gdk_display_list_devices(const_cast<GdkDisplay*>(gobj())), Glib::OWNERSHIP_DEEP); +} + +GdkEvent* Display::get_event() +{ + return gdk_display_get_event(gobj()); +} + +const GdkEvent* Display::get_event() const +{ + return (const GdkEvent*)(gdk_display_get_event(const_cast<GdkDisplay*>(gobj()))); +} + +GdkEvent* Display::peek_event() +{ + return gdk_display_peek_event(gobj()); +} + +GdkEvent* Display::peek_event() const +{ + return gdk_display_peek_event(const_cast<GdkDisplay*>(gobj())); +} + +void Display::put_event(GdkEvent* event) +{ + gdk_display_put_event(gobj(), event); +} + +void Display::add_client_message_filter(Glib::ustring& message_type, GdkFilterFunc func, gpointer data) +{ + gdk_display_add_client_message_filter(gobj(), Gdk::AtomString::to_c_type(message_type), func, data); +} + +void Display::set_double_click_time(guint msec) +{ + gdk_display_set_double_click_time(gobj(), msec); +} + +void Display::set_double_click_distance(guint distance) +{ + gdk_display_set_double_click_distance(gobj(), distance); +} + +Glib::RefPtr<Display> Display::get_default() +{ + + Glib::RefPtr<Display> retvalue = Glib::wrap(gdk_display_get_default()); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Device> Display::get_core_pointer() +{ + + Glib::RefPtr<Device> retvalue = Glib::wrap(gdk_display_get_core_pointer(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Device> Display::get_core_pointer() const +{ + + Glib::RefPtr<const Device> retvalue = Glib::wrap(gdk_display_get_core_pointer(const_cast<GdkDisplay*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Window> Display::get_window_at_pointer(int& win_x, int& win_y) +{ + + Glib::RefPtr<Window> retvalue = Glib::wrap((GdkWindowObject*)(gdk_display_get_window_at_pointer(gobj(), &win_x, &win_y))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Window> Display::get_window_at_pointer(int& win_x, int& win_y) const +{ + + Glib::RefPtr<const Window> retvalue = Glib::wrap((GdkWindowObject*)(gdk_display_get_window_at_pointer(const_cast<GdkDisplay*>(gobj()), &win_x, &win_y))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +GdkDisplayPointerHooks* Display::set_pointer_hooks(const GdkDisplayPointerHooks* new_hooks) +{ + return gdk_display_set_pointer_hooks(gobj(), new_hooks); +} + +Glib::RefPtr<Display> Display::open_default_libgtk_only() +{ + + Glib::RefPtr<Display> retvalue = Glib::wrap(gdk_display_open_default_libgtk_only()); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +guint32 Display::get_drag_protocol(guint32 xid, GdkDragProtocol& protocol) +{ + return gdk_drag_get_protocol_for_display(gobj(), xid, &(protocol)); +} + +GdkKeymap* Display::get_keymap() +{ + return gdk_keymap_get_for_display(gobj()); +} + +const GdkKeymap* Display::get_keymap() const +{ + return gdk_keymap_get_for_display(const_cast<GdkDisplay*>(gobj())); +} + +Glib::RefPtr<Pixmap> Display::lookup_pixmap(NativeWindow anid) +{ + return Glib::wrap((GdkPixmapObject*)(gdk_pixmap_lookup_for_display(gobj(), (GdkNativeWindow)(anid)))); +} + +Glib::RefPtr<const Pixmap> Display::lookup_pixmap(NativeWindow anid) const +{ + return Glib::wrap((GdkPixmapObject*)(gdk_pixmap_lookup_for_display(const_cast<GdkDisplay*>(gobj()), (GdkNativeWindow)(anid)))); +} + +void Display::flush() +{ + gdk_display_flush(gobj()); +} + +bool Display::supports_cursor_alpha() const +{ + return gdk_display_supports_cursor_alpha(const_cast<GdkDisplay*>(gobj())); +} + +bool Display::supports_cursor_color() const +{ + return gdk_display_supports_cursor_color(const_cast<GdkDisplay*>(gobj())); +} + +guint Display::get_default_cursor_size() const +{ + return gdk_display_get_default_cursor_size(const_cast<GdkDisplay*>(gobj())); +} + +void Display::get_maximal_cursor_size(guint& width, guint& height) +{ + gdk_display_get_maximal_cursor_size(gobj(), &(width), &(height)); +} + +Glib::RefPtr<Window> Display::get_default_group() +{ + + Glib::RefPtr<Window> retvalue = Glib::wrap((GdkWindowObject*)(gdk_display_get_default_group(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Window> Display::get_default_group() const +{ + + Glib::RefPtr<const Window> retvalue = Glib::wrap((GdkWindowObject*)(gdk_display_get_default_group(const_cast<GdkDisplay*>(gobj())))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +bool Display::supports_selection_notification() const +{ + return gdk_display_supports_selection_notification(const_cast<GdkDisplay*>(gobj())); +} + +bool Display::request_selection_notification(const Glib::ustring& selection) +{ + return gdk_display_request_selection_notification(gobj(), Gdk::AtomString::to_c_type(selection)); +} + +bool Display::supports_clipboard_persistence() const +{ + return gdk_display_supports_clipboard_persistence(const_cast<GdkDisplay*>(gobj())); +} + + +Glib::SignalProxy1< void,bool > Display::signal_closed() +{ + return Glib::SignalProxy1< void,bool >(this, &Display_signal_closed_info); +} + + +void Gdk::Display::on_closed(bool is_error) +{ + BaseClassType *const base = static_cast<BaseClassType*>( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->closed) + (*base->closed)(gobj(),static_cast<int>(is_error)); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/display.h b/libs/gtkmm2/gdk/gdkmm/display.h new file mode 100644 index 0000000000..238025599a --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/display.h @@ -0,0 +1,635 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DISPLAY_H +#define _GDKMM_DISPLAY_H + +#include <glibmm.h> + +/* $Id$ */ + +/* display.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdkmm/screen.h> +#include <gdkmm/device.h> +#include <gdkmm/types.h> //For ModifierType + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkDisplay GdkDisplay; +typedef struct _GdkDisplayClass GdkDisplayClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Display_Class; } // namespace Gdk +namespace Gdk +{ + + +class Drawable; + + /** Gdk::Display object's purpose is two fold: + * To grab/ungrab keyboard focus and mouse pointer + * To manage and provide information about the Gdk::Screen(s) available for this Gdk::Display + * + * Gdk::Display objects are the GDK representation of the X Display which can be described as a workstation consisting + * of a keyboard a pointing device (such as a mouse) and one or more screens. It is used to open and keep track of + * various Gdk::Screen objects currently instantiated by the application. It is also used to grab and release the keyboard + * and the mouse pointer. + */ + +class Display : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Display CppObjectType; + typedef Display_Class CppClassType; + typedef GdkDisplay BaseObjectType; + typedef GdkDisplayClass BaseClassType; + +private: friend class Display_Class; + static CppClassType display_class_; + +private: + // noncopyable + Display(const Display&); + Display& operator=(const Display&); + +protected: + explicit Display(const Glib::ConstructParams& construct_params); + explicit Display(GdkDisplay* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Display(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkDisplay* gobj() { return reinterpret_cast<GdkDisplay*>(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkDisplay* gobj() const { return reinterpret_cast<GdkDisplay*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkDisplay* gobj_copy(); + +private: + +protected: + Display(); + +public: + + /** Opens a display. + * + * Since: 2.2 + * @param display_name The name of the display to open. + * @return A Gdk::Display, or <tt>0</tt> if the display + * could not be opened. + */ + static Glib::RefPtr<Display> open(const Glib::ustring& display_name); + + + /** Gets the name of the display. + * @return A string representing the display name. This string is owned + * by GDK and should not be modified or freed. + * + * Since: 2.2. + */ + Glib::ustring get_name() const; + + + /** Gets the number of screen managed by the @a display . + * @return Number of screens. + * + * Since: 2.2. + */ + int get_n_screens() const; + + /** Returns a screen object for one of the screens of the display. + * @param screen_num The screen number. + * @return The Gdk::Screen object + * + * Since: 2.2. + */ + Glib::RefPtr<Screen> get_screen(int screen_num); + + /** Returns a screen object for one of the screens of the display. + * @param screen_num The screen number. + * @return The Gdk::Screen object + * + * Since: 2.2. + */ + Glib::RefPtr<const Screen> get_screen(int screen_num) const; + + + /** Get the default Gdk::Screen for @a display . + * @return The default Gdk::Screen object for @a display + * + * Since: 2.2. + */ + Glib::RefPtr<Screen> get_default_screen(); + + /** Get the default Gdk::Screen for @a display . + * @return The default Gdk::Screen object for @a display + * + * Since: 2.2. + */ + Glib::RefPtr<const Screen> get_default_screen() const; + + + /** Release any pointer grab. + * + * Since: 2.2 + * @param timestamp A timestap (e.g. GDK_CURRENT_TIME). + */ + void pointer_ungrab(guint32 timestamp); + + /** Release any keyboard grab + * + * Since: 2.2 + * @param timestamp A timestap (e.g Gdk::CURRENT_TIME). + */ + void keyboard_ungrab(guint32 timestamp); + + /** Test if the pointer is grabbed. + * @return <tt>true</tt> if an active X pointer grab is in effect + * + * Since: 2.2. + */ + bool pointer_is_grabbed() const; + + /** Emits a short beep on @a display + * + * Since: 2.2 + */ + void beep(); + + /** Flushes any requests queued for the windowing system and waits until all + * requests have been handled. This is often used for making sure that the + * display is synchronized with the current state of the program. Calling + * sync() before gdk_error_trap_pop() makes sure that any errors + * generated from earlier requests are handled before the error trap is + * removed. + * + * This is most useful for X11. On windowing systems where requests are + * handled synchronously, this function will do nothing. + * + * Since: 2.2 + */ + void sync(); + + /** Closes the connection to the windowing system for the given display, + * and cleans up associated resources. + * + * Since: 2.2 + */ + void close(); + + + /** Returns the list of available input devices attached to @a display . + * The list is statically allocated and should not be freed. + * @return A list of Gdk::Device + * + * Since: 2.2. + */ + Glib::ListHandle< Glib::RefPtr<Device> > list_devices(); + + /** Returns the list of available input devices attached to @a display . + * The list is statically allocated and should not be freed. + * @return A list of Gdk::Device + * + * Since: 2.2. + */ + Glib::ListHandle< Glib::RefPtr<const Device> > list_devices() const; + + //TODO: Use C++ Gdk::Event: + //TODO: get_event() might remove the event - if so, then there should not be a const version: + + /** Gets the next Gdk::Event to be processed for @a display , fetching events from the + * windowing system if necessary. + * @return The next Gdk::Event to be processed, or <tt>0</tt> if no events + * are pending. The returned Gdk::Event should be freed with gdk_event_free(). + * + * Since: 2.2. + */ + GdkEvent* get_event(); + + /** Gets the next Gdk::Event to be processed for @a display , fetching events from the + * windowing system if necessary. + * @return The next Gdk::Event to be processed, or <tt>0</tt> if no events + * are pending. The returned Gdk::Event should be freed with gdk_event_free(). + * + * Since: 2.2. + */ + const GdkEvent* get_event() const; + + + /** Gets a copy of the first Gdk::Event in the @a display 's event queue, without + * removing the event from the queue. (Note that this function will + * not get more events from the windowing system. It only checks the events + * that have already been moved to the GDK event queue.) + * @return A copy of the first Gdk::Event on the event queue, or <tt>0</tt> + * if no events are in the queue. The returned Gdk::Event should be freed with + * gdk_event_free(). + * + * Since: 2.2. + */ + GdkEvent* peek_event(); + + /** Gets a copy of the first Gdk::Event in the @a display 's event queue, without + * removing the event from the queue. (Note that this function will + * not get more events from the windowing system. It only checks the events + * that have already been moved to the GDK event queue.) + * @return A copy of the first Gdk::Event on the event queue, or <tt>0</tt> + * if no events are in the queue. The returned Gdk::Event should be freed with + * gdk_event_free(). + * + * Since: 2.2. + */ + GdkEvent* peek_event() const; + + /** Appends a copy of the given event onto the front of the event + * queue for @a display . + * + * Since: 2.2 + * @param event A Gdk::Event. + */ + void put_event(GdkEvent* event); + + //TODO: Use a slot here, though this is probably never used anyway: + //Find out whether we can use a string representation for the atom - look for examples of this function's use. + + /** Adds a filter to be called when X ClientMessage events are received. + * + * Since: 2.2 + * @param message_type The type of ClientMessage events to receive. + * This will be checked against the @a message_type field + * of the XClientMessage event struct. + * @param func The function to call to process the event. + * @param data User data to pass to @a func . + */ + void add_client_message_filter(Glib::ustring& message_type, GdkFilterFunc func, gpointer data); + + + /** Sets the double click time (two clicks within this time interval + * count as a double click and result in a Gdk::2BUTTON_PRESS event). + * Applications should <em>not</em> set this, it is a global + * user-configured setting. + * + * Since: 2.2 + * @param msec Double click time in milliseconds (thousandths of a second). + */ + void set_double_click_time(guint msec); + + /** Sets the double click distance (two clicks within this distance + * count as a double click and result in a Gdk::2BUTTON_PRESS event). + * See also set_double_click_time(). + * Applications should <em>not</em> set this, it is a global + * user-configured setting. + * + * Since: 2.4 + * @param distance Distance in pixels. + */ + void set_double_click_distance(guint distance); + + + /** Gets the default Gdk::Display. This is a convenience + * function for: + * + * gdk_display_manager_get_default_display (manager_get()) + * + * @return A Gdk::Display, or <tt>0</tt> if there is no default + * display. + * + * Since: 2.2. + */ + static Glib::RefPtr<Display> get_default(); + + + /** Returns the core pointer device for the given display + * @return The core pointer device; this is owned by the + * display and should not be freed. + * + * Since: 2.2. + */ + Glib::RefPtr<Device> get_core_pointer(); + + /** Returns the core pointer device for the given display + * @return The core pointer device; this is owned by the + * display and should not be freed. + * + * Since: 2.2. + */ + Glib::RefPtr<const Device> get_core_pointer() const; + + /** Gets the current location of the pointer and the current modifier + * mask for a given display. + * + * @param screen location to store the screen that the cursor is on. + * @param x location to store root window X coordinate of pointer. + * @param y location to store root window Y coordinate of pointer. + * @param mask location to store current modifier mask. + * + **/ + void get_pointer(Glib::RefPtr<Screen>& screen, int& x, int& y, ModifierType& mask); + + // In fact, any one of these gdk_display_get_pointer() args can be NULL, but we don't need so many overloads. + /** + * Gets the current location of the pointer and the current modifier + * mask for a given display. + * + * @param x location to store root window X coordinate of pointer. + * @param y location to store root window Y coordinate of pointer. + * @param mask location to store current modifier mask. + * + **/ + void get_pointer(int& x, int& y, ModifierType& mask); + + + /** Obtains the window underneath the mouse pointer, returning the location + * of that window in @a win_x , @a win_y for @a screen . Returns <tt>0</tt> if the window + * under the mouse pointer is not known to GDK (for example, belongs to + * another application). + * @param win_x Return location for origin of the window under the pointer. + * @param win_y Return location for origin of the window under the pointer. + * @return The window under the mouse pointer, or <tt>0</tt> + * + * Since: 2.2. + */ + Glib::RefPtr<Window> get_window_at_pointer(int& win_x, int& win_y); + + /** Obtains the window underneath the mouse pointer, returning the location + * of that window in @a win_x , @a win_y for @a screen . Returns <tt>0</tt> if the window + * under the mouse pointer is not known to GDK (for example, belongs to + * another application). + * @param win_x Return location for origin of the window under the pointer. + * @param win_y Return location for origin of the window under the pointer. + * @return The window under the mouse pointer, or <tt>0</tt> + * + * Since: 2.2. + */ + Glib::RefPtr<const Window> get_window_at_pointer(int& win_x, int& win_y) const; + + /** Obtains the window underneath the mouse pointer. Returns a null RefPtr if the window + * under the mouse pointer is not known to GDK (for example, belongs to + * another application). + * @result The window underneath the mouse pointer. + */ + Glib::RefPtr<Window> get_window_at_pointer(); + + /** Obtains the window underneath the mouse pointer. Returns a null RefPtr if the window + * under the mouse pointer is not known to GDK (for example, belongs to + * another application). + * @result The window underneath the mouse pointer. + */ + Glib::RefPtr<const Window> get_window_at_pointer() const; + + + /** This function allows for hooking into the operation + * of getting the current location of the pointer on a particular + * display. This is only useful for such low-level tools as an + * event recorder. Applications should never have any + * reason to use this facility. + * @param new_hooks A table of pointers to functions for getting + * quantities related to the current pointer position. + * @return The previous pointer hook table + * + * Since: 2.2. + */ + GdkDisplayPointerHooks* set_pointer_hooks(const GdkDisplayPointerHooks* new_hooks); + GdkDisplayPointerHooks* unset_pointer_hooks(); + + + /** Opens the default display specified by command line arguments or + * environment variables, sets it as the default display, and returns + * it. gdk_parse_args must have been called first. If the default + * display has previously been set, simply returns that. An internal + * function that should not be used by applications. + * @return The default display, if it could be opened, + * otherwise <tt>0</tt>. + */ + static Glib::RefPtr<Display> open_default_libgtk_only(); + + + /** Finds out the DND protocol supported by a window. + * + * Since: 2.2 + * @param xid The X id of the destination window. + * @param protocol Location where the supported DND protocol is returned. + * @return The X id of the window where the drop should happen. This + * may be @a xid or the X id of a proxy window, or None if @a xid doesn't + * support Drag and Drop. + */ + guint32 get_drag_protocol(guint32 xid, GdkDragProtocol& protocol); + + + /** + * @return The Gdk::Keymap attached to @a display . + * the Gdk::Keymap attached to @a display . + * + * Since: 2.2. + */ + GdkKeymap* get_keymap(); + + /** + * @return The Gdk::Keymap attached to @a display . + * the Gdk::Keymap attached to @a display . + * + * Since: 2.2. + */ + const GdkKeymap* get_keymap() const; + + bool set_selection_owner(const Glib::RefPtr<Window>& owner, Glib::ustring& selection, guint32 time_, bool send_event); + Glib::RefPtr<Window> get_selection_owner(const Glib::ustring& selection); + void selection_send_notify(guint32 requestor, Glib::ustring& selection, Glib::ustring& target, Glib::ustring& property, guint32 time_); + + + /** Looks up the Gdk::Pixmap that wraps the given native pixmap handle. + * + * For example in the X backend, a native pixmap handle is an Xlib + * <type>XID</type>. + * @param anid A native pixmap handle. + * @return The Gdk::Pixmap wrapper for the native pixmap, + * or <tt>0</tt> if there is none. + * + * Since: 2.2. + */ + Glib::RefPtr<Pixmap> lookup_pixmap(NativeWindow anid); + + /** Looks up the Gdk::Pixmap that wraps the given native pixmap handle. + * + * For example in the X backend, a native pixmap handle is an Xlib + * <type>XID</type>. + * @param anid A native pixmap handle. + * @return The Gdk::Pixmap wrapper for the native pixmap, + * or <tt>0</tt> if there is none. + * + * Since: 2.2. + */ + Glib::RefPtr<const Pixmap> lookup_pixmap(NativeWindow anid) const; + + + /** Flushes any requests queued for the windowing system; this happens automatically + * when the main loop blocks waiting for new events, but if your application + * is drawing without returning control to the main loop, you may need + * to call this function explicitely. A common case where this function + * needs to be called is when an application is executing drawing commands + * from a thread other than the thread where the main loop is running. + * + * This is most useful for X11. On windowing systems where requests are + * handled synchronously, this function will do nothing. + * + * Since: 2.4 + */ + void flush(); + + /** Returns <tt>true</tt> if cursors can use an 8bit alpha channel + * on @a display . Otherwise, cursors are restricted to bilevel + * alpha (i.e. a mask). + * @return Whether cursors can have alpha channels. + * + * Since: 2.4. + */ + bool supports_cursor_alpha() const; + + /** Returns <tt>true</tt> if multicolored cursors are supported + * on @a display . Otherwise, cursors have only a forground + * and a background color. + * @return Whether cursors can have multiple colors. + * + * Since: 2.4. + */ + bool supports_cursor_color() const; + + /** Returns the default size to use for cursors on @a display . + * @return The default cursor size. + * + * Since: 2.4. + */ + guint get_default_cursor_size() const; + + /** Gets the maximal size to use for cursors on @a display . + * + * Since: 2.4 + * @param width The return location for the maximal cursor width. + * @param height The return location for the maximal cursor height. + */ + void get_maximal_cursor_size(guint& width, guint& height); + + + /** Returns the default group leader window for all toplevel windows + * on @a display . This window is implicitly created by GDK. + * See gdk_window_set_group(). + * @return The default group leader window for @a display + * + * Since: 2.4. + */ + Glib::RefPtr<Window> get_default_group(); + + /** Returns the default group leader window for all toplevel windows + * on @a display . This window is implicitly created by GDK. + * See gdk_window_set_group(). + * @return The default group leader window for @a display + * + * Since: 2.4. + */ + Glib::RefPtr<const Window> get_default_group() const; + + //TODO: wrap the vfuncs, though they are not very useful because people will not derive from this class? murrayc. + + + /** Returns whether Gdk::EventOwnerChange events will be + * sent when the owner of a selection changes. + * @return Whether Gdk::EventOwnerChange events will + * be sent. + * + * Since: 2.6. + */ + bool supports_selection_notification() const; + + /** Request Gdk::EventOwnerChange events for ownership changes + * of the selection named by the given atom. + * @param selection The Gdk::Atom naming the selection for which + * ownership change notification is requested. + * @return Whether Gdk::EventOwnerChange events will + * be sent. + * + * Since: 2.6. + */ + bool request_selection_notification(const Glib::ustring& selection); + + + /** Returns whether the speicifed display supports clipboard + * persistance; i.e.\ if it's possible to store the clipboard data after an + * application has quit. On X11 this checks if a clipboard daemon is + * running. + * @return <tt>true</tt> if the display supports clipboard persistance. + * + * Since: 2.6. + */ + bool supports_clipboard_persistence() const; + + //TODO: Documentation, based on C docs: + void store_clipboard(const Glib::RefPtr<Gdk::Window>& clipboard_window, guint32 time_); + + void store_clipboard(const Glib::RefPtr<Gdk::Window>& clipboard_window, guint32 time_, const Glib::StringArrayHandle& targets); + + + Glib::SignalProxy1< void,bool > signal_closed(); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_closed(bool is_error); + + +}; + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::Display + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Gdk::Display> wrap(GdkDisplay* object, bool take_copy = false); +} + + +#endif /* _GDKMM_DISPLAY_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/displaymanager.cc b/libs/gtkmm2/gdk/gdkmm/displaymanager.cc new file mode 100644 index 0000000000..5edb22e506 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/displaymanager.cc @@ -0,0 +1,265 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/displaymanager.h> +#include <gdkmm/private/displaymanager_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdk/gdkdisplaymanager.h> +namespace Gdk +{ + + +} //Gdk + + +namespace +{ + +void DisplayManager_signal_display_opened_callback(GdkDisplayManager* self, GdkDisplay* p0,void* data) +{ + using namespace Gdk; + typedef sigc::slot< void,const Glib::RefPtr<Display>& > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo DisplayManager_signal_display_opened_info = +{ + "display-opened", + (GCallback) &DisplayManager_signal_display_opened_callback, + (GCallback) &DisplayManager_signal_display_opened_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr<Gdk::DisplayManager> wrap(GdkDisplayManager* object, bool take_copy) +{ + return Glib::RefPtr<Gdk::DisplayManager>( dynamic_cast<Gdk::DisplayManager*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& DisplayManager_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &DisplayManager_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_display_manager_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void DisplayManager_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->display_opened = &display_opened_callback; +} + + +void DisplayManager_Class::display_opened_callback(GdkDisplayManager* self, GdkDisplay* p0) +{ + CppObjectType *const obj = dynamic_cast<CppObjectType*>( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_display_opened(Glib::wrap(p0, true) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast<BaseClassType*>( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->display_opened) + (*base->display_opened)(self, p0); + } +} + + +Glib::ObjectBase* DisplayManager_Class::wrap_new(GObject* object) +{ + return new DisplayManager((GdkDisplayManager*)object); +} + + +/* The implementation: */ + +GdkDisplayManager* DisplayManager::gobj_copy() +{ + reference(); + return gobj(); +} + +DisplayManager::DisplayManager(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +DisplayManager::DisplayManager(GdkDisplayManager* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +DisplayManager::~DisplayManager() +{} + + +DisplayManager::CppClassType DisplayManager::displaymanager_class_; // initialize static member + +GType DisplayManager::get_type() +{ + return displaymanager_class_.init().get_type(); +} + +GType DisplayManager::get_base_type() +{ + return gdk_display_manager_get_type(); +} + + +Glib::RefPtr<DisplayManager> DisplayManager::get() +{ + + Glib::RefPtr<DisplayManager> retvalue = Glib::wrap(gdk_display_manager_get()); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Display> DisplayManager::get_default_display() +{ + + Glib::RefPtr<Display> retvalue = Glib::wrap(gdk_display_manager_get_default_display(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Display> DisplayManager::get_default_display() const +{ + + Glib::RefPtr<const Display> retvalue = Glib::wrap(gdk_display_manager_get_default_display(const_cast<GdkDisplayManager*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +void DisplayManager::set_default_display(const Glib::RefPtr<Display>& display) +{ + gdk_display_manager_set_default_display(gobj(), Glib::unwrap(display)); +} + +Glib::SListHandle< Glib::RefPtr<Display> > DisplayManager::list_displays() +{ + return Glib::SListHandle< Glib::RefPtr<Display> >(gdk_display_manager_list_displays(gobj()), Glib::OWNERSHIP_SHALLOW); +} + + +Glib::SignalProxy1< void,const Glib::RefPtr<Display>& > DisplayManager::signal_display_opened() +{ + return Glib::SignalProxy1< void,const Glib::RefPtr<Display>& >(this, &DisplayManager_signal_display_opened_info); +} + + +Glib::PropertyProxy< Glib::RefPtr<Display> > DisplayManager::property_default_display() +{ + return Glib::PropertyProxy< Glib::RefPtr<Display> >(this, "default-display"); +} + +Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Display> > DisplayManager::property_default_display() const +{ + return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Display> >(this, "default-display"); +} + + +void Gdk::DisplayManager::on_display_opened(const Glib::RefPtr<Display>& display) +{ + BaseClassType *const base = static_cast<BaseClassType*>( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->display_opened) + (*base->display_opened)(gobj(),Glib::unwrap(display)); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/displaymanager.h b/libs/gtkmm2/gdk/gdkmm/displaymanager.h new file mode 100644 index 0000000000..fb223270d6 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/displaymanager.h @@ -0,0 +1,186 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DISPLAYMANAGER_H +#define _GDKMM_DISPLAYMANAGER_H + +#include <glibmm.h> + +/* $Id$ */ + +/* displaymanager.h + * + * Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <glibmm/object.h> +#include <gdkmm/display.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkDisplayManager GdkDisplayManager; +typedef struct _GdkDisplayManagerClass GdkDisplayManagerClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class DisplayManager_Class; } // namespace Gdk +namespace Gdk +{ + +/** The purpose of the GdkDisplayManager singleton object is to offer notification when displays appear or disappear or the + * default display changes. + */ + +class DisplayManager : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef DisplayManager CppObjectType; + typedef DisplayManager_Class CppClassType; + typedef GdkDisplayManager BaseObjectType; + typedef GdkDisplayManagerClass BaseClassType; + +private: friend class DisplayManager_Class; + static CppClassType displaymanager_class_; + +private: + // noncopyable + DisplayManager(const DisplayManager&); + DisplayManager& operator=(const DisplayManager&); + +protected: + explicit DisplayManager(const Glib::ConstructParams& construct_params); + explicit DisplayManager(GdkDisplayManager* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~DisplayManager(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkDisplayManager* gobj() { return reinterpret_cast<GdkDisplayManager*>(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkDisplayManager* gobj() const { return reinterpret_cast<GdkDisplayManager*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkDisplayManager* gobj_copy(); + +private: + +protected: + +public: + + + /** + * @return The singleton Gdk::DisplayManager object. + * the global Gdk::DisplayManager singleton; gdk_parse_pargs(), + * gdk_init(), or gdk_init_check() must have been called first. + * + * Since: 2.2. + */ + static Glib::RefPtr<DisplayManager> get(); + + /** Gets the default Gdk::Display. + * @return A Gdk::Display, or <tt>0</tt> if there is no default + * display. + * + * Since: 2.2. + */ + Glib::RefPtr<Display> get_default_display(); + + /** Gets the default Gdk::Display. + * @return A Gdk::Display, or <tt>0</tt> if there is no default + * display. + * + * Since: 2.2. + */ + Glib::RefPtr<const Display> get_default_display() const; + + + /** Sets @a display as the default display. + * + * Since: 2.2 + * @param display A Gdk::Display. + */ + void set_default_display(const Glib::RefPtr<Display>& display); + + + /** List all currently open displays. + * @return A list of Gdk::Display objects. + * Since: 2.2. + */ + Glib::SListHandle< Glib::RefPtr<Display> > list_displays(); + + /** The default display for GDK. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy< Glib::RefPtr<Display> > property_default_display() ; + +/** The default display for GDK. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Display> > property_default_display() const; + + + Glib::SignalProxy1< void,const Glib::RefPtr<Display>& > signal_display_opened(); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_display_opened(const Glib::RefPtr<Display>& display); + + +}; + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::DisplayManager + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Gdk::DisplayManager> wrap(GdkDisplayManager* object, bool take_copy = false); +} + + +#endif /* _GDKMM_DISPLAYMANAGER_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/dragcontext.cc b/libs/gtkmm2/gdk/gdkmm/dragcontext.cc new file mode 100644 index 0000000000..3a2574fb72 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/dragcontext.cc @@ -0,0 +1,310 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/dragcontext.h> +#include <gdkmm/private/dragcontext_p.h> + +#include <gdk/gdkenumtypes.h> +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdkmm/window.h> +#include <gtk/gtkdnd.h> +#include <gdk/gdkwindow.h> +#include <glibmm/utility.h> //For ScopedPtr<>. + +namespace Gdk +{ + +void DragContext::find_window_for_screen(const Glib::RefPtr<Window>& drag_window, const Glib::RefPtr<Screen>& screen, int x_root, int y_root, Glib::RefPtr<Window>& dest_window, DragProtocol* protocol) const +{ + GdkWindow* cWindow = 0; + gdk_drag_find_window_for_screen(const_cast<GdkDragContext*>(gobj()), drag_window->gobj(), screen->gobj(), x_root, y_root, &cWindow, (GdkDragProtocol*)(protocol)); + dest_window = Glib::wrap((GdkWindowObject*)cWindow); +} + +void DragContext::drag_refuse(guint32 time) +{ + gdk_drag_status(gobj(), ((GdkDragAction)(0)) /* see GDK docs */, time); +} + +Glib::StringArrayHandle DragContext::get_targets() const +{ + std::list<Glib::ustring> listTargets; + + //Get a newly-allocated array of atoms: + GList* list = gobj()->targets; + while(list) + { + GdkAtom atom = (GdkAtom)list->data; + + //Convert the atom to a string: + gchar* const atom_name = gdk_atom_name(atom); + + Glib::ustring target; + if(atom_name) + target = Glib::ScopedPtr<char>(atom_name).get(); //This frees the gchar*. + + listTargets.push_back(target); + + list = list->next; + } + + return listTargets; +} + +} /* namespace Gdk */ + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Gdk::DragAction>::value_type() +{ + return gdk_drag_action_get_type(); +} + +// static +GType Glib::Value<Gdk::DragProtocol>::value_type() +{ + return gdk_drag_protocol_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr<Gdk::DragContext> wrap(GdkDragContext* object, bool take_copy) +{ + return Glib::RefPtr<Gdk::DragContext>( dynamic_cast<Gdk::DragContext*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& DragContext_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &DragContext_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_drag_context_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void DragContext_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* DragContext_Class::wrap_new(GObject* object) +{ + return new DragContext((GdkDragContext*)object); +} + + +/* The implementation: */ + +GdkDragContext* DragContext::gobj_copy() +{ + reference(); + return gobj(); +} + +DragContext::DragContext(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +DragContext::DragContext(GdkDragContext* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +DragContext::~DragContext() +{} + + +DragContext::CppClassType DragContext::dragcontext_class_; // initialize static member + +GType DragContext::get_type() +{ + return dragcontext_class_.init().get_type(); +} + +GType DragContext::get_base_type() +{ + return gdk_drag_context_get_type(); +} + + +DragContext::DragContext() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(dragcontext_class_.init())) +{ + } + +Glib::RefPtr<DragContext> DragContext::create() +{ + return Glib::RefPtr<DragContext>( new DragContext() ); +} +void DragContext::drag_status(DragAction action, guint32 time) +{ + gdk_drag_status(gobj(), ((GdkDragAction)(action)), time); +} + +void DragContext::drop_reply(bool ok, guint32 time) +{ + gdk_drop_reply(gobj(), static_cast<int>(ok), time); +} + +void DragContext::drop_finish(bool success, guint32 time) +{ + gdk_drop_finish(gobj(), static_cast<int>(success), time); +} + +Glib::ustring DragContext::get_selection() const +{ + return Gdk::AtomString::to_cpp_type(gdk_drag_get_selection(const_cast<GdkDragContext*>(gobj()))); +} + +void DragContext::drag_finish(bool success, bool del, guint32 time) +{ + gtk_drag_finish(gobj(), static_cast<int>(success), static_cast<int>(del), time); +} + +void DragContext::set_icon(const Glib::RefPtr<Gdk::Colormap>& colormap, const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask, int hot_x, int hot_y) +{ + gtk_drag_set_icon_pixmap(gobj(), Glib::unwrap(colormap), Glib::unwrap(pixmap), Glib::unwrap(mask), hot_x, hot_y); +} + +void DragContext::set_icon(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf, int hot_x, int hot_y) +{ + gtk_drag_set_icon_pixbuf(gobj(), Glib::unwrap(pixbuf), hot_x, hot_y); +} + +void DragContext::set_icon(const Glib::ustring& stock_id, int hot_x, int hot_y) +{ + gtk_drag_set_icon_stock(gobj(), stock_id.c_str(), hot_x, hot_y); +} + +void DragContext::set_icon() +{ + gtk_drag_set_icon_default(gobj()); +} + +Glib::RefPtr<Window> DragContext::get_source_window() +{ + Glib::RefPtr<Window> ref_ptr(Glib::wrap((GdkWindowObject*)(gobj()->source_window))); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + +Glib::RefPtr<const Window> DragContext::get_source_window() const +{ + Glib::RefPtr<const Window> ref_ptr(Glib::wrap((GdkWindowObject*)(gobj()->source_window))); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + +Glib::RefPtr<Window> DragContext::get_destination_window() +{ + Glib::RefPtr<Window> ref_ptr(Glib::wrap((GdkWindowObject*)(gobj()->dest_window))); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + +Glib::RefPtr<const Window> DragContext::get_destination_window() const +{ + Glib::RefPtr<const Window> ref_ptr(Glib::wrap((GdkWindowObject*)(gobj()->dest_window))); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + +DragProtocol DragContext::get_protocol() const +{ + return ((DragProtocol)(gobj()->protocol)); +} + +bool DragContext::get_is_source() const +{ + return gobj()->is_source; +} + +DragAction DragContext::get_actions() const +{ + return ((DragAction)(gobj()->actions)); +} + +DragAction DragContext::get_suggested_action() const +{ + return ((DragAction)(gobj()->suggested_action)); +} + +DragAction DragContext::get_action() const +{ + return ((DragAction)(gobj()->action)); +} + +guint32 DragContext::get_start_time() const +{ + return gobj()->start_time; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/dragcontext.h b/libs/gtkmm2/gdk/gdkmm/dragcontext.h new file mode 100644 index 0000000000..57507df105 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/dragcontext.h @@ -0,0 +1,369 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DRAGCONTEXT_H +#define _GDKMM_DRAGCONTEXT_H + +#include <glibmm.h> + +/* $Id$ */ + +/* dragcontext.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdkmm/color.h> +#include <gdkmm/pixbuf.h> +#include <gdkmm/bitmap.h> +#include <glibmm/object.h> +#include <gdk/gdkdnd.h> +#include <glibmm/listhandle.h> +#include <gtkmm/stockid.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkDragContext GdkDragContext; +typedef struct _GdkDragContextClass GdkDragContextClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class DragContext_Class; } // namespace Gdk +namespace Gtk +{ + class Widget; +} /* namespace Gtk */ + +//typedef struct _GdkAtom *GdkAtom; + +namespace Gdk +{ + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * <tt>%DragAction operator|(DragAction, DragAction)</tt><br> + * <tt>%DragAction operator&(DragAction, DragAction)</tt><br> + * <tt>%DragAction operator^(DragAction, DragAction)</tt><br> + * <tt>%DragAction operator~(DragAction)</tt><br> + * <tt>%DragAction& operator|=(DragAction&, DragAction)</tt><br> + * <tt>%DragAction& operator&=(DragAction&, DragAction)</tt><br> + * <tt>%DragAction& operator^=(DragAction&, DragAction)</tt><br> + */ +enum DragAction +{ + ACTION_DEFAULT = 1 << 0, + ACTION_COPY = 1 << 1, + ACTION_MOVE = 1 << 2, + ACTION_LINK = 1 << 3, + ACTION_PRIVATE = 1 << 4, + ACTION_ASK = 1 << 5 +}; + +/** @ingroup gdkmmEnums */ +inline DragAction operator|(DragAction lhs, DragAction rhs) + { return static_cast<DragAction>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline DragAction operator&(DragAction lhs, DragAction rhs) + { return static_cast<DragAction>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline DragAction operator^(DragAction lhs, DragAction rhs) + { return static_cast<DragAction>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline DragAction operator~(DragAction flags) + { return static_cast<DragAction>(~static_cast<unsigned>(flags)); } + +/** @ingroup gdkmmEnums */ +inline DragAction& operator|=(DragAction& lhs, DragAction rhs) + { return (lhs = static_cast<DragAction>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline DragAction& operator&=(DragAction& lhs, DragAction rhs) + { return (lhs = static_cast<DragAction>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline DragAction& operator^=(DragAction& lhs, DragAction rhs) + { return (lhs = static_cast<DragAction>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::DragAction> : public Glib::Value_Flags<Gdk::DragAction> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum DragProtocol +{ + DRAG_PROTO_MOTIF, + DRAG_PROTO_XDND, + DRAG_PROTO_NONE, + DRAG_PROTO_WIN32_DROPFILES, + DRAG_PROTO_OLE2, + DRAG_PROTO_LOCAL +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::DragProtocol> : public Glib::Value_Enum<Gdk::DragProtocol> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +/** A Gdk::DragContext holds information about a drag in progress. It is used on both source and destination sides. + */ + +class DragContext : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef DragContext CppObjectType; + typedef DragContext_Class CppClassType; + typedef GdkDragContext BaseObjectType; + typedef GdkDragContextClass BaseClassType; + +private: friend class DragContext_Class; + static CppClassType dragcontext_class_; + +private: + // noncopyable + DragContext(const DragContext&); + DragContext& operator=(const DragContext&); + +protected: + explicit DragContext(const Glib::ConstructParams& construct_params); + explicit DragContext(GdkDragContext* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~DragContext(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkDragContext* gobj() { return reinterpret_cast<GdkDragContext*>(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkDragContext* gobj() const { return reinterpret_cast<GdkDragContext*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkDragContext* gobj_copy(); + +private: + + +protected: + DragContext(); + +public: + + static Glib::RefPtr<DragContext> create(); + + + /** Selects one of the actions offered by the drag source. + * + * This function is called by the drag destination in response to + * gdk_drag_motion() called by the drag source. + * @param action The selected action which will be taken when a drop happens, + * or 0 to indicate that a drop will not be accepted. + * @param time The timestamp for this operation. + */ + void drag_status(DragAction action, guint32 time); + void drag_refuse(guint32 time); + + //gdk_drag_motion is only used in GDK internally. + + + /** Accepts or rejects a drop. + * + * This function is called by the drag destination in response + * to a drop initiated by the drag source. + * @param ok <tt>true</tt> if the drop is accepted. + * @param time The timestamp for this operation. + */ + void drop_reply(bool ok, guint32 time); + + /** Ends the drag operation after a drop. + * + * This function is called by the drag destination. + * @param success <tt>true</tt> if the data was successfully received. + * @param time The timestamp for this operation. + */ + void drop_finish(bool success, guint32 time); + + /** Returns the selection atom for the current source window. + * @return The selection atom. + */ + Glib::ustring get_selection() const; + + + void drag_finish(bool success, bool del, guint32 time); + //Gtk::Widget* get_source_widget() - see Gtk::Widget::drag_get_source_widget() + + // void set_icon(Gtk::Widget* widget, int hot_x, int hot_y) - see Gtk::Widget::set_as_icon(). + + void set_icon(const Glib::RefPtr<Gdk::Colormap>& colormap, const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask, int hot_x, int hot_y); + + void set_icon(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf, int hot_x, int hot_y); + + // The first argument was changed from StockID to ustring to avoid + // cross-dependence between gdkmm and gtkmm. + // See http://bugzilla.gnome.org/show_bug.cgi?id=79124 for details + + void set_icon(const Glib::ustring& stock_id, int hot_x, int hot_y); + + void set_icon(); + + /** Get the the source window of this drag. + * @result the source window of this drag. + */ + Glib::RefPtr<Window> get_source_window(); + Glib::RefPtr<const Window> get_source_window() const; + + /** Get the the source window of this drag. + * @result the source window of this drag. + */ + Glib::RefPtr<Window> get_destination_window(); + Glib::RefPtr<const Window> get_destination_window() const; + + /** Get a list of targets offered by the source. + * @result a list of targets offered by the source. + */ + Glib::StringArrayHandle get_targets() const; + + /** Get the DND protocol which governs this drag. + * @result the DND protocol which governs this drag. + */ + DragProtocol get_protocol() const; + + /** Discover whether the context is used on the source side. + * @result true if the context is used on the source side. + */ + bool get_is_source() const; + + /** Get a bitmask of actions proposed by the source when the suggested_action is Gdk::ACTION_ASK + * @result a bitmask of actions proposed by the source when the suggested_action is Gdk::ACTION_ASK + */ + DragAction get_actions() const; + + /** Get the action suggested by the source. + * @result The action suggested by the source. + */ + DragAction get_suggested_action() const; + + /** Get the action chosen by the destination. + * @result the action chosen byt the destination. + */ + DragAction get_action() const; + + /** Get a timestamp recording the start time of this drag. + * @result a timestamp recording the start time of this drag. + */ + guint32 get_start_time() const; + + + /** Finds the destination window and DND protocol to use at the + * given pointer position. + * + * This function is called by the drag source to obtain the + * @a dest_window and @a protocol parameters for gdk_drag_motion(). + * + * Since: 2.2 + * @param drag_window A window which may be at the pointer position, but + * should be ignored, since it is put up by the drag source as an icon. + * @param screen The screen where the destination window is sought. + * @param x_root The x position of the pointer in root coordinates. + * @param y_root The y position of the pointer in root coordinates. + * @param dest_window Location to store the destination window in. + * @param protocol Location to store the DND protocol in. + */ + + void find_window_for_screen(const Glib::RefPtr<Window>& drag_window, const Glib::RefPtr<Screen>& screen, int x_root, int y_root, Glib::RefPtr<Window>& dest_window, DragProtocol* protocol) const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::DragContext + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Gdk::DragContext> wrap(GdkDragContext* object, bool take_copy = false); +} + + +#endif /* _GDKMM_DRAGCONTEXT_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/drawable.cc b/libs/gtkmm2/gdk/gdkmm/drawable.cc new file mode 100644 index 0000000000..58adc15cec --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/drawable.cc @@ -0,0 +1,369 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/drawable.h> +#include <gdkmm/private/drawable_p.h> + +#include <gdk/gdkenumtypes.h> +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdkmm/gc.h> +#include <gdkmm/display.h> +#include <gdkmm/pixbuf.h> +#include <gdk/gdkdrawable.h> + +namespace Gdk +{ + +void Drawable::draw_points(const Glib::RefPtr<const GC>& gc, const Glib::ArrayHandle<Point>& points) +{ + // Don't assume the reinterpret_cast<> works everywhere. Gdk::Point is *special*. + gdk_draw_points( + gobj(), const_cast<GdkGC*>(Glib::unwrap<Gdk::GC>(gc)), + reinterpret_cast<GdkPoint*>(const_cast<Point*>(points.data())), + points.size()); +} + +void Drawable::draw_lines(const Glib::RefPtr<const GC>& gc, const Glib::ArrayHandle<Point>& points) +{ + // Don't assume the reinterpret_cast<> works everywhere. Gdk::Point is *special*. + gdk_draw_lines( + gobj(), const_cast<GdkGC*>(Glib::unwrap<Gdk::GC>(gc)), + reinterpret_cast<GdkPoint*>(const_cast<Point*>(points.data())), + points.size()); +} + +void Drawable::draw_polygon(const Glib::RefPtr<const GC>& gc, bool filled, + const Glib::ArrayHandle<Point>& points) +{ + // Don't assume the reinterpret_cast<> works everywhere. Gdk::Point is *special*. + gdk_draw_polygon( + gobj(), const_cast<GdkGC*>(Glib::unwrap<Gdk::GC>(gc)), filled, + reinterpret_cast<GdkPoint*>(const_cast<Point*>(points.data())), + points.size()); +} + +void Drawable::copy_to_image(const Glib::RefPtr<Image>& image, int src_x, int src_y, int dest_x, int dest_y, int width, int height) const +{ + gdk_drawable_copy_to_image(const_cast<GdkDrawable*>(gobj()), Glib::unwrap(image), src_x, src_y, dest_x, dest_y, width, height); +} + + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Gdk::RgbDither>::value_type() +{ + return gdk_rgb_dither_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr<Gdk::Drawable> wrap(GdkDrawable* object, bool take_copy) +{ + return Glib::RefPtr<Gdk::Drawable>( dynamic_cast<Gdk::Drawable*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Drawable_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Drawable_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_drawable_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Drawable_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Drawable_Class::wrap_new(GObject* object) +{ + return new Drawable((GdkDrawable*)object); +} + + +/* The implementation: */ + +GdkDrawable* Drawable::gobj_copy() +{ + reference(); + return gobj(); +} + +Drawable::Drawable(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Drawable::Drawable(GdkDrawable* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Drawable::~Drawable() +{} + + +Drawable::CppClassType Drawable::drawable_class_; // initialize static member + +GType Drawable::get_type() +{ + return drawable_class_.init().get_type(); +} + +GType Drawable::get_base_type() +{ + return gdk_drawable_get_type(); +} + + +Drawable::Drawable() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(drawable_class_.init())) +{ + } + +Glib::RefPtr<Drawable> Drawable::create() +{ + return Glib::RefPtr<Drawable>( new Drawable() ); +} +void Drawable::get_size(int& width, int& height) +{ + gdk_drawable_get_size(gobj(), &width, &height); +} + +int Drawable::get_depth() const +{ + return gdk_drawable_get_depth(const_cast<GdkDrawable*>(gobj())); +} + +void Drawable::set_colormap(const Glib::RefPtr<Colormap>& colormap) +{ + gdk_drawable_set_colormap(gobj(), Glib::unwrap(colormap)); +} + +Glib::RefPtr<Colormap> Drawable::get_colormap() +{ + + Glib::RefPtr<Colormap> retvalue = Glib::wrap(gdk_drawable_get_colormap(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Visual> Drawable::get_visual() +{ + + Glib::RefPtr<Visual> retvalue = Glib::wrap(gdk_drawable_get_visual(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +void Drawable::draw_point(const Glib::RefPtr<const GC>& gc, int x, int y) +{ + gdk_draw_point(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), x, y); +} + +void Drawable::draw_line(const Glib::RefPtr<const GC>& gc, int x1, int y1, int x2, int y2) +{ + gdk_draw_line(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), x1, y1, x2, y2); +} + +void Drawable::draw_rectangle(const Glib::RefPtr<const GC>& gc, bool filled, int x, int y, int width, int height) +{ + gdk_draw_rectangle(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), static_cast<int>(filled), x, y, width, height); +} + +void Drawable::draw_arc(const Glib::RefPtr<const GC>& gc, bool filled, int x, int y, int width, int height, int angle1, int angle2) +{ + gdk_draw_arc(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), static_cast<int>(filled), x, y, width, height, angle1, angle2); +} + +void Drawable::draw_drawable(const Glib::RefPtr<const GC>& gc, const Glib::RefPtr<const Drawable>& src, int xsrc, int ysrc, int xdest, int ydest, int width, int height) +{ + gdk_draw_drawable(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), const_cast<GdkDrawable*>(Glib::unwrap<Drawable>(src)), xsrc, ysrc, xdest, ydest, width, height); +} + +void Drawable::draw_image(const Glib::RefPtr<const GC>& gc, const Glib::RefPtr<const Image>& image, int xsrc, int ysrc, int xdest, int ydest, int width, int height) +{ + gdk_draw_image(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), const_cast<GdkImage*>(Glib::unwrap<Image>(image)), xsrc, ysrc, xdest, ydest, width, height); +} + +void Drawable::draw_segments(const Glib::RefPtr<const GC>& gc, GdkSegment* segs, int nsegs) +{ + gdk_draw_segments(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), segs, nsegs); +} + +void Drawable::draw_glyphs(const Glib::RefPtr<const GC>& gc, const Glib::RefPtr<const Pango::Font>& font, int x, int y, const Pango::GlyphString& glyphs) +{ + gdk_draw_glyphs(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), const_cast<PangoFont*>(Glib::unwrap<Pango::Font>(font)), x, y, const_cast<PangoGlyphString*>(glyphs.gobj())); +} + +void Drawable::draw_layout_line(const Glib::RefPtr<const GC>& gc, int x, int y, const Glib::RefPtr<const Pango::LayoutLine>& line) +{ + gdk_draw_layout_line(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), x, y, const_cast<PangoLayoutLine*>(Glib::unwrap<Pango::LayoutLine>(line))); +} + +void Drawable::draw_layout_line(const Glib::RefPtr<const GC>& gc, int x, int y, const Glib::RefPtr<const Pango::LayoutLine>& line, const Color& foreground, const Color& background) +{ + gdk_draw_layout_line_with_colors(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), x, y, const_cast<PangoLayoutLine*>(Glib::unwrap<Pango::LayoutLine>(line)), (foreground).gobj(), (background).gobj()); +} + +void Drawable::draw_layout(const Glib::RefPtr<const GC>& gc, int x, int y, const Glib::RefPtr<const Pango::Layout>& layout) +{ + gdk_draw_layout(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), x, y, const_cast<PangoLayout*>(Glib::unwrap<Pango::Layout>(layout))); +} + +void Drawable::draw_layout(const Glib::RefPtr<const GC>& gc, int x, int y, const Glib::RefPtr<const Pango::Layout>& layout, const Color& foreground, const Color& background) +{ + gdk_draw_layout_with_colors(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), x, y, const_cast<PangoLayout*>(Glib::unwrap<Pango::Layout>(layout)), (foreground).gobj(), (background).gobj()); +} + +void Drawable::draw_pixbuf(const Glib::RefPtr<const GC>& gc, const Glib::RefPtr<Pixbuf>& pixbuf, int src_x, int src_y, int dest_x, int dest_y, int width, int height, RgbDither dither, int x_dither, int y_dither) +{ + gdk_draw_pixbuf(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), Glib::unwrap(pixbuf), src_x, src_y, dest_x, dest_y, width, height, ((GdkRgbDither)(dither)), x_dither, y_dither); +} + +Glib::RefPtr<Image> Drawable::get_image(int x, int y, int width, int height) const +{ + return Glib::wrap(gdk_drawable_get_image(const_cast<GdkDrawable*>(gobj()), x, y, width, height)); +} + +Region Drawable::get_clip_region() const +{ + return Region(gdk_drawable_get_clip_region(const_cast<GdkDrawable*>(gobj()))); +} + +Region Drawable::get_visible_region() const +{ + return Region(gdk_drawable_get_visible_region(const_cast<GdkDrawable*>(gobj()))); +} + +void Drawable::draw_rgb_image(const Glib::RefPtr<const GC>& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride) +{ + gdk_draw_rgb_image(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), x, y, width, height, ((GdkRgbDither)(dith)), const_cast<guchar*>(rgb_buf), rowstride); +} + +void Drawable::draw_rgb_image_dithalign(const Glib::RefPtr<const GC>& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride, int xdith, int ydith) +{ + gdk_draw_rgb_image_dithalign(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), x, y, width, height, ((GdkRgbDither)(dith)), const_cast<guchar*>(rgb_buf), rowstride, xdith, ydith); +} + +void Drawable::draw_rgb_32_image(const Glib::RefPtr<const GC>& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride) +{ + gdk_draw_rgb_32_image(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), x, y, width, height, ((GdkRgbDither)(dith)), const_cast<guchar*>(rgb_buf), rowstride); +} + +void Drawable::draw_rgb_32_image_dithalign(const Glib::RefPtr<const GC>& gc, int x, int y, int width, int height, RgbDither dith, const guchar* buf, int rowstride, int xdith, int ydith) +{ + gdk_draw_rgb_32_image_dithalign(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), x, y, width, height, ((GdkRgbDither)(dith)), const_cast<guchar*>(buf), rowstride, xdith, ydith); +} + +void Drawable::draw_gray_image(const Glib::RefPtr<const GC>& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride) +{ + gdk_draw_gray_image(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), x, y, width, height, ((GdkRgbDither)(dith)), const_cast<guchar*>(rgb_buf), rowstride); +} + +void Drawable::draw_indexed_image(const Glib::RefPtr<const GC>& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride, const RgbCmap& cmap) +{ + gdk_draw_indexed_image(gobj(), const_cast<GdkGC*>(Glib::unwrap<GC>(gc)), x, y, width, height, ((GdkRgbDither)(dith)), const_cast<guchar*>(rgb_buf), rowstride, const_cast<GdkRgbCmap*>(cmap.gobj())); +} + +Glib::RefPtr<Screen> Drawable::get_screen() +{ + + Glib::RefPtr<Screen> retvalue = Glib::wrap(gdk_drawable_get_screen(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Screen> Drawable::get_screen() const +{ + + Glib::RefPtr<const Screen> retvalue = Glib::wrap(gdk_drawable_get_screen(const_cast<GdkDrawable*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Display> Drawable::get_display() +{ + + Glib::RefPtr<Display> retvalue = Glib::wrap(gdk_drawable_get_display(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Display> Drawable::get_display() const +{ + + Glib::RefPtr<const Display> retvalue = Glib::wrap(gdk_drawable_get_display(const_cast<GdkDrawable*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/drawable.h b/libs/gtkmm2/gdk/gdkmm/drawable.h new file mode 100644 index 0000000000..6331e46ff2 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/drawable.h @@ -0,0 +1,601 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DRAWABLE_H +#define _GDKMM_DRAWABLE_H + +#include <glibmm.h> + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdk/gdkdrawable.h> +#include <gdk/gdkrgb.h> +#include <pangomm/font.h> +#include <pangomm/layout.h> +#include <pangomm/layoutline.h> +#include <pangomm/glyphstring.h> +#include <gdkmm/gc.h> +#include <gdkmm/image.h> +#include <gdkmm/color.h> +#include <gdkmm/region.h> +#include <gdkmm/rgbcmap.h> +#include <gdkmm/types.h> +//#include <gdkmm/pixbuf.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkDrawable GdkDrawable; +typedef struct _GdkDrawableClass GdkDrawableClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Drawable_Class; } // namespace Gdk +namespace Gdk +{ + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum RgbDither +{ + RGB_DITHER_NONE, + RGB_DITHER_NORMAL, + RGB_DITHER_MAX +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::RgbDither> : public Glib::Value_Enum<Gdk::RgbDither> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +class GC; +class Pixbuf; + +/** 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. + */ + +class Drawable : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Drawable CppObjectType; + typedef Drawable_Class CppClassType; + typedef GdkDrawable BaseObjectType; + typedef GdkDrawableClass BaseClassType; + +private: friend class Drawable_Class; + static CppClassType drawable_class_; + +private: + // noncopyable + Drawable(const Drawable&); + Drawable& operator=(const Drawable&); + +protected: + explicit Drawable(const Glib::ConstructParams& construct_params); + explicit Drawable(GdkDrawable* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Drawable(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkDrawable* gobj() { return reinterpret_cast<GdkDrawable*>(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkDrawable* gobj() const { return reinterpret_cast<GdkDrawable*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkDrawable* gobj_copy(); + +private: + + +protected: + Drawable(); + +public: + + static Glib::RefPtr<Drawable> create(); + + + /** Fills * @a width and * @a height with the size of @a drawable . + * @a width or @a height can be <tt>0</tt> if you only want the other one. + * + * On the X11 platform, if @a 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. + * @param width Location to store drawable's width, or <tt>0</tt>. + * @param height Location to store drawable's height, or <tt>0</tt>. + */ + void get_size(int& width, int& height); + + /** 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. + * @return Number of bits per pixel. + */ + int get_depth() const; + + + /** Sets the colormap associated with @a 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. + * @param colormap A Gdk::Colormap. + */ + void set_colormap(const Glib::RefPtr<Colormap>& colormap); + + /** Gets the colormap for @a drawable , if one is set; returns + * <tt>0</tt> otherwise. + * @return The colormap, or <tt>0</tt>. + */ + Glib::RefPtr<Colormap> get_colormap(); + + /** Gets the Gdk::Visual describing the pixel format of @a drawable . + * @return A Gdk::Visual. + */ + Glib::RefPtr<Visual> get_visual(); + + + /** Draws a point, using the foreground color and other attributes of + * the Gdk::GC. + * @param gc A Gdk::GC. + * @param x The x coordinate of the point. + * @param y The y coordinate of the point. + */ + void draw_point(const Glib::RefPtr<const GC>& gc, int x, int y); + void draw_points(const Glib::RefPtr<const GC>& gc, const Glib::ArrayHandle<Point>& points); + + + /** Draws a line, using the foreground color and other attributes of + * the Gdk::GC. + * @param gc A Gdk::GC. + * @param x1 The x coordinate of the start point. + * @param y1 The y coordinate of the start point. + * @param x2 The x coordinate of the end point. + * @param y2 The y coordinate of the end point. + */ + void draw_line(const Glib::RefPtr<const GC>& gc, int x1, int y1, int x2, int y2); + void draw_lines(const Glib::RefPtr<const GC>& gc, const Glib::ArrayHandle<Point>& points); + + + /** Draws a rectangular outline or filled rectangle, using the foreground color + * and other attributes of the Gdk::GC. + * + * A rectangle drawn filled is 1 pixel smaller in both dimensions than a + * rectangle outlined. Calling + * <tt>gdk_draw_rectangle (window, gc, <tt>true</tt>, 0, 0, 20, 20)</tt> + * results in a filled rectangle 20 pixels wide and 20 pixels high. Calling + * <tt>gdk_draw_rectangle (window, gc, <tt>false</tt>, 0, 0, 20, 20)</tt> + * results in an outlined rectangle with corners at (0, 0), (0, 20), (20, 20), + * and (20, 0), which makes it 21 pixels wide and 21 pixels high. + * @param gc A Gdk::GC. + * @param filled <tt>true</tt> if the rectangle should be filled. + * @param x The x coordinate of the left edge of the rectangle. + * @param y The y coordinate of the top edge of the rectangle. + * @param width The width of the rectangle. + * @param height The height of the rectangle. + */ + void draw_rectangle(const Glib::RefPtr<const GC>& gc, bool filled, int x, int y, int width, int height); + + /** Draws an arc or a filled 'pie slice'. The arc is defined by the bounding + * rectangle of the entire ellipse, and the start and end angles of the part + * of the ellipse to be drawn. + * @param gc A Gdk::GC. + * @param filled <tt>true</tt> if the arc should be filled, producing a 'pie slice'. + * @param x The x coordinate of the left edge of the bounding rectangle. + * @param y The y coordinate of the top edge of the bounding rectangle. + * @param width The width of the bounding rectangle. + * @param height The height of the bounding rectangle. + * @param angle1 The start angle of the arc, relative to the 3 o'clock position, + * counter-clockwise, in 1/64ths of a degree. + * @param angle2 The end angle of the arc, relative to @a angle1 , in 1/64ths + * of a degree. + */ + void draw_arc(const Glib::RefPtr<const GC>& gc, bool filled, int x, int y, int width, int height, int angle1, int angle2); + void draw_polygon(const Glib::RefPtr<const GC>& gc, bool filled, const Glib::ArrayHandle<Point>& points); + + + /** Copies the @a width x @a height region of @a src at coordinates ( @a xsrc , + * @a ysrc ) to coordinates ( @a xdest , @a ydest ) in @a drawable . + * @a width and/or @a height may be given as -1, in which case the entire + * @a src drawable will be copied. + * + * Most fields in @a gc are not used for this operation, but notably the + * clip mask or clip region will be honored. + * + * The source and destination drawables must have the same visual and + * colormap, or errors will result. (On X11, failure to match + * visual/colormap results in a BadMatch error from the X server.) + * A common cause of this problem is an attempt to draw a bitmap to + * a color drawable. The way to draw a bitmap is to set the + * bitmap as a clip mask on your Gdk::GC, then use gdk_draw_rectangle() + * to draw a rectangle clipped to the bitmap. + * @param gc A Gdk::GC sharing the drawable's visual and colormap. + * @param src The source Gdk::Drawable, which may be the same as @a drawable . + * @param xsrc X position in @a src of rectangle to draw. + * @param ysrc Y position in @a src of rectangle to draw. + * @param xdest X position in @a drawable where the rectangle should be drawn. + * @param ydest Y position in @a drawable where the rectangle should be drawn. + * @param width Width of rectangle to draw, or -1 for entire @a src width. + * @param height Height of rectangle to draw, or -1 for entire @a src height. + */ + void draw_drawable(const Glib::RefPtr<const GC>& gc, const Glib::RefPtr<const Drawable>& src, int xsrc, int ysrc, int xdest, int ydest, int width = -1, int height = -1); + + /** Draws a Gdk::Image onto a drawable. + * The depth of the Gdk::Image must match the depth of the Gdk::Drawable. + * @param gc A Gdk::GC. + * @param image The Gdk::Image to draw. + * @param xsrc The left edge of the source rectangle within @a image . + * @param ysrc The top of the source rectangle within @a image . + * @param xdest The x coordinate of the destination within @a drawable . + * @param ydest The y coordinate of the destination within @a drawable . + * @param width The width of the area to be copied, or -1 to make the area + * extend to the right edge of @a image . + * @param height The height of the area to be copied, or -1 to make the area + * extend to the bottom edge of @a image . + */ + void draw_image(const Glib::RefPtr<const GC>& gc, const Glib::RefPtr<const Image>& image, int xsrc, int ysrc, int xdest, int ydest, int width = -1, int height = -1); + + //segs is an array, and this function will be used so little that it doesn't seem worth wrapping it to use a container of C++ types. + + /** Draws a number of unconnected lines. + * @param gc A Gdk::GC. + * @param segs An array of Gdk::Segment structures specifying the start and + * end points of the lines to be drawn. + * @param nsegs The number of line segments to draw, i.e. the size of the + * @a segs array. + */ + void draw_segments(const Glib::RefPtr<const GC>& gc, GdkSegment* segs, int nsegs); // TODO + + //glyphs is not an array. I went down to pango_xft_render in pango and saw that PangoGlyphString here is not an array. -Bryan + + /** This is a low-level function; 99% of text rendering should be done + * using gdk_draw_layout() instead. + * + * A glyph is a single image in a font. This function draws a sequence of + * glyphs. To obtain a sequence of glyphs you have to understand a + * lot about internationalized text handling, which you don't want to + * understand; thus, use gdk_draw_layout() instead of this function, + * gdk_draw_layout() handles the details. + * @param gc A Gdk::GC. + * @param font Font to be used. + * @param x X coordinate of baseline origin. + * @param y Y coordinate of baseline origin. + * @param glyphs The glyph string to draw. + */ + void draw_glyphs(const Glib::RefPtr<const GC>& gc, const Glib::RefPtr<const Pango::Font>& font, int x, int y, const Pango::GlyphString& glyphs); + + + /** Render a Pango::LayoutLine onto an GDK drawable + * + * If the layout's Pango::Context has a transformation matrix set, then + * @a x and @a y specify the position of the left edge of the baseline + * (left is in before-tranform user coordinates) in after-transform + * device coordinates. + * @param gc Base graphics to use. + * @param x The x position of start of string (in pixels). + * @param y The y position of baseline (in pixels). + * @param line A Pango::LayoutLine. + */ + void draw_layout_line(const Glib::RefPtr<const GC>& gc, int x, int y, const Glib::RefPtr<const Pango::LayoutLine>& line); + + /** Render a Pango::LayoutLine onto a Gdk::Drawable, overriding the + * layout's normal colors with @a foreground and/or @a background . + * @a foreground and @a background need not be allocated. + * + * If the layout's Pango::Context has a transformation matrix set, then + * @a x and @a y specify the position of the left edge of the baseline + * (left is in before-tranform user coordinates) in after-transform + * device coordinates. + * @param gc Base graphics to use. + * @param x The x position of start of string (in pixels). + * @param y The y position of baseline (in pixels). + * @param line A Pango::LayoutLine. + * @param foreground Foreground override color, or <tt>0</tt> for none. + * @param background Background override color, or <tt>0</tt> for none. + */ + void draw_layout_line(const Glib::RefPtr<const GC>& gc, int x, int y, const Glib::RefPtr<const Pango::LayoutLine>& line, const Color& foreground, const Color& background); + + + /** Render a Pango::Layout onto a GDK drawable + * + * If the layout's Pango::Context has a transformation matrix set, then + * @a x and @a y specify the position of the top left corner of the + * bounding box (in device space) of the transformed layout. + * + * If you're using GTK+, the usual way to obtain a Pango::Layout + * is gtk_widget_create_pango_layout(). + * @param gc Base graphics context to use. + * @param x The X position of the left of the layout (in pixels). + * @param y The Y position of the top of the layout (in pixels). + * @param layout A Pango::Layout. + */ + void draw_layout(const Glib::RefPtr<const GC>& gc, int x, int y, const Glib::RefPtr<const Pango::Layout>& layout); + + /** Render a Pango::Layout onto a Gdk::Drawable, overriding the + * layout's normal colors with @a foreground and/or @a background . + * @a foreground and @a background need not be allocated. + * + * If the layout's Pango::Context has a transformation matrix set, then + * @a x and @a y specify the position of the top left corner of the + * bounding box (in device space) of the transformed layout. + * + * If you're using GTK+, the ususal way to obtain a Pango::Layout + * is gtk_widget_create_pango_layout(). + * @param gc Base graphics context to use. + * @param x The X position of the left of the layout (in pixels). + * @param y The Y position of the top of the layout (in pixels). + * @param layout A Pango::Layout. + * @param foreground Foreground override color, or <tt>0</tt> for none. + * @param background Background override color, or <tt>0</tt> for none. + */ + void draw_layout(const Glib::RefPtr<const GC>& gc, int x, int y, const Glib::RefPtr<const Pango::Layout>& layout, const Color& foreground, const Color& background); + + + /** Renders a rectangular portion of a pixbuf to a drawable. The destination + * drawable must have a colormap. All windows have a colormap, however, pixmaps + * only have colormap by default if they were created with a non-<tt>0</tt> window + * argument. Otherwise a colormap must be set on them with + * Gdk::Drawable::set_colormap(). + * + * On older X servers, rendering pixbufs with an alpha channel involves round + * trips to the X server, and may be somewhat slow. + * + * The clip mask of @a gc is ignored, but clip rectangles and clip regions work + * fine. + * + * Since: 2.2 + * @param gc A Gdk::GC, used for clipping, or <tt>0</tt>. + * @param pixbuf A Gdk::Pixbuf. + * @param src_x Source X coordinate within pixbuf. + * @param src_y Source Y coordinates within pixbuf. + * @param dest_x Destination X coordinate within drawable. + * @param dest_y Destination Y coordinate within drawable. + * @param width Width of region to render, in pixels, or -1 to use pixbuf width. + * @param height Height of region to render, in pixels, or -1 to use pixbuf height. + * @param dither Dithering mode for Gdk::RGB. + * @param x_dither X offset for dither. + * @param y_dither Y offset for dither. + */ + void draw_pixbuf(const Glib::RefPtr<const GC>& gc, const Glib::RefPtr<Pixbuf>& pixbuf, + int src_x, int src_y, int dest_x, int dest_y, + int width, int height, + RgbDither dither, int x_dither, int y_dither); + + // Note: This has no 'refreturn' because get_image() returns a newly created Image object. + + /** A Gdk::Image stores client-side image data (pixels). In contrast, + * Gdk::Pixmap and Gdk::Window are server-side + * objects. get_image() obtains the pixels from a + * server-side drawable as a client-side Gdk::Image. The format of a + * Gdk::Image depends on the Gdk::Visual of the current display, which + * makes manipulating Gdk::Image extremely difficult; therefore, in + * most cases you should use Gdk::Pixbuf::get_from_drawable() instead of + * this lower-level function. A Gdk::Pixbuf contains image data in a + * canonicalized RGB format, rather than a display-dependent format. + * Of course, there's a convenience vs. speed tradeoff here, so you'll + * want to think about what makes sense for your application. + * + * @a x , @a y , @a width , and @a height define the region of @a drawable to + * obtain as an image. + * + * You would usually copy image data to the client side if you intend + * to examine the values of individual pixels, for example to darken + * an image or add a red tint. It would be prohibitively slow to + * make a round-trip request to the windowing system for each pixel, + * so instead you get all of them at once, modify them, then copy + * them all back at once. + * + * If the X server or other windowing system backend is on the local + * machine, this function may use shared memory to avoid copying + * the image data. + * + * If the source drawable is a Gdk::Window and partially offscreen + * or obscured, then the obscured portions of the returned image + * will contain undefined data. + * @param x X coordinate on @a drawable . + * @param y Y coordinate on @a drawable . + * @param width Width of region to get. + * @param height Height or region to get. + * @return A Gdk::Image containing the contents of @a drawable . + */ + Glib::RefPtr<Image> get_image(int x, int y, int width, int height) const; + + // gdk_drawable_copy_to_image() returns a new GdkImage when the image parameter is NULL, but that seems to be much the + // same as gdk_drawable_get_image(). + void copy_to_image(const Glib::RefPtr<Image>& image, int src_x, int src_y, int dest_x, int dest_y, int width, int height) 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. + * @return A Gdk::Region. This must be freed with gdk_region_destroy() + * when you are done. + */ + Region get_clip_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. + * @return A Gdk::Region. This must be freed with gdk_region_destroy() + * when you are done. + */ + Region get_visible_region() const; + + + // **** RGB stuff **** + + + void draw_rgb_image( + const Glib::RefPtr<const GC>& gc, + int x, int y, int width, int height, + RgbDither dith, const guchar* rgb_buf, int rowstride); + + + void draw_rgb_image_dithalign( + const Glib::RefPtr<const GC>& gc, + int x, int y, int width, int height, + RgbDither dith, const guchar* rgb_buf, int rowstride, + int xdith, int ydith); + + + void draw_rgb_32_image( + const Glib::RefPtr<const GC>& gc, + int x, int y, int width, int height, + RgbDither dith, const guchar* rgb_buf, int rowstride); + + + /** Like gdk_draw_rgb_32_image(), but allows you to specify the dither + * offsets. See gdk_draw_rgb_image_dithalign() for more details. + * @param gc A Gdk::GC. + * @param x X coordinate on @a drawable where image should go. + * @param y Y coordinate on @a drawable where image should go. + * @param width Width of area of image to draw. + * @param height Height of area of image to draw. + * @param dith Dithering mode. + * @param buf RGB image data. + * @param rowstride Rowstride of RGB image data. + * @param xdith X dither offset. + * @param ydith Y dither offset. + */ + void draw_rgb_32_image_dithalign( + const Glib::RefPtr<const GC>& gc, + int x, int y, int width, int height, + RgbDither dith, const guchar* buf, int rowstride, + int xdith, int ydith); + + + void draw_gray_image( + const Glib::RefPtr<const GC>& gc, + int x, int y, int width, int height, + RgbDither dith, const guchar* rgb_buf, int rowstride); + + + void draw_indexed_image( + const Glib::RefPtr<const GC>& gc, + int x, int y, int width, int height, + RgbDither dith, const guchar* rgb_buf, int rowstride, + const RgbCmap& cmap); + + + /** Gets the Gdk::Screen associated with a Gdk::Drawable. + * @return The Gdk::Screen associated with @a drawable + * + * Since: 2.2. + */ + Glib::RefPtr<Screen> get_screen(); + + /** Gets the Gdk::Screen associated with a Gdk::Drawable. + * @return The Gdk::Screen associated with @a drawable + * + * Since: 2.2. + */ + Glib::RefPtr<const Screen> get_screen() const; + + + /** Gets the Gdk::Display associated with a Gdk::Drawable. + * @return The Gdk::Display associated with @a drawable + * + * Since: 2.2. + */ + Glib::RefPtr<Display> get_display(); + + /** Gets the Gdk::Display associated with a Gdk::Drawable. + * @return The Gdk::Display associated with @a drawable + * + * Since: 2.2. + */ + Glib::RefPtr<const Display> get_display() const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Gdk + + +namespace Glib +{ + /** @relates Gdk::Drawable + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Gdk::Drawable> wrap(GdkDrawable* object, bool take_copy = false); +} + + +#endif /* _GDKMM_DRAWABLE_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/event.cc b/libs/gtkmm2/gdk/gdkmm/event.cc new file mode 100644 index 0000000000..e9a71e918c --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/event.cc @@ -0,0 +1,223 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/event.h> +#include <gdkmm/private/event_p.h> + +#include <gdk/gdkenumtypes.h> +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdkmm/display.h> + +namespace Gdk +{ + +bool Event::send_client_message(const Glib::RefPtr<Display>& display, NativeWindow winid) +{ + return gdk_event_send_client_message_for_display(display->gobj(), gobj(), winid); +} + +} //namespace Gdk + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Gdk::EventType>::value_type() +{ + return gdk_event_type_get_type(); +} + +// static +GType Glib::Value<Gdk::ExtensionMode>::value_type() +{ + return gdk_extension_mode_get_type(); +} + +// static +GType Glib::Value<Gdk::AxisUse>::value_type() +{ + return gdk_axis_use_get_type(); +} + + +namespace Glib +{ + +Gdk::Event wrap(GdkEvent* object, bool take_copy) +{ + return Gdk::Event(object, take_copy); +} + +} // namespace Glib + + +namespace Gdk +{ + + +// static +GType Event::get_type() +{ + return gdk_event_get_type(); +} + +Event::Event() +: + gobject_ (0) // Allows creation of invalid wrapper, e.g. for output arguments to methods. +{} + +Event::Event(const Event& other) +: + gobject_ ((other.gobject_) ? gdk_event_copy(other.gobject_) : 0) +{} + +Event::Event(GdkEvent* gobject, bool make_a_copy) +: + // For BoxedType wrappers, make_a_copy is true by default. The static + // BoxedType wrappers must always take a copy, thus make_a_copy = true + // ensures identical behaviour if the default argument is used. + gobject_ ((make_a_copy && gobject) ? gdk_event_copy(gobject) : gobject) +{} + +Event& Event::operator=(const Event& other) +{ + Event temp (other); + swap(temp); + return *this; +} + +Event::~Event() +{ + if(gobject_) + gdk_event_free(gobject_); +} + +void Event::swap(Event& other) +{ + GdkEvent *const temp = gobject_; + gobject_ = other.gobject_; + other.gobject_ = temp; +} + +GdkEvent* Event::gobj_copy() const +{ + return gdk_event_copy(gobject_); +} + + +Event Event::get() +{ + return Event(gdk_event_get()); +} + +Event Event::peek() +{ + return Event(gdk_event_peek()); +} + +Event Event::get_graphics_expose(const Glib::RefPtr<Window>& window) +{ + return Event(gdk_event_get_graphics_expose(Glib::unwrap(window))); +} + +void Event::put() +{ + gdk_event_put(gobj()); +} + +bool Event::events_pending() +{ + return gdk_events_pending(); +} + +guint32 Event::get_time() const +{ + return gdk_event_get_time(const_cast<GdkEvent*>(gobj())); +} + +bool Event::get_state(ModifierType& state) const +{ + return gdk_event_get_state(const_cast<GdkEvent*>(gobj()), ((GdkModifierType*) &(state))); +} + +bool Event::get_coords(double& x_win, double& y_win) const +{ + return gdk_event_get_coords(const_cast<GdkEvent*>(gobj()), &(x_win), &(y_win)); +} + +bool Event::get_root_coords(double& x_root, double& y_root) const +{ + return gdk_event_get_root_coords(const_cast<GdkEvent*>(gobj()), &(x_root), &(y_root)); +} + +bool Event::get_axis(AxisUse axis_use, double& value) const +{ + return gdk_event_get_axis(const_cast<GdkEvent*>(gobj()), ((GdkAxisUse)(axis_use)), &(value)); +} + +void Event::set_show_events(bool show_events) +{ + gdk_set_show_events(static_cast<int>(show_events)); +} + +bool Event::get_show_events() +{ + return gdk_get_show_events(); +} + +void Event::set_screen(const Glib::RefPtr<Screen>& screen) +{ + gdk_event_set_screen(gobj(), Glib::unwrap(screen)); +} + +Glib::RefPtr<Screen> Event::get_screen() +{ + + Glib::RefPtr<Screen> retvalue = Glib::wrap(gdk_event_get_screen(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Screen> Event::get_screen() const +{ + + Glib::RefPtr<const Screen> retvalue = Glib::wrap(gdk_event_get_screen(const_cast<GdkEvent*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +bool Event::send_client_message(NativeWindow winid) +{ + return gdk_event_send_client_message(gobj(), (GdkNativeWindow)(winid)); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/event.h b/libs/gtkmm2/gdk/gdkmm/event.h new file mode 100644 index 0000000000..8d1095d46b --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/event.h @@ -0,0 +1,398 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_EVENT_H +#define _GDKMM_EVENT_H + +#include <glibmm.h> + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include <gdkmm/window.h> +#include <gdkmm/screen.h> + +/* Shadow DELETE macro (from winnt.h). + */ +#if defined(DELETE) && !defined(GTKMM_MACRO_SHADOW_DELETE) +enum { GTKMM_MACRO_DEFINITION_DELETE = DELETE }; +#undef DELETE +enum { DELETE = GTKMM_MACRO_DEFINITION_DELETE }; +#define DELETE DELETE +#define GTKMM_MACRO_SHADOW_DELETE 1 +#endif + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef union _GdkEvent GdkEvent; } +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum EventType +{ + NOTHING = -1, + DELETE, + DESTROY, + EXPOSE, + MOTION_NOTIFY, + BUTTON_PRESS, + DOUBLE_BUTTON_PRESS, + TRIPLE_BUTTON_PRESS, + BUTTON_RELEASE, + KEY_PRESS, + KEY_RELEASE, + ENTER_NOTIFY, + LEAVE_NOTIFY, + FOCUS_CHANGE, + CONFIGURE, + MAP, + UNMAP, + PROPERTY_NOTIFY, + SELECTION_CLEAR, + SELECTION_REQUEST, + SELECTION_NOTIFY, + PROXIMITY_IN, + PROXIMITY_OUT, + DRAG_ENTER, + DRAG_LEAVE, + DRAG_MOTION, + DRAG_STATUS, + DROP_START, + DROP_FINISHED, + CLIENT_EVENT, + VISIBILITY_NOTIFY, + NO_EXPOSE, + SCROLL, + WINDOW_STATE, + SETTING, + OWNER_CHANGE +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::EventType> : public Glib::Value_Enum<Gdk::EventType> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +/** + * @ingroup gdkmmEnums + */ +enum ExtensionMode +{ + EXTENSION_EVENTS_NONE, + EXTENSION_EVENTS_ALL, + EXTENSION_EVENTS_CURSOR +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::ExtensionMode> : public Glib::Value_Enum<Gdk::ExtensionMode> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum AxisUse +{ + AXIS_IGNORE, + AXIS_X, + AXIS_Y, + AXIS_PRESSURE, + AXIS_XTILT, + AXIS_YTILT, + AXIS_WHEEL, + AXIS_LAST +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::AxisUse> : public Glib::Value_Enum<Gdk::AxisUse> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +//TODO: Actually use this class instead of GdkEvent? +class Event +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Event CppObjectType; + typedef GdkEvent BaseObjectType; + + static GType get_type() G_GNUC_CONST; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + Event(); + + explicit Event(GdkEvent* gobject, bool make_a_copy = true); + + Event(const Event& other); + Event& operator=(const Event& other); + + ~Event(); + + void swap(Event& other); + + ///Provides access to the underlying C instance. + GdkEvent* gobj() { return gobject_; } + + ///Provides access to the underlying C instance. + const GdkEvent* gobj() const { return gobject_; } + + ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. + GdkEvent* gobj_copy() const; + +protected: + GdkEvent* gobject_; + +private: + + +public: + + + /** Checks all open displays for a Gdk::Event to process,to be processed + * on, fetching events from the windowing system if necessary. + * See Gdk::Display::get_event(). + * @return The next Gdk::Event to be processed, or <tt>0</tt> if no events + * are pending. The returned Gdk::Event should be freed with gdk_event_free(). + */ + static Event get(); + + /** If there is an event waiting in the event queue of some open + * display, returns a copy of it. See Gdk::Display::peek_event(). + * @return A copy of the first Gdk::Event on some event queue, or <tt>0</tt> if no + * events are in any queues. The returned Gdk::Event should be freed with + * gdk_event_free(). + */ + static Event peek(); + + /** Waits for a GraphicsExpose or NoExpose event from the X server. + * This is used in the Gtk::Text and Gtk::CList widgets in GTK+ to make sure any + * GraphicsExpose events are handled before the widget is scrolled. + * @param window The Gdk::Window to wait for the events for. + * @return A Gdk::EventExpose if a GraphicsExpose was received, or <tt>0</tt> if a + * NoExpose event was received. + */ + static Event get_graphics_expose(const Glib::RefPtr<Window>& window); + + /** Appends a copy of the given event onto the front of the event + * queue for event->any.window's display, or the default event + * queue if event->any.window is <tt>0</tt>. See Gdk::Display::put_event(). + */ + void put(); + + + /** Checks if any events are ready to be processed for any display. + * @return <tt>true</tt> if any events are pending. + */ + static bool events_pending(); + + + /** Returns the time stamp from @a event , if there is one; otherwise + * returns Gdk::CURRENT_TIME. If @a event is <tt>0</tt>, returns Gdk::CURRENT_TIME. + * @return Time stamp field from @a event . + */ + guint32 get_time() const; + + /** If the event contains a "state" field, puts that field in @a state . Otherwise + * stores an empty state (0). Returns <tt>true</tt> if there was a state field + * in the event. @a event may be <tt>0</tt>, in which case it's treated + * as if the event had no state field. + * @param state Return location for state. + * @return <tt>true</tt> if there was a state field in the event. + */ + bool get_state(ModifierType& state) const; + + /** Extract the event window relative x/y coordinates from an event. + * @param x_win Location to put event window x coordinate. + * @param y_win Location to put event window y coordinate. + * @return <tt>true</tt> if the event delivered event window coordinates. + */ + bool get_coords(double& x_win, double& y_win) const; + + /** Extract the root window relative x/y coordinates from an event. + * @param x_root Location to put root window x coordinate. + * @param y_root Location to put root window y coordinate. + * @return <tt>true</tt> if the event delivered root window coordinates. + */ + bool get_root_coords(double& x_root, double& y_root) const; + + /** Extract the axis value for a particular axis use from + * an event structure. + * @param axis_use The axis use to look for. + * @param value Location to store the value found. + * @return <tt>true</tt> if the specified axis was found, otherwise <tt>false</tt>. + */ + bool get_axis(AxisUse axis_use, double& value) const; + //_WRAP_METHOD(void gdk_event_handler_set(GdkEventFunc func, gpointer data, GDestroyNotify notify), gdk_event_handler_set) + + + /** Sets whether a trace of received events is output. + * Note that GTK+ must be compiled with debugging (that is, + * configured using the <option>--enable-debug</option> option) + * to use this option. + * @param show_events <tt>true</tt> to output event debugging information. + */ + static void set_show_events(bool show_events); + + /** Gets whether event debugging output is enabled. + * @return <tt>true</tt> if event debugging output is enabled. + */ + static bool get_show_events(); + + + /** Sets the screen for @a event to @a screen . The event must + * have been allocated by GTK+, for instance, by + * gdk_event_copy(). + * + * Since: 2.2 + * @param screen A Gdk::Screen. + */ + void set_screen(const Glib::RefPtr<Screen>& screen); + + /** Returns the screen for the event. The screen is + * typically the screen for <tt>event->any.window</tt>, but + * for events such as mouse events, it is the screen + * where the the pointer was when the event occurs - + * that is, the screen which has the root window + * to which <tt>event->motion.x_root</tt> and + * <tt>event->motion.y_root</tt> are relative. + * @return The screen for the event + * + * Since: 2.2. + */ + Glib::RefPtr<Screen> get_screen(); + + /** Returns the screen for the event. The screen is + * typically the screen for <tt>event->any.window</tt>, but + * for events such as mouse events, it is the screen + * where the the pointer was when the event occurs - + * that is, the screen which has the root window + * to which <tt>event->motion.x_root</tt> and + * <tt>event->motion.y_root</tt> are relative. + * @return The screen for the event + * + * Since: 2.2. + */ + Glib::RefPtr<const Screen> get_screen() const; + + + /** Sends an X ClientMessage event to a given window (which must be + * on the default Gdk::Display.) + * This could be used for communicating between different applications, + * though the amount of data is limited to 20 bytes. + * @param winid The window to send the X ClientMessage event to. + * @return Non-zero on success. + */ + bool send_client_message(NativeWindow winid); + bool send_client_message(const Glib::RefPtr<Display>& display, NativeWindow winid); + + +}; + +} // namespace Gdk + + +namespace Gdk +{ + +/** @relates Gdk::Event + * @param lhs The left-hand side + * @param rhs The right-hand side + */ +inline void swap(Event& lhs, Event& rhs) + { lhs.swap(rhs); } + +} // namespace Gdk + +namespace Glib +{ + +/** @relates Gdk::Event + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ +Gdk::Event wrap(GdkEvent* object, bool take_copy = false); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template <> +class Value<Gdk::Event> : public Glib::Value_Boxed<Gdk::Event> +{}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + +#endif /* _GDKMM_EVENT_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/gc.cc b/libs/gtkmm2/gdk/gdkmm/gc.cc new file mode 100644 index 0000000000..456cad5f9e --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/gc.cc @@ -0,0 +1,326 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/gc.h> +#include <gdkmm/private/gc_p.h> + +#include <gdk/gdkenumtypes.h> +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdk/gdkgc.h> +#include <gdkmm/color.h> +//#include <gdkmm/font.h> +//#include <gdkmm/pixmap.h> +#include <gdkmm/bitmap.h> +#include <gdkmm/colormap.h> + +namespace Gdk +{ + +GC::GC(const Glib::RefPtr<Drawable>& drawable) +: Object( G_OBJECT( gdk_gc_new(drawable->gobj()) ) ) +{ + //We need a construct function if we really want to use our own GClass. Bug #86867 +} + + +} + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Gdk::LineStyle>::value_type() +{ + return gdk_line_style_get_type(); +} + +// static +GType Glib::Value<Gdk::CapStyle>::value_type() +{ + return gdk_cap_style_get_type(); +} + +// static +GType Glib::Value<Gdk::JoinStyle>::value_type() +{ + return gdk_join_style_get_type(); +} + +// static +GType Glib::Value<Gdk::Fill>::value_type() +{ + return gdk_fill_get_type(); +} + +// static +GType Glib::Value<Gdk::Function>::value_type() +{ + return gdk_function_get_type(); +} + +// static +GType Glib::Value<Gdk::SubwindowMode>::value_type() +{ + return gdk_subwindow_mode_get_type(); +} + +// static +GType Glib::Value<Gdk::GCValuesMask>::value_type() +{ + return gdk_gc_values_mask_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr<Gdk::GC> wrap(GdkGC* object, bool take_copy) +{ + return Glib::RefPtr<Gdk::GC>( dynamic_cast<Gdk::GC*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& GC_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &GC_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_gc_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void GC_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* GC_Class::wrap_new(GObject* object) +{ + return new GC((GdkGC*)object); +} + + +/* The implementation: */ + +GdkGC* GC::gobj_copy() +{ + reference(); + return gobj(); +} + +GC::GC(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +GC::GC(GdkGC* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +GC::~GC() +{} + + +GC::CppClassType GC::gc_class_; // initialize static member + +GType GC::get_type() +{ + return gc_class_.init().get_type(); +} + +GType GC::get_base_type() +{ + return gdk_gc_get_type(); +} + + +GC::GC() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(gc_class_.init())) +{ + } + +Glib::RefPtr<GC> GC::create() +{ + return Glib::RefPtr<GC>( new GC() ); +} +Glib::RefPtr<GC> GC::create(const Glib::RefPtr<Drawable>& drawable) +{ + return Glib::RefPtr<GC>( new GC(drawable) ); +} +void GC::set_foreground(const Color& color) +{ + gdk_gc_set_foreground(gobj(), (color).gobj()); +} + +void GC::set_background(const Color& color) +{ + gdk_gc_set_background(gobj(), (color).gobj()); +} + +void GC::set_function(Function function) +{ + gdk_gc_set_function(gobj(), ((GdkFunction)(function))); +} + +void GC::set_fill(Fill fill) +{ + gdk_gc_set_fill(gobj(), ((GdkFill)(fill))); +} + +void GC::set_tile(const Glib::RefPtr<Pixmap>& tile) +{ + gdk_gc_set_tile(gobj(), Glib::unwrap(tile)); +} + +void GC::set_stipple(const Glib::RefPtr<Pixmap>& stipple) +{ + gdk_gc_set_stipple(gobj(), Glib::unwrap(stipple)); +} + +void GC::set_ts_origin(int x, int y) +{ + gdk_gc_set_ts_origin(gobj(), x, y); +} + +void GC::set_clip_origin(int x, int y) +{ + gdk_gc_set_clip_origin(gobj(), x, y); +} + +void GC::set_clip_mask(const Glib::RefPtr<Bitmap>& mask) +{ + gdk_gc_set_clip_mask(gobj(), Glib::unwrap(mask)); +} + +void GC::set_clip_rectangle(Rectangle& rectangle) +{ + gdk_gc_set_clip_rectangle(gobj(), (rectangle).gobj()); +} + +void GC::set_clip_region(const Region& region) +{ + gdk_gc_set_clip_region(gobj(), const_cast<GdkRegion*>((region).gobj())); +} + +void GC::set_subwindow(SubwindowMode mode) +{ + gdk_gc_set_subwindow(gobj(), ((GdkSubwindowMode)(mode))); +} + +void GC::set_exposures(bool exposures) +{ + gdk_gc_set_exposures(gobj(), static_cast<int>(exposures)); +} + +void GC::set_line_attributes(int line_width, LineStyle line_style, CapStyle cap_style, JoinStyle join_style) +{ + gdk_gc_set_line_attributes(gobj(), line_width, ((GdkLineStyle)(line_style)), ((GdkCapStyle)(cap_style)), ((GdkJoinStyle)(join_style))); +} + +void GC::set_dashes(int dash_offset, gint8* dash_list, int n) +{ + gdk_gc_set_dashes(gobj(), dash_offset, dash_list, n); +} + +void GC::offset(int x_offset, int y_offset) +{ + gdk_gc_offset(gobj(), x_offset, y_offset); +} + +void GC::set_colormap(const Glib::RefPtr<Colormap>& colormap) +{ + gdk_gc_set_colormap(gobj(), Glib::unwrap(colormap)); +} + +Glib::RefPtr<Colormap> GC::get_colormap() +{ + + Glib::RefPtr<Colormap> retvalue = Glib::wrap(gdk_gc_get_colormap(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +void GC::set_rgb_fg_color(const Color& color) +{ + gdk_gc_set_rgb_fg_color(gobj(), (color).gobj()); +} + +void GC::set_rgb_bg_color(const Color& color) +{ + gdk_gc_set_rgb_bg_color(gobj(), (color).gobj()); +} + +Glib::RefPtr<Screen> GC::get_screen() +{ + + Glib::RefPtr<Screen> retvalue = Glib::wrap(gdk_gc_get_screen(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Screen> GC::get_screen() const +{ + + Glib::RefPtr<const Screen> retvalue = Glib::wrap(gdk_gc_get_screen(const_cast<GdkGC*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/gc.h b/libs/gtkmm2/gdk/gdkmm/gc.h new file mode 100644 index 0000000000..854995eee5 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/gc.h @@ -0,0 +1,617 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_GC_H +#define _GDKMM_GC_H + +#include <glibmm.h> + +/* $Id$ */ + +/* gc.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <glibmm/object.h> +#include <gdkmm/drawable.h> +#include <gdkmm/types.h> +#include <gdkmm/rectangle.h> +#include <gdkmm/region.h> +#include <gdkmm/screen.h> +#include <gdk/gdkgc.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkGC GdkGC; +typedef struct _GdkGCClass GdkGCClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class GC_Class; } // namespace Gdk +namespace Gdk +{ + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum LineStyle +{ + LINE_SOLID, + LINE_ON_OFF_DASH, + LINE_DOUBLE_DASH +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::LineStyle> : public Glib::Value_Enum<Gdk::LineStyle> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum CapStyle +{ + CAP_NOT_LAST, + CAP_BUTT, + CAP_ROUND, + CAP_PROJECTING +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::CapStyle> : public Glib::Value_Enum<Gdk::CapStyle> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum JoinStyle +{ + JOIN_MITER, + JOIN_ROUND, + JOIN_BEVEL +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::JoinStyle> : public Glib::Value_Enum<Gdk::JoinStyle> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum Fill +{ + SOLID, + TILED, + STIPPLED, + OPAQUE_STIPPLED +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::Fill> : public Glib::Value_Enum<Gdk::Fill> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum Function +{ + COPY, + INVERT, + XOR, + CLEAR, + AND, + AND_REVERSE, + AND_INVERT, + NOOP, + OR, + EQUIV, + OR_REVERSE, + COPY_INVERT, + OR_INVERT, + NAND, + NOR, + SET +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::Function> : public Glib::Value_Enum<Gdk::Function> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum SubwindowMode +{ + CLIP_BY_CHILDREN, + INCLUDE_INFERIORS +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::SubwindowMode> : public Glib::Value_Enum<Gdk::SubwindowMode> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * <tt>%GCValuesMask operator|(GCValuesMask, GCValuesMask)</tt><br> + * <tt>%GCValuesMask operator&(GCValuesMask, GCValuesMask)</tt><br> + * <tt>%GCValuesMask operator^(GCValuesMask, GCValuesMask)</tt><br> + * <tt>%GCValuesMask operator~(GCValuesMask)</tt><br> + * <tt>%GCValuesMask& operator|=(GCValuesMask&, GCValuesMask)</tt><br> + * <tt>%GCValuesMask& operator&=(GCValuesMask&, GCValuesMask)</tt><br> + * <tt>%GCValuesMask& operator^=(GCValuesMask&, GCValuesMask)</tt><br> + */ +enum GCValuesMask +{ + GC_FOREGROUND = 1 << 0, + GC_BACKGROUND = 1 << 1, + GC_FONT = 1 << 2, + GC_FUNCTION = 1 << 3, + GC_FILL = 1 << 4, + GC_TILE = 1 << 5, + GC_STIPPLE = 1 << 6, + GC_CLIP_MASK = 1 << 7, + GC_SUBWINDOW = 1 << 8, + GC_TS_X_ORIGIN = 1 << 9, + GC_TS_Y_ORIGIN = 1 << 10, + GC_CLIP_X_ORIGIN = 1 << 11, + GC_CLIP_Y_ORIGIN = 1 << 12, + GC_EXPOSURES = 1 << 13, + GC_LINE_WIDTH = 1 << 14, + GC_LINE_STYLE = 1 << 15, + GC_CAP_STYLE = 1 << 16, + GC_JOIN_STYLE = 1 << 17 +}; + +/** @ingroup gdkmmEnums */ +inline GCValuesMask operator|(GCValuesMask lhs, GCValuesMask rhs) + { return static_cast<GCValuesMask>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline GCValuesMask operator&(GCValuesMask lhs, GCValuesMask rhs) + { return static_cast<GCValuesMask>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline GCValuesMask operator^(GCValuesMask lhs, GCValuesMask rhs) + { return static_cast<GCValuesMask>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline GCValuesMask operator~(GCValuesMask flags) + { return static_cast<GCValuesMask>(~static_cast<unsigned>(flags)); } + +/** @ingroup gdkmmEnums */ +inline GCValuesMask& operator|=(GCValuesMask& lhs, GCValuesMask rhs) + { return (lhs = static_cast<GCValuesMask>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline GCValuesMask& operator&=(GCValuesMask& lhs, GCValuesMask rhs) + { return (lhs = static_cast<GCValuesMask>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline GCValuesMask& operator^=(GCValuesMask& lhs, GCValuesMask rhs) + { return (lhs = static_cast<GCValuesMask>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::GCValuesMask> : public Glib::Value_Flags<Gdk::GCValuesMask> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +class Drawable; + +/** All drawing operations in GDK take a graphics context (GC) argument. + * A graphics context encapsulates information about the way things are drawn, such as the foreground color or line width. + * By using graphics contexts, the number of arguments to each drawing call is greatly reduced, and communication overhead + * is minimized, since identical arguments do not need to be passed repeatedly. + */ + +class GC : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef GC CppObjectType; + typedef GC_Class CppClassType; + typedef GdkGC BaseObjectType; + typedef GdkGCClass BaseClassType; + +private: friend class GC_Class; + static CppClassType gc_class_; + +private: + // noncopyable + GC(const GC&); + GC& operator=(const GC&); + +protected: + explicit GC(const Glib::ConstructParams& construct_params); + explicit GC(GdkGC* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~GC(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkGC* gobj() { return reinterpret_cast<GdkGC*>(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkGC* gobj() const { return reinterpret_cast<GdkGC*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkGC* gobj_copy(); + +private: + + +protected: + GC(); + explicit GC(const Glib::RefPtr<Drawable>& drawable); + +public: + + static Glib::RefPtr<GC> create(); + + + static Glib::RefPtr<GC> create(const Glib::RefPtr<Drawable>& drawable); + + + // Custom wrap these?, maybe with a Gdk::GC::Value class. Need to do take care of refcounts of GdkGCValue's fields. + // Actually, I don't see the need for these methods. murrayc. + //_WRAP_METHOD(void get_values(GdkGCValues& values) const, gdk_gc_get_values) + //_WRAP_METHOD(void set_values(const GdkGCValues& values, GCValuesMask values_mask), gdk_gc_set_values) + //__IGNORE(gdk_gc_get_values, gdk_gc_set_values) + + + /** Sets the foreground color for a graphics context. + * Note that this function uses @a color ->pixel, use + * set_rgb_fg_color() to specify the foreground + * color as red, green, blue components. + * @param color The new foreground color. + */ + void set_foreground(const Color& color); + + /** Sets the background color for a graphics context. + * Note that this function uses @a color ->pixel, use + * set_rgb_bg_color() to specify the background + * color as red, green, blue components. + * @param color The new background color. + */ + void set_background(const Color& color); + + /** Determines how the current pixel values and the + * pixel values being drawn are combined to produce + * the final pixel values. + * @param function The Gdk::Function to use. + */ + void set_function(Function function); + + /** Set the fill mode for a graphics context. + * @param fill The new fill mode. + */ + void set_fill(Fill fill); + + /** Set a tile pixmap for a graphics context. + * This will only be used if the fill mode + * is Gdk::TILED. + * @param tile The new tile pixmap. + */ + void set_tile(const Glib::RefPtr<Pixmap>& tile); + + /** Set the stipple bitmap for a graphics context. The + * stipple will only be used if the fill mode is + * Gdk::STIPPLED or Gdk::OPAQUE_STIPPLED. + * @param stipple The new stipple bitmap. + */ + void set_stipple(const Glib::RefPtr<Pixmap>& stipple); + + /** Set the origin when using tiles or stipples with + * the GC. The tile or stipple will be aligned such + * that the upper left corner of the tile or stipple + * will coincide with this point. + * @param x The x-coordinate of the origin. + * @param y The y-coordinate of the origin. + */ + void set_ts_origin(int x, int y); + + /** Sets the origin of the clip mask. The coordinates are + * interpreted relative to the upper-left corner of + * the destination drawable of the current operation. + * @param x The x-coordinate of the origin. + * @param y The y-coordinate of the origin. + */ + void set_clip_origin(int x, int y); + + /** Sets the clip mask for a graphics context from a bitmap. + * The clip mask is interpreted relative to the clip + * origin. (See set_clip_origin()). + * @param mask A bitmap. + */ + void set_clip_mask(const Glib::RefPtr<Bitmap>& mask); + + /** Sets the clip mask for a graphics context from a + * rectangle. The clip mask is interpreted relative to the clip + * origin. (See set_clip_origin()). + * @param rectangle The rectangle to clip to. + */ + void set_clip_rectangle(Rectangle& rectangle); + + /** Sets the clip mask for a graphics context from a region structure. + * The clip mask is interpreted relative to the clip origin. (See + * set_clip_origin()). + * @param region The Gdk::Region. + */ + void set_clip_region(const Region& region); + + /** Sets how drawing with this GC on a window will affect child + * windows of that window. + * @param mode The subwindow mode. + */ + void set_subwindow(SubwindowMode mode); + + /** Sets whether copying non-visible portions of a drawable + * using this graphics context generate exposure events + * for the corresponding regions of the destination + * drawable. (See gdk_draw_drawable()). + * @param exposures If <tt>true</tt>, exposure events will be generated. + */ + void set_exposures(bool exposures); + + /** Sets various attributes of how lines are drawn. See + * the corresponding members of Gdk::GCValues for full + * explanations of the arguments. + * @param line_width The width of lines. + * @param line_style The dash-style for lines. + * @param cap_style The manner in which the ends of lines are drawn. + * @param join_style The in which lines are joined together. + */ + void set_line_attributes(int line_width, LineStyle line_style, CapStyle cap_style, JoinStyle join_style); + + /** Sets the way dashed-lines are drawn. Lines will be + * drawn with alternating on and off segments of the + * lengths specified in @a dash_list . The manner in + * which the on and off segments are drawn is determined + * by the @a line_style value of the GC. (This can + * be changed with set_line_attributes().) + * + * The @a dash_offset defines the phase of the pattern, + * specifying how many pixels into the dash-list the pattern + * should actually begin. + * @param dash_offset The phase of the dash pattern. + * @param dash_list An array of dash lengths. + * @param n The number of elements in @a dash_list . + */ + void set_dashes(int dash_offset, gint8* dash_list, int n); + + /** Offset attributes such as the clip and tile-stipple origins + * of the GC so that drawing at x - x_offset, y - y_offset with + * the offset GC has the same effect as drawing at x, y with the original + * GC. + * @param x_offset Amount by which to offset the GC in the X direction. + * @param y_offset Amount by which to offset the GC in the Y direction. + */ + void offset(int x_offset, int y_offset); + + /** Sets the colormap for the GC to the given colormap. The depth + * of the colormap's visual must match the depth of the drawable + * for which the GC was created. + * @param colormap A Gdk::Colormap. + */ + void set_colormap(const Glib::RefPtr<Colormap>& colormap); + + /** Retrieves the colormap for a given GC, if it exists. + * A GC will have a colormap if the drawable for which it was created + * has a colormap, or if a colormap was set explicitely with + * gdk_gc_set_colormap. + * @return The colormap of @a gc , or <tt>0</tt> if @a gc doesn't have one. + */ + Glib::RefPtr<Colormap> get_colormap(); + + /** Set the foreground color of a GC using an unallocated color. The + * pixel value for the color will be determined using GdkRGB. If the + * colormap for the GC has not previously been initialized for GdkRGB, + * then for pseudo-color colormaps (colormaps with a small modifiable + * number of colors), a colorcube will be allocated in the colormap. + * + * Calling this function for a GC without a colormap is an error. + * @param color An unallocated Gdk::Color. + */ + void set_rgb_fg_color(const Color& color); + + /** Set the background color of a GC using an unallocated color. The + * pixel value for the color will be determined using GdkRGB. If the + * colormap for the GC has not previously been initialized for GdkRGB, + * then for pseudo-color colormaps (colormaps with a small modifiable + * number of colors), a colorcube will be allocated in the colormap. + * + * Calling this function for a GC without a colormap is an error. + * @param color An unallocated Gdk::Color. + */ + void set_rgb_bg_color(const Color& color); + + + /** Gets the Gdk::Screen for which @a gc was created + * @return The Gdk::Screen for @a gc . + * + * Since: 2.2. + */ + Glib::RefPtr<Screen> get_screen(); + + /** Gets the Gdk::Screen for which @a gc was created + * @return The Gdk::Screen for @a gc . + * + * Since: 2.2. + */ + Glib::RefPtr<const Screen> get_screen() const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::GC + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Gdk::GC> wrap(GdkGC* object, bool take_copy = false); +} + + +#endif /* _GDKMM_GC_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/general.cc b/libs/gtkmm2/gdk/gdkmm/general.cc new file mode 100644 index 0000000000..f07cce2b14 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/general.cc @@ -0,0 +1,54 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdkmm/general.h> +#include <gdk/gdk.h> + +namespace Gdk +{ + +int screen_width() +{ + return gdk_screen_width(); +} + +int screen_height() +{ + return gdk_screen_height(); +} + +int screen_width_mm() +{ + return gdk_screen_width_mm(); +} + +int screen_height_mm() +{ + return gdk_screen_height_mm(); +} + + +void flush() +{ + gdk_flush(); +} + +} //namespace Gdk + diff --git a/libs/gtkmm2/gdk/gdkmm/general.h b/libs/gtkmm2/gdk/gdkmm/general.h new file mode 100644 index 0000000000..1d37ab0e3b --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/general.h @@ -0,0 +1,37 @@ +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _GDKMM_GENERAL_H +#define _GDKMM_GENERAL_H + +namespace Gdk +{ + +int screen_width(); +int screen_height(); + +int screen_width_mm(); +int screen_height_mm(); + +void flush(); + +} //namespace Gdk + +#endif //_GDKMM_GENERAL_H + diff --git a/libs/gtkmm2/gdk/gdkmm/image.cc b/libs/gtkmm2/gdk/gdkmm/image.cc new file mode 100644 index 0000000000..787124f36f --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/image.cc @@ -0,0 +1,250 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/image.h> +#include <gdkmm/private/image_p.h> + +#include <gdk/gdkenumtypes.h> +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +namespace Gdk +{ + +Image::Image(ImageType type, const Glib::RefPtr<Visual>& visual, int width, int height) +: + Object( G_OBJECT( gdk_image_new((GdkImageType)type, visual->gobj(), width, height) ) ) +{} + +} /* namespace Gdk */ + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Gdk::ImageType>::value_type() +{ + return gdk_image_type_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr<Gdk::Image> wrap(GdkImage* object, bool take_copy) +{ + return Glib::RefPtr<Gdk::Image>( dynamic_cast<Gdk::Image*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Image_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Image_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_image_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Image_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Image_Class::wrap_new(GObject* object) +{ + return new Image((GdkImage*)object); +} + + +/* The implementation: */ + +GdkImage* Image::gobj_copy() +{ + reference(); + return gobj(); +} + +Image::Image(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Image::Image(GdkImage* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Image::~Image() +{} + + +Image::CppClassType Image::image_class_; // initialize static member + +GType Image::get_type() +{ + return image_class_.init().get_type(); +} + +GType Image::get_base_type() +{ + return gdk_image_get_type(); +} + + +Glib::RefPtr<Image> Image::create(ImageType type, const Glib::RefPtr<Visual>& visual, int width, int height) +{ + return Glib::RefPtr<Image>( new Image(type, visual, width, height) ); +} +void Image::put_pixel(int x, int y, guint32 pixel) +{ + gdk_image_put_pixel(gobj(), x, y, pixel); +} + +guint32 Image::get_pixel(int x, int y) const +{ + return gdk_image_get_pixel(const_cast<GdkImage*>(gobj()), x, y); +} + +void Image::set_colormap(const Glib::RefPtr<Colormap>& colormap) +{ + gdk_image_set_colormap(gobj(), Glib::unwrap(colormap)); +} + +Glib::RefPtr<Colormap> Image::get_colormap() +{ + + Glib::RefPtr<Colormap> retvalue = Glib::wrap(gdk_image_get_colormap(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Colormap> Image::get_colormap() const +{ + + Glib::RefPtr<const Colormap> retvalue = Glib::wrap(gdk_image_get_colormap(const_cast<GdkImage*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +ImageType Image::get_image_type() const +{ + return ((ImageType)(gobj()->type)); +} + +Glib::RefPtr<Visual> Image::get_visual() +{ + Glib::RefPtr<Visual> ref_ptr(Glib::wrap(gobj()->visual)); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + +Glib::RefPtr<const Visual> Image::get_visual() const +{ + Glib::RefPtr<const Visual> ref_ptr(Glib::wrap(gobj()->visual)); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + +ByteOrder Image::get_byte_order() const +{ + return ((ByteOrder)(gobj()->byte_order)); +} + +int Image::get_width() const +{ + return gobj()->width; +} + +int Image::get_height() const +{ + return gobj()->height; +} + +guint16 Image::get_bpp() const +{ + return gobj()->bpp; +} + +guint16 Image::get_bpl() const +{ + return gobj()->bpl; +} + +guint16 Image::get_bits_per_pixel() const +{ + return gobj()->bits_per_pixel; +} + +void* Image::get_mem() +{ + return gobj()->mem; +} + +const void* Image::get_mem() const +{ + return (const void*)(gobj()->mem); +} + +void* Image::get_windowing_data() const +{ + return gobj()->windowing_data; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/image.h b/libs/gtkmm2/gdk/gdkmm/image.h new file mode 100644 index 0000000000..7d5f8f6078 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/image.h @@ -0,0 +1,231 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_IMAGE_H +#define _GDKMM_IMAGE_H + +#include <glibmm.h> + +/* $Id$ */ + +/* bitmap.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <glibmm/object.h> +#include <gdkmm/visual.h> +#include <gdkmm/colormap.h> +#include <gdkmm/types.h> //For ByteOrder. +#include <gdk/gdkimage.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkImage GdkImage; +typedef struct _GdkImageClass GdkImageClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Image_Class; } // namespace Gdk +namespace Gdk +{ + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum ImageType +{ + IMAGE_NORMAL, + IMAGE_SHARED, + IMAGE_FASTEST +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::ImageType> : public Glib::Value_Enum<Gdk::ImageType> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +/** This represents an area for drawing graphics. It has now been superceded to a large extent by the much more flexible + * Gdk::Drawable RGB functions. + * To create an image from part of a Gdk::Window use Gdk::Drawable::get_image(). + * + * The image can be manipulated with get_pixel() and put_pixel(), or alternatively by changing the actual pixel data, though + * manipulating the pixel data requires complicated code to cope with the different formats that may be used. + * To draw a Gdk::Image in a Gdk::Window or Gdk::Pixmap use Gdk::Drawable::draw_image(). + */ + +class Image : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Image CppObjectType; + typedef Image_Class CppClassType; + typedef GdkImage BaseObjectType; + typedef GdkImageClass BaseClassType; + +private: friend class Image_Class; + static CppClassType image_class_; + +private: + // noncopyable + Image(const Image&); + Image& operator=(const Image&); + +protected: + explicit Image(const Glib::ConstructParams& construct_params); + explicit Image(GdkImage* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Image(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkImage* gobj() { return reinterpret_cast<GdkImage*>(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkImage* gobj() const { return reinterpret_cast<GdkImage*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkImage* gobj_copy(); + +private: + + +protected: + + /** Instantiate a new Gdk::Image. + * + * @param type The type of the Gdk::Image. Gdk::IMAGE_FASTEST is probably the best choice, since it will try to create a Gdk::IMAGE_SHARED image first and if that fails it will then use Gdk::IMAGE_NORMAL. + * @param visual The Gdk::Visual to use for the image. + * @param width The width of the image in pixels. + * @param height The height of the image in pixels. + */ + Image(ImageType type, const Glib::RefPtr<Visual>& visual, int width, int height); + + +public: + + static Glib::RefPtr<Image> create(ImageType type, const Glib::RefPtr<Visual>& visual, int width, int height); + + + //We ignore gdk_image_new_bitmap() because the documentation says that it is incredibly broken. + + + void put_pixel(int x, int y, guint32 pixel); + + guint32 get_pixel(int x, int y) const; + + /** Sets the colormap for the image to the given colormap. Normally + * there's no need to use this function, images are created with the + * correct colormap if you get the image from a drawable. If you + * create the image from scratch, use the colormap of the drawable you + * intend to render the image to. + * @param colormap A Gdk::Colormap. + */ + void set_colormap(const Glib::RefPtr<Colormap>& colormap); + + /** Retrieves the colormap for a given image, if it exists. An image + * will have a colormap if the drawable from which it was created has + * a colormap, or if a colormap was set explicitely with + * set_colormap(). + * @return Colormap for the image. + */ + Glib::RefPtr<Colormap> get_colormap(); + + /** Retrieves the colormap for a given image, if it exists. An image + * will have a colormap if the drawable from which it was created has + * a colormap, or if a colormap was set explicitely with + * set_colormap(). + * @return Colormap for the image. + */ + Glib::RefPtr<const Colormap> get_colormap() const; + + ImageType get_image_type() const; + Glib::RefPtr<Visual> get_visual(); + Glib::RefPtr<const Visual> get_visual() const; + ByteOrder get_byte_order() const; + int get_width() const; + int get_height() const; + guint16 get_bpp() const; + guint16 get_bpl() const; + guint16 get_bits_per_pixel() const; + + //This memory block is not read-only, apparently: + void* get_mem(); + const void* get_mem() const; + + //TODO: This should be const really. + void* get_windowing_data() const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::Image + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Gdk::Image> wrap(GdkImage* object, bool take_copy = false); +} + + +#endif /* _GDKMM_IMAGE_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/list.h b/libs/gtkmm2/gdk/gdkmm/list.h new file mode 100644 index 0000000000..2c4da23bb7 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/list.h @@ -0,0 +1,157 @@ +#ifndef _GDKMM_LIST_H_ +#define _GDKMM_LIST_H_ + +namespace Gdk { + +#ifdef GTKMM_CXX_HAVE_PARTIAL_SPECIALIZATION +// Dummy class to make it appear as though the user has the list. +/* +template<class Parent,class Iterator,class Access> + class List + { + public: + typedef List<Parent,Iterator,Access> List; + private: + Parent* parent; + public: + List(Parent& p):parent(p) {} + List():parent(0) {} + List(const List& list):parent(list.parent) {} + + Iterator begin() + { + if (parent) + return Access::begin(parent); + return Iterator(); + } + Iterator end(); + { + if (parent) + return Access::end(parent); + return Iterator(); + } + }; +*/ + +// An iterator that caches the current object to C++ for speed +template<class C_Obj, class Cpp_Obj> + class List_Iterator + { + public: + typedef List_Iterator<C_Obj,Cpp_Obj> self; + + private: + GList *node; + Cpp_Obj cache; + + public: + self& operator=(const self& x) + { + cache.free(); + node=x.node; + } + + bool operator==(const self& x) const + { return node == x.node; } + bool operator!=(const self& x) const + { return node != x.node; } + + List_Iterator(GList *n) : node(n),cache(0) + {} + List_Iterator() :node(0),cache(0) + {} + List_Iterator(const self& x) + : node(x.node),cache(0) + {} + + Cpp_Obj& operator*() const + { + if (node) + {if (cache.gobj()!=node->data) + cache=Cpp_Obj(node->data); + } + else + cache=Cpp_Obj(0); + cache=0; + return ; + } + + Cpp_Obj* operator->() const + { + return &(operator*()); + } + + self& operator++() + { + cache.free(); + if (node && node->next) + node = node->next; + return *this; + } + + self operator++(int) + { + self tmp = *this; + ++*this; + return tmp; + } + + self& operator--() + { + cache.free(); + if (node && node->prev) + node=node->prev; + return *this; + } + + self operator--(int) + { + self tmp = *this; + --*this; + return tmp; + } + + }; + +/* +List_Iterator<GdkWidget*,Widget> iter; +(*iter) should be a Widget + +Example usage: + + class Foo() + { + public: + typedef List_Iterator<GdkWidget*,Widget> Iterator; + typedef List<Foo,Iterator,Child_Access) Child_List; + private: + struct Child_Access + { + static Iterator begin(Foo& foo) + {return foo.get_children_begin();} + static Iterator end(Foo& foo) + {return foo.get_children_end();} + }; + public: +// GList* get_children(); + Iterator get_children_begin() + {return Iterator(gdk_foo_get_children(*this);} + Iterator get_children_end() + { + GList* list=gdk_foo_get_children(*this); + return Iterator(g_list_last(list); + } + Child_List get_children() + { + return Child_List(this); + } + + }; +*/ + +#endif + +} /* namespace Gdk */ + + +#endif // _GDKMM_LIST_H_ diff --git a/libs/gtkmm2/gdk/gdkmm/pixbuf.cc b/libs/gtkmm2/gdk/gdkmm/pixbuf.cc new file mode 100644 index 0000000000..8a486d3cc9 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbuf.cc @@ -0,0 +1,503 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/pixbuf.h> +#include <gdkmm/private/pixbuf_p.h> + +#include <gdk-pixbuf/gdk-pixbuf-enum-types.h> +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdk/gdkcolor.h> +#include <gdk/gdkpixbuf.h> +#include <gdk-pixbuf/gdk-pixbuf.h> + + +namespace +{ + +void pixbuf_destroy_data_callback(guint8* pixels, void* user_data) +{ + Gdk::Pixbuf::SlotDestroyData *const slot = static_cast<Gdk::Pixbuf::SlotDestroyData*>(user_data); + g_return_if_fail(slot != 0); + + try + { + (*slot)(pixels); // invoke callback + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + delete slot; +} + +} // anonymous namespace + + +namespace Gdk +{ + +Pixbuf::Pixbuf(const Glib::RefPtr<Image>& src, + const Glib::RefPtr<Colormap>& cmap, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height) +: + Object((GObject*) gdk_pixbuf_get_from_image( + 0, src->gobj(), cmap->gobj(), src_x, src_y, dest_x, dest_y, width, height)) +{} + +Pixbuf::Pixbuf(const Glib::RefPtr<Drawable>& src, + const Glib::RefPtr<Colormap>& cmap, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height) +: + Object((GObject*) gdk_pixbuf_get_from_drawable( + 0, src->gobj(), cmap->gobj(), src_x, src_y, dest_x, dest_y, width, height)) +{} + +Glib::RefPtr<Pixbuf> Pixbuf::create_from_file(const std::string& filename) +{ + GError* error = 0; + GdkPixbuf *const pixbuf = gdk_pixbuf_new_from_file(filename.c_str(), &error); + + if(error) + Glib::Error::throw_exception(error); + + return Glib::wrap(pixbuf); +} + +Glib::RefPtr<Pixbuf> Pixbuf::create_from_file(const std::string& filename, int width, int size, bool preserve_aspect_ratio) +{ + GError* error = 0; + GdkPixbuf *const pixbuf = gdk_pixbuf_new_from_file_at_scale(filename.c_str(), width, size, preserve_aspect_ratio, &error); + //gdk_pixbuf_new_from_file_at_size() just calls gdk_pixbuf_new_from_file_at_scale(). + + if(error) + Glib::Error::throw_exception(error); + + return Glib::wrap(pixbuf); +} + +Glib::RefPtr<Pixbuf> Pixbuf::create_from_data(const guint8* data, Colorspace colorspace, + bool has_alpha, int bits_per_sample, + int width, int height, int rowstride) +{ + GdkPixbuf *const pixbuf = gdk_pixbuf_new_from_data( + data, (GdkColorspace) colorspace, has_alpha, bits_per_sample, width, height, rowstride, + 0, 0); + + return Glib::wrap(pixbuf); +} + +Glib::RefPtr<Pixbuf> Pixbuf::create_from_data(const guint8* data, Colorspace colorspace, + bool has_alpha, int bits_per_sample, + int width, int height, int rowstride, + const Pixbuf::SlotDestroyData& destroy_slot) +{ + GdkPixbuf *const pixbuf = gdk_pixbuf_new_from_data( + data, (GdkColorspace) colorspace, has_alpha, bits_per_sample, width, height, rowstride, + &pixbuf_destroy_data_callback, new SlotDestroyData(destroy_slot)); + + return Glib::wrap(pixbuf); +} + +Glib::RefPtr<Pixbuf> Pixbuf::create_from_inline(int data_length, const guint8* data, bool copy_pixels) +{ + GError* error = 0; + GdkPixbuf *const pixbuf = gdk_pixbuf_new_from_inline(data_length, data, copy_pixels, &error); + + if(error) + Glib::Error::throw_exception(error); + + return Glib::wrap(pixbuf); +} + +void Pixbuf::render_pixmap_and_mask_for_colormap(const Glib::RefPtr<Colormap>& colormap, + Glib::RefPtr<Pixmap>& pixmap_return, + Glib::RefPtr<Bitmap>& mask_return, + int alpha_threshold) +{ + GdkPixmap* pPixmap = 0; + GdkBitmap* pBitmap = 0; + + gdk_pixbuf_render_pixmap_and_mask_for_colormap( + gobj(), colormap->gobj(), &pPixmap, &pBitmap, alpha_threshold); + + pixmap_return = Glib::wrap((GdkPixmapObject*) pPixmap); + mask_return = Glib::RefPtr<Gdk::Bitmap>::cast_dynamic(Glib::wrap((GdkPixmapObject*) pBitmap)); +} + +void Pixbuf::render_pixmap_and_mask(Glib::RefPtr<Pixmap>& pixmap_return, + Glib::RefPtr<Bitmap>& mask_return, + int alpha_threshold) +{ + GdkPixmap* pPixmap = 0; + GdkBitmap* pBitmap = 0; + + gdk_pixbuf_render_pixmap_and_mask(gobj(), &pPixmap, &pBitmap, alpha_threshold); + + pixmap_return = Glib::wrap((GdkPixmapObject*) pPixmap); + mask_return = Glib::RefPtr<Gdk::Bitmap>::cast_dynamic(Glib::wrap((GdkPixmapObject*) pBitmap)); +} + +void Pixbuf::save(const std::string& filename, const Glib::ustring& type) +{ + GError* error = 0; + gdk_pixbuf_savev(gobj(), filename.c_str(), type.c_str(), 0, 0, &error); + + if(error) + Glib::Error::throw_exception(error); +} + +void Pixbuf::save(const std::string& filename, const Glib::ustring& type, + const Glib::StringArrayHandle& option_keys, + const Glib::StringArrayHandle& option_values) +{ + GError* error = 0; + + gdk_pixbuf_savev( + gobj(), filename.c_str(), type.c_str(), + const_cast<char**>(option_keys.data()), const_cast<char**>(option_values.data()), + &error); + + if(error) + Glib::Error::throw_exception(error); +} + +void Pixbuf::save_to_buffer(gchar*& buffer, gsize& buffer_size, + const Glib::ustring& type, + const Glib::StringArrayHandle& option_keys, + const Glib::StringArrayHandle& option_values) +{ + GError* error = 0; + + gdk_pixbuf_save_to_bufferv( + gobj(), &buffer, &buffer_size, + type.c_str(), + const_cast<char**>(option_keys.data()), const_cast<char**>(option_values.data()), + &error); + + if(error) + Glib::Error::throw_exception(error); +} + +Pixbuf::SListHandle_PixbufFormat Pixbuf::get_formats() +{ + //TODO: Check that this ownership is appropriate. murrayc. + return SListHandle_PixbufFormat(gdk_pixbuf_get_formats(), Glib::OWNERSHIP_DEEP); +} + + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Gdk::Colorspace>::value_type() +{ + return gdk_colorspace_get_type(); +} + +// static +GType Glib::Value<Gdk::InterpType>::value_type() +{ + return gdk_interp_type_get_type(); +} + +// static +GType Glib::Value<Gdk::PixbufAlphaMode>::value_type() +{ + return gdk_pixbuf_alpha_mode_get_type(); +} + +// static +GType Glib::Value<Gdk::PixbufRotation>::value_type() +{ + return gdk_pixbuf_rotation_get_type(); +} + + +Gdk::PixbufError::PixbufError(Gdk::PixbufError::Code error_code, const Glib::ustring& error_message) +: + Glib::Error (GDK_PIXBUF_ERROR, error_code, error_message) +{} + +Gdk::PixbufError::PixbufError(GError* gobject) +: + Glib::Error (gobject) +{} + +Gdk::PixbufError::Code Gdk::PixbufError::code() const +{ + return static_cast<Code>(Glib::Error::code()); +} + +void Gdk::PixbufError::throw_func(GError* gobject) +{ + throw Gdk::PixbufError(gobject); +} + +// static +GType Glib::Value<Gdk::PixbufError::Code>::value_type() +{ + return gdk_pixbuf_error_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr<Gdk::Pixbuf> wrap(GdkPixbuf* object, bool take_copy) +{ + return Glib::RefPtr<Gdk::Pixbuf>( dynamic_cast<Gdk::Pixbuf*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Pixbuf_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Pixbuf_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_pixbuf_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Pixbuf_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Pixbuf_Class::wrap_new(GObject* object) +{ + return new Pixbuf((GdkPixbuf*)object); +} + + +/* The implementation: */ + +GdkPixbuf* Pixbuf::gobj_copy() +{ + reference(); + return gobj(); +} + +Pixbuf::Pixbuf(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Pixbuf::Pixbuf(GdkPixbuf* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Pixbuf::~Pixbuf() +{} + + +Pixbuf::CppClassType Pixbuf::pixbuf_class_; // initialize static member + +GType Pixbuf::get_type() +{ + return pixbuf_class_.init().get_type(); +} + +GType Pixbuf::get_base_type() +{ + return gdk_pixbuf_get_type(); +} + + +Glib::RefPtr<Pixbuf> Pixbuf::create(const Glib::RefPtr<Drawable>& src, const Glib::RefPtr<Colormap>& cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height) +{ + return Glib::RefPtr<Pixbuf>( new Pixbuf(src, cmap, src_x, src_y, dest_x, dest_y, width, height) ); +} +Glib::RefPtr<Pixbuf> Pixbuf::create(const Glib::RefPtr<Image>& src, const Glib::RefPtr<Colormap>& cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height) +{ + return Glib::RefPtr<Pixbuf>( new Pixbuf(src, cmap, src_x, src_y, dest_x, dest_y, width, height) ); +} +Glib::RefPtr<Pixbuf> Pixbuf::copy() const +{ + return Glib::wrap(gdk_pixbuf_copy(const_cast<GdkPixbuf*>(gobj()))); +} + +Glib::RefPtr<Pixbuf> Pixbuf::create(Colorspace colorspace, bool has_alpha, int bits_per_sample, int width, int height) +{ + return Glib::wrap(gdk_pixbuf_new(((GdkColorspace)(colorspace)), static_cast<int>(has_alpha), bits_per_sample, width, height)); +} + +Glib::RefPtr<Pixbuf> Pixbuf::create_subpixbuf(const Glib::RefPtr<Pixbuf>& src_pixbuf, int src_x, int src_y, int width, int height) +{ + return Glib::wrap(gdk_pixbuf_new_subpixbuf(Glib::unwrap(src_pixbuf), src_x, src_y, width, height)); +} + +Glib::RefPtr<Pixbuf> Pixbuf::create_from_xpm_data(const char *const * data) +{ + return Glib::wrap(gdk_pixbuf_new_from_xpm_data(const_cast<const char**>(data))); +} + +Colorspace Pixbuf::get_colorspace() const +{ + return ((Colorspace)(gdk_pixbuf_get_colorspace(const_cast<GdkPixbuf*>(gobj())))); +} + +int Pixbuf::get_n_channels() const +{ + return gdk_pixbuf_get_n_channels(const_cast<GdkPixbuf*>(gobj())); +} + +bool Pixbuf::get_has_alpha() const +{ + return gdk_pixbuf_get_has_alpha(const_cast<GdkPixbuf*>(gobj())); +} + +int Pixbuf::get_bits_per_sample() const +{ + return gdk_pixbuf_get_bits_per_sample(const_cast<GdkPixbuf*>(gobj())); +} + +guint8* Pixbuf::get_pixels() const +{ + return gdk_pixbuf_get_pixels(const_cast<GdkPixbuf*>(gobj())); +} + +int Pixbuf::get_width() const +{ + return gdk_pixbuf_get_width(const_cast<GdkPixbuf*>(gobj())); +} + +int Pixbuf::get_height() const +{ + return gdk_pixbuf_get_height(const_cast<GdkPixbuf*>(gobj())); +} + +int Pixbuf::get_rowstride() const +{ + return gdk_pixbuf_get_rowstride(const_cast<GdkPixbuf*>(gobj())); +} + +void Pixbuf::fill(guint32 pixel) +{ + gdk_pixbuf_fill(gobj(), pixel); +} + +Glib::RefPtr<Gdk::Pixbuf> Pixbuf::add_alpha(bool substitute_color, guint8 r, guint8 g, guint8 b) const +{ + return Glib::wrap(gdk_pixbuf_add_alpha(const_cast<GdkPixbuf*>(gobj()), static_cast<int>(substitute_color), r, g, b)); +} + +void Pixbuf::copy_area(int src_x, int src_y, int width, int height, const Glib::RefPtr<Gdk::Pixbuf>& dest_pixbuf, int dest_x, int dest_y) const +{ + gdk_pixbuf_copy_area(const_cast<GdkPixbuf*>(gobj()), src_x, src_y, width, height, Glib::unwrap(dest_pixbuf), dest_x, dest_y); +} + +void Pixbuf::saturate_and_pixelate(const Glib::RefPtr<Gdk::Pixbuf>& dest, float saturation, bool pixelate) const +{ + gdk_pixbuf_saturate_and_pixelate(const_cast<GdkPixbuf*>(gobj()), Glib::unwrap(dest), saturation, static_cast<int>(pixelate)); +} + +void Pixbuf::scale(const Glib::RefPtr<Gdk::Pixbuf>& dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, InterpType interp_type) const +{ + gdk_pixbuf_scale(const_cast<GdkPixbuf*>(gobj()), Glib::unwrap(dest), dest_x, dest_y, dest_width, dest_height, offset_x, offset_y, scale_x, scale_y, ((GdkInterpType)(interp_type))); +} + +void Pixbuf::composite(const Glib::RefPtr<Gdk::Pixbuf>& dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, InterpType interp_type, int overall_alpha) const +{ + gdk_pixbuf_composite(const_cast<GdkPixbuf*>(gobj()), Glib::unwrap(dest), dest_x, dest_y, dest_width, dest_height, offset_x, offset_y, scale_x, scale_y, ((GdkInterpType)(interp_type)), overall_alpha); +} + +void Pixbuf::composite_color(const Glib::RefPtr<Gdk::Pixbuf>& dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, InterpType interp_type, int overall_alpha, int check_x, int check_y, int check_size, guint32 color1, guint32 color2) const +{ + gdk_pixbuf_composite_color(const_cast<GdkPixbuf*>(gobj()), Glib::unwrap(dest), dest_x, dest_y, dest_width, dest_height, offset_x, offset_y, scale_x, scale_y, ((GdkInterpType)(interp_type)), overall_alpha, check_x, check_y, check_size, color1, color2); +} + +Glib::RefPtr<Gdk::Pixbuf> Pixbuf::scale_simple(int dest_width, int dest_height, InterpType interp_type) const +{ + return Glib::wrap(gdk_pixbuf_scale_simple(const_cast<GdkPixbuf*>(gobj()), dest_width, dest_height, ((GdkInterpType)(interp_type)))); +} + +Glib::RefPtr<Gdk::Pixbuf> Pixbuf::composite_color_simple(int dest_width, int dest_height, InterpType interp_type, int overall_alpha, int check_size, guint32 color1, guint32 color2) const +{ + return Glib::wrap(gdk_pixbuf_composite_color_simple(const_cast<GdkPixbuf*>(gobj()), dest_width, dest_height, ((GdkInterpType)(interp_type)), overall_alpha, check_size, color1, color2)); +} + +Glib::RefPtr<Gdk::Pixbuf> Pixbuf::rotate_simple(PixbufRotation angle) const +{ + return Glib::wrap(gdk_pixbuf_rotate_simple(const_cast<GdkPixbuf*>(gobj()), ((GdkPixbufRotation)(angle)))); +} + +Glib::RefPtr<Gdk::Pixbuf> Pixbuf::flip(bool horizontal) const +{ + return Glib::wrap(gdk_pixbuf_flip(const_cast<GdkPixbuf*>(gobj()), static_cast<int>(horizontal))); +} + +void Pixbuf::render_threshold_alpha(const Glib::RefPtr<Gdk::Bitmap>& bitmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height, int alpha_threshold) +{ + gdk_pixbuf_render_threshold_alpha(gobj(), Glib::unwrap(bitmap), src_x, src_y, dest_x, dest_y, width, height, alpha_threshold); +} + +void Pixbuf::render_to_drawable(const Glib::RefPtr<Drawable>& drawable, const Glib::RefPtr<Gdk::GC>& gc, int src_x, int src_y, int dest_x, int dest_y, int width, int height, RgbDither dither, int x_dither, int y_dither) +{ + gdk_pixbuf_render_to_drawable(gobj(), Glib::unwrap(drawable), Glib::unwrap(gc), src_x, src_y, dest_x, dest_y, width, height, ((GdkRgbDither)(dither)), x_dither, y_dither); +} + +void Pixbuf::render_to_drawable_alpha(const Glib::RefPtr<Drawable>& drawable, int src_x, int src_y, int dest_x, int dest_y, int width, int height, PixbufAlphaMode alpha_mode, int alpha_threshold, RgbDither dither, int x_dither, int y_dither) +{ + gdk_pixbuf_render_to_drawable_alpha(gobj(), Glib::unwrap(drawable), src_x, src_y, dest_x, dest_y, width, height, ((GdkPixbufAlphaMode)(alpha_mode)), alpha_threshold, ((GdkRgbDither)(dither)), x_dither, y_dither); +} + +Glib::ustring Pixbuf::get_option(const Glib::ustring& key) const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gdk_pixbuf_get_option(const_cast<GdkPixbuf*>(gobj()), key.c_str())); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/pixbuf.h b/libs/gtkmm2/gdk/gdkmm/pixbuf.h new file mode 100644 index 0000000000..712020a8b1 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbuf.h @@ -0,0 +1,884 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUF_H +#define _GDKMM_PIXBUF_H + +#include <glibmm.h> + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdkmm/drawable.h> +#include <gdkmm/image.h> +#include <gdkmm/pixmap.h> +#include <gdkmm/bitmap.h> +#include <gdkmm/pixbufformat.h> +#include <gdkmm/types.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkPixbuf GdkPixbuf; +typedef struct _GdkPixbufClass GdkPixbufClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Pixbuf_Class; } // namespace Gdk +namespace Gdk +{ + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum Colorspace +{ + COLORSPACE_RGB +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::Colorspace> : public Glib::Value_Enum<Gdk::Colorspace> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum InterpType +{ + INTERP_NEAREST, + INTERP_TILES, + INTERP_BILINEAR, + INTERP_HYPER +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::InterpType> : public Glib::Value_Enum<Gdk::InterpType> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum PixbufAlphaMode +{ + PIXBUF_ALPHA_BILEVEL, + PIXBUF_ALPHA_FULL +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::PixbufAlphaMode> : public Glib::Value_Enum<Gdk::PixbufAlphaMode> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum PixbufRotation +{ + PIXBUF_ROTATE_NONE = 0, + PIXBUF_ROTATE_COUNTERCLOCKWISE = 90, + PIXBUF_ROTATE_UPSIDEDOWN = 180, + PIXBUF_ROTATE_CLOCKWISE = 270 +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::PixbufRotation> : public Glib::Value_Enum<Gdk::PixbufRotation> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +/** Exception class for Gdk::Pixbuf errors. + */ +class PixbufError : public Glib::Error +{ +public: + enum Code + { + CORRUPT_IMAGE, + INSUFFICIENT_MEMORY, + BAD_OPTION, + UNKNOWN_TYPE, + UNSUPPORTED_OPERATION, + FAILED + }; + + PixbufError(Code error_code, const Glib::ustring& error_message); + explicit PixbufError(GError* gobject); + Code code() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +private: + static void throw_func(GError* gobject); + friend void wrap_init(); // uses throw_func() +#endif +}; + +} // namespace Gdk + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::PixbufError::Code> : public Glib::Value_Enum<Gdk::PixbufError::Code> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +struct PixbufFormatTraits +{ + typedef PixbufFormat CppType; + typedef const GdkPixbufFormat* CType; + typedef GdkPixbufFormat* CTypeNonConst; + + static CType to_c_type (const CppType& obj) { return obj.gobj(); } + static CType to_c_type (CType ptr) { return ptr; } + static CppType to_cpp_type (CType ptr) { return PixbufFormat(ptr); /* Does not take ownership */ } + static void release_c_type (CType /* ptr */) { /* Doesn't happen */ } +}; +#endif //DOXYGEN_SHOULD_SKIP_THIS + + +class Pixbuf : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Pixbuf CppObjectType; + typedef Pixbuf_Class CppClassType; + typedef GdkPixbuf BaseObjectType; + typedef GdkPixbufClass BaseClassType; + +private: friend class Pixbuf_Class; + static CppClassType pixbuf_class_; + +private: + // noncopyable + Pixbuf(const Pixbuf&); + Pixbuf& operator=(const Pixbuf&); + +protected: + explicit Pixbuf(const Glib::ConstructParams& construct_params); + explicit Pixbuf(GdkPixbuf* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Pixbuf(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkPixbuf* gobj() { return reinterpret_cast<GdkPixbuf*>(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkPixbuf* gobj() const { return reinterpret_cast<GdkPixbuf*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkPixbuf* gobj_copy(); + +private: + + +protected: + + //TODO: Documente these, based on the docs for the C functions. + Pixbuf(const Glib::RefPtr<Drawable>& src, const Glib::RefPtr<Colormap>& cmap, + int src_x, int src_y, int dest_x, int dest_y, int width, int height); + Pixbuf(const Glib::RefPtr<Image>& src, const Glib::RefPtr<Colormap>& cmap, + int src_x, int src_y, int dest_x, int dest_y, int width, int height); + +public: + typedef sigc::slot<void, const guint8*> SlotDestroyData; + + + static Glib::RefPtr<Pixbuf> create(const Glib::RefPtr<Drawable>& src, const Glib::RefPtr<Colormap>& cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height); + + + static Glib::RefPtr<Pixbuf> create(const Glib::RefPtr<Image>& src, const Glib::RefPtr<Colormap>& cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height); + + + /** Creates a new Gdk::Pixbuf with a copy of the information in the specified + * @a pixbuf . + * @return A newly-created pixbuf with a reference count of 1, or <tt>0</tt> if + * not enough memory could be allocated. + */ + Glib::RefPtr<Pixbuf> copy() const; + + + /** Creates a new Gdk::Pixbuf structure and allocates a buffer for it. The + * buffer has an optimal rowstride. Note that the buffer is not cleared; + * you will have to fill it completely yourself. + * @param colorspace Color space for image. + * @param has_alpha Whether the image should have transparency information. + * @param bits_per_sample Number of bits per color sample. + * @param width Width of image in pixels. + * @param height Height of image in pixels. + * @return A newly-created Gdk::Pixbuf with a reference count of 1, or + * <tt>0</tt> if not enough memory could be allocated for the image buffer. + */ + static Glib::RefPtr<Pixbuf> create( + Colorspace colorspace, bool has_alpha, + int bits_per_sample, int width, int height); + + + /** Creates a new pixbuf which represents a sub-region of + * @a src_pixbuf . The new pixbuf shares its pixels with the + * original pixbuf, so writing to one affects both. + * The new pixbuf holds a reference to @a src_pixbuf , so + * @a src_pixbuf will not be finalized until the new pixbuf + * is finalized. + * @param src_pixbuf A Gdk::Pixbuf. + * @param src_x X coord in @a src_pixbuf . + * @param src_y Y coord in @a src_pixbuf . + * @param width Width of region in @a src_pixbuf . + * @param height Height of region in @a src_pixbuf . + * @return A new pixbuf. + */ + static Glib::RefPtr<Pixbuf> create_subpixbuf( + const Glib::RefPtr<Pixbuf>& src_pixbuf, + int src_x, int src_y, int width, int height); + + /** Creates a new pixbuf by loading an image from a file. The file format is detected automatically. + * @param filename The path to the pixbuf file. + * + * @throw Glib::FileError + * @throw Gdk::PixbufError + */ + static Glib::RefPtr<Pixbuf> create_from_file(const std::string& filename); + + /** Creates a new pixbuf by loading an image from a file. The file format is detected automatically. + * The image will be scaled to fit in the requested size. + * @param filename The path to the pixbuf file. + * @param width The desired width + * @param height The desired height + * @param preserve_aspect_ratio: Whether the image's aspect ratio will be preserved when scaling. + * + * @throw Glib::FileError + * @throw Gdk::PixbufError + */ + static Glib::RefPtr<Pixbuf> create_from_file(const std::string& filename, int width, int height, bool preserve_aspect_ratio = true); + + + /** Creates a new Gdk::Pixbuf out of in-memory image data. + * Currently only RGB images with 8 bits per sample are supported. + * + * @param data %Image data in 8-bit/sample packed format. + * @param colorspace Colorspace for the image data. + * @param has_alpha Whether the data has an opacity channel. + * @param bits_per_sample Number of bits per sample. + * @param width Width of the image in pixels. + * @param height Height of the image in pixels. + * @param rowstride Distance in bytes between rows. + * @return A newly-created Gdk::Pixbuf object. + */ + static Glib::RefPtr<Pixbuf> create_from_data(const guint8* data, Colorspace colorspace, + bool has_alpha, int bits_per_sample, + int width, int height, int rowstride); + + /** Creates a new Gdk::Pixbuf out of in-memory image data. + * Currently only RGB images with 8 bits per sample are supported. + * + * @param data %Image data in 8-bit/sample packed format. + * @param colorspace Colorspace for the image data. + * @param has_alpha Whether the data has an opacity channel. + * @param bits_per_sample Number of bits per sample. + * @param width Width of the image in pixels. + * @param height Height of the image in pixels. + * @param rowstride Distance in bytes between rows. + * @param destroy_slot Slot used to free the data when the pixbuf's + * reference count drops to zero. + * @return A newly-created Gdk::Pixbuf object. + */ + static Glib::RefPtr<Pixbuf> create_from_data(const guint8* data, Colorspace colorspace, + bool has_alpha, int bits_per_sample, + int width, int height, int rowstride, + const SlotDestroyData& destroy_slot); + + + /** Creates a new pixbuf by parsing XPM data in memory. This data is commonly + * the result of including an XPM file into a program's C source. + * @param data Pointer to inline XPM data. + * @return A newly-created pixbuf with a reference count of 1. + */ + static Glib::RefPtr<Pixbuf> create_from_xpm_data(const char *const * data); + + /** Create a Gdk::Pixbuf from a flat representation that is suitable for + * storing as inline data in a program. This is useful if you want to ship a + * program with images, but don't want to depend on any external files. + * + * GTK+ ships with a program called <tt>gdk-pixbuf-csource</tt> which allows + * for conversion of GdkPixbufs into such a inline representation. In almost + * all cases, you should pass the <tt>--raw</tt> flag to + * <tt>gdk-pixbuf-csource</tt>. A sample invocation would be: + * + * <tt>gdk-pixbuf-csource --raw --name=myimage_inline myimage.png</tt> + * + * For the typical case where the inline pixbuf is read-only static data, you + * don't need to copy the pixel data unless you intend to write to it, so you + * can pass <tt>false</tt> for @a copy_pixels. (If you pass <tt>--rle</tt> to + * <tt>gdk-pixbuf-csource</tt>, a copy will be made even if @a copy_pixels is + * <tt>false</tt>, so using this option is generally a bad idea.) + * + * If you create a pixbuf from const inline data compiled into your program, + * it's probably safe to ignore errors, since things will always succeed. For + * non-const inline data, you could get out of memory. For untrusted inline + * data located at runtime, you could have corrupt inline data in addition. + * + * @param data_length Length in bytes of the @a data argument. + * @param data Byte data containing a serialized GdkPixdata structure. + * @param copy_pixels Whether to copy the pixel data, or use direct pointers + * to @a data for the resulting pixbuf. + * @throw Gdk::PixbufError + */ + static Glib::RefPtr<Pixbuf> create_from_inline(int data_length, const guint8* data, + bool copy_pixels = false); + + + /** Queries the color space of a pixbuf. + * @return Color space. + */ + Colorspace get_colorspace() const; + + + /** Queries the number of channels of a pixbuf. + * @return Number of channels. + */ + int get_n_channels() const; + + /** Queries whether a pixbuf has an alpha channel (opacity information). + * @return <tt>true</tt> if it has an alpha channel, <tt>false</tt> otherwise. + */ + bool get_has_alpha() const; + + /** Queries the number of bits per color sample in a pixbuf. + * @return Number of bits per color sample. + */ + int get_bits_per_sample() const; + + /** Queries a pointer to the pixel data of a pixbuf. + * @return A pointer to the pixbuf's pixel data. Please see <xref linkend="image-data"/> + * for information about how the pixel data is stored in + * memory. + */ + guint8* get_pixels() const; + + /** Queries the width of a pixbuf. + * @return Width in pixels. + */ + int get_width() const; + + /** Queries the height of a pixbuf. + * @return Height in pixels. + */ + int get_height() const; + + /** Queries the rowstride of a pixbuf, which is the number of bytes between the start of a row + * and the start of the next row. + * @return Distance between row starts. + */ + int get_rowstride() const; + + + /** Clears a pixbuf to the given RGBA value, converting the RGBA value into + * the pixbuf's pixel format. The alpha will be ignored if the pixbuf + * doesn't have an alpha channel. + * @param pixel RGBA pixel to clear to + * (0xffffffff is opaque white, 0x00000000 transparent black). + */ + void fill(guint32 pixel); + + /** Save an image file. + * @throw Glib::FileError + * @throw Gdk::PixbufError + */ + void save(const std::string& filename, const Glib::ustring& type); + + + /** Save an image file. + * @throw Glib::FileError + * @throw Gdk::PixbufError + */ + void save(const std::string& filename, const Glib::ustring& type, + const Glib::StringArrayHandle& option_keys, + const Glib::StringArrayHandle& option_values); + + +/* TODO: +typedef gboolean (*GdkPixbufSaveFunc) (const gchar *buf, + gsize count, + GError **error, + gpointer data); + +gboolean gdk_pixbuf_save_to_callback (GdkPixbuf *pixbuf, + GdkPixbufSaveFunc save_func, + gpointer user_data, + const char *type, + GError **error, + ...); + +gboolean gdk_pixbuf_save_to_callbackv (GdkPixbuf *pixbuf, + GdkPixbufSaveFunc save_func, + gpointer user_data, + const char *type, + char **option_keys, + char **option_values, + GError **error); + +*/ + + void save_to_buffer(gchar*& buffer, gsize& buffer_size, + const Glib::ustring& type, + const Glib::StringArrayHandle& option_keys, + const Glib::StringArrayHandle& option_values); + + + /** Takes an existing pixbuf and adds an alpha channel to it. + * If the existing pixbuf already had an alpha channel, the channel + * values are copied from the original; otherwise, the alpha channel + * is initialized to 255 (full opacity). + * + * If @a substitute_color is <tt>true</tt>, then the color specified by ( @a r , @a g , @a b ) will be + * assigned zero opacity. That is, if you pass (255, 255, 255) for the + * substitute color, all white pixels will become fully transparent. + * @param substitute_color Whether to set a color to zero opacity. If this + * is <tt>false</tt>, then the ( @a r , @a g , @a b ) arguments will be ignored. + * @param r Red value to substitute. + * @param g Green value to substitute. + * @param b Blue value to substitute. + * @return A newly-created pixbuf with a reference count of 1. + */ + Glib::RefPtr<Gdk::Pixbuf> add_alpha( + bool substitute_color, guint8 r, guint8 g, guint8 b) const; + + + /** Copies a rectangular area from @a src_pixbuf to @a dest_pixbuf . Conversion of + * pixbuf formats is done automatically. + * @param src_x Source X coordinate within @a src_pixbuf . + * @param src_y Source Y coordinate within @a src_pixbuf . + * @param width Width of the area to copy. + * @param height Height of the area to copy. + * @param dest_pixbuf Destination pixbuf. + * @param dest_x X coordinate within @a dest_pixbuf . + * @param dest_y Y coordinate within @a dest_pixbuf . + */ + void copy_area( + int src_x, int src_y, int width, int height, + const Glib::RefPtr<Gdk::Pixbuf>& dest_pixbuf, + int dest_x, int dest_y) const; + + + /** Modifies saturation and optionally pixelates @a src , placing the + * result in @a dest . @a src and @a dest may be the same pixbuf with no ill + * effects. If @a saturation is 1.0 then saturation is not changed. If + * it's less than 1.0, saturation is reduced (the image is darkened); + * if greater than 1.0, saturation is increased (the image is + * brightened). If @a pixelate is <tt>true</tt>, then pixels are faded in a + * checkerboard pattern to create a pixelated image. @a src and @a dest + * must have the same image format, size, and rowstride. + * @param dest Place to write modified version of @a src . + * @param saturation Saturation factor. + * @param pixelate Whether to pixelate. + */ + void saturate_and_pixelate( + const Glib::RefPtr<Gdk::Pixbuf>& dest, + float saturation, bool pixelate) const; + + + /** Creates a transformation of the source image @a src by scaling by + * @a scale_x and @a scale_y then translating by @a offset_x and @a offset_y , + * then renders the rectangle ( @a dest_x , @a dest_y , @a dest_width , + * @a dest_height ) of the resulting image onto the destination image + * replacing the previous contents. + * + * Try to use scale_simple() first, this function is + * the industrial-strength power tool you can fall back to if + * scale_simple() isn't powerful enough. + * @param dest The Gdk::Pixbuf into which to render the results. + * @param dest_x The left coordinate for region to render. + * @param dest_y The top coordinate for region to render. + * @param dest_width The width of the region to render. + * @param dest_height The height of the region to render. + * @param offset_x The offset in the X direction (currently rounded to an integer). + * @param offset_y The offset in the Y direction (currently rounded to an integer). + * @param scale_x The scale factor in the X direction. + * @param scale_y The scale factor in the Y direction. + * @param interp_type The interpolation type for the transformation. + */ + void scale(const Glib::RefPtr<Gdk::Pixbuf>& dest, + int dest_x, int dest_y, + int dest_width, int dest_height, + double offset_x, double offset_y, + double scale_x, double scale_y, + InterpType interp_type) const; + + + /** Creates a transformation of the source image @a src by scaling by + * @a scale_x and @a scale_y then translating by @a offset_x and @a offset_y . + * This gives an image in the coordinates of the destination pixbuf. + * The rectangle ( @a dest_x , @a dest_y , @a dest_width , @a dest_height ) + * is then composited onto the corresponding rectangle of the + * original destination image. + * + * When the destination rectangle contains parts not in the source + * image, the data at the edges of the source image is replicated + * to infinity. + * + * <figure id="pixbuf-composite-diagram"> + * <title>Compositing of pixbufs</title> + * <graphic fileref="composite.png" format="PNG"/> + * </figure> + * @param dest The Gdk::Pixbuf into which to render the results. + * @param dest_x The left coordinate for region to render. + * @param dest_y The top coordinate for region to render. + * @param dest_width The width of the region to render. + * @param dest_height The height of the region to render. + * @param offset_x The offset in the X direction (currently rounded to an integer). + * @param offset_y The offset in the Y direction (currently rounded to an integer). + * @param scale_x The scale factor in the X direction. + * @param scale_y The scale factor in the Y direction. + * @param interp_type The interpolation type for the transformation. + * @param overall_alpha Overall alpha for source image (0..255). + */ + void composite(const Glib::RefPtr<Gdk::Pixbuf>& dest, + int dest_x, int dest_y, + int dest_width, int dest_height, + double offset_x, double offset_y, + double scale_x, double scale_y, + InterpType interp_type, + int overall_alpha) const; + + + /** Creates a transformation of the source image @a src by scaling by + * @a scale_x and @a scale_y then translating by @a offset_x and @a offset_y , + * then composites the rectangle ( @a dest_x , @a dest_y , @a dest_width , + * @a dest_height ) of the resulting image with a checkboard of the + * colors @a color1 and @a color2 and renders it onto the destination + * image. + * + * See composite_color_simple() for a simpler variant of this + * function suitable for many tasks. + * @param dest The Gdk::Pixbuf into which to render the results. + * @param dest_x The left coordinate for region to render. + * @param dest_y The top coordinate for region to render. + * @param dest_width The width of the region to render. + * @param dest_height The height of the region to render. + * @param offset_x The offset in the X direction (currently rounded to an integer). + * @param offset_y The offset in the Y direction (currently rounded to an integer). + * @param scale_x The scale factor in the X direction. + * @param scale_y The scale factor in the Y direction. + * @param interp_type The interpolation type for the transformation. + * @param overall_alpha Overall alpha for source image (0..255). + * @param check_x The X offset for the checkboard (origin of checkboard is at - @a check_x , - @a check_y ). + * @param check_y The Y offset for the checkboard. + * @param check_size The size of checks in the checkboard (must be a power of two). + * @param color1 The color of check at upper left. + * @param color2 The color of the other check. + */ + void composite_color(const Glib::RefPtr<Gdk::Pixbuf>& dest, + int dest_x, int dest_y, + int dest_width, int dest_height, + double offset_x, double offset_y, + double scale_x, double scale_y, + InterpType interp_type, + int overall_alpha, + int check_x, int check_y, + int check_size, + guint32 color1, guint32 color2) const; + + + /** Create a new Gdk::Pixbuf containing a copy of @a src scaled to + * @a dest_width x @a dest_height . Leaves @a src unaffected. @a interp_type + * should be Gdk::INTERP_NEAREST if you want maximum speed (but when + * scaling down Gdk::INTERP_NEAREST is usually unusably ugly). The + * default @a interp_type should be Gdk::INTERP_BILINEAR which offers + * reasonable quality and speed. + * + * You can scale a sub-portion of @a src by creating a sub-pixbuf + * pointing into @a src ; see new_subpixbuf(). + * + * For more complicated scaling/compositing see scale() + * and composite(). + * @param dest_width The width of destination image. + * @param dest_height The height of destination image. + * @param interp_type The interpolation type for the transformation. + * @return The new Gdk::Pixbuf, or <tt>0</tt> if not enough memory could be + * allocated for it. + */ + Glib::RefPtr<Gdk::Pixbuf> scale_simple( + int dest_width, int dest_height, + InterpType interp_type) const; + + + /** Creates a new Gdk::Pixbuf by scaling @a src to @a dest_width x + * @a dest_height and compositing the result with a checkboard of colors + * @a color1 and @a color2 . + * @param dest_width The width of destination image. + * @param dest_height The height of destination image. + * @param interp_type The interpolation type for the transformation. + * @param overall_alpha Overall alpha for source image (0..255). + * @param check_size The size of checks in the checkboard (must be a power of two). + * @param color1 The color of check at upper left. + * @param color2 The color of the other check. + * @return The new Gdk::Pixbuf, or <tt>0</tt> if not enough memory could be + * allocated for it. + */ + Glib::RefPtr<Gdk::Pixbuf> composite_color_simple( + int dest_width, int dest_height, + InterpType interp_type, + int overall_alpha, int check_size, + guint32 color1, guint32 color2) const; + + + /** Rotates a pixbuf by a multiple of 90 degrees, and returns the + * result in a new pixbuf. + * @param angle The angle to rotate by. + * @return A new pixbuf + * + * Since: 2.6. + */ + Glib::RefPtr<Gdk::Pixbuf> rotate_simple(PixbufRotation angle) const; + + /** Flips a pixbuf horizontally or vertically and returns the + * result in a new pixbuf. + * @param horizontal <tt>true</tt> to flip horizontally, <tt>false</tt> to flip vertically. + * @return A new pixbuf. + * + * Since: 2.6. + */ + Glib::RefPtr<Gdk::Pixbuf> flip(bool horizontal = true) const; + + + /** Takes the opacity values in a rectangular portion of a pixbuf and thresholds + * them to produce a bi-level alpha mask that can be used as a clipping mask for + * a drawable. + * @param bitmap Bitmap where the bilevel mask will be painted to. + * @param src_x Source X coordinate. + * @param src_y Source Y coordinate. + * @param dest_x Destination X coordinate. + * @param dest_y Destination Y coordinate. + * @param width Width of region to threshold, or -1 to use pixbuf width. + * @param height Height of region to threshold, or -1 to use pixbuf height. + * @param alpha_threshold Opacity values below this will be painted as zero; all + * other values will be painted as one. + */ + void render_threshold_alpha(const Glib::RefPtr<Gdk::Bitmap>& bitmap, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height, + int alpha_threshold); + + + /** Renders a rectangular portion of a pixbuf to a drawable while using the + * specified GC. This is done using GdkRGB, so the specified drawable must have + * the GdkRGB visual and colormap. Note that this function will ignore the + * opacity information for images with an alpha channel; the GC must already + * have the clipping mask set if you want transparent regions to show through. + * + * For an explanation of dither offsets, see the GdkRGB documentation. In + * brief, the dither offset is important when re-rendering partial regions of an + * image to a rendered version of the full image, or for when the offsets to a + * base position change, as in scrolling. The dither matrix has to be shifted + * for consistent visual results. If you do not have any of these cases, the + * dither offsets can be both zero. + * + * Deprecated: This function is obsolete. Use gdk_draw_pixbuf() instead. + * @param drawable Destination drawable. + * @param gc GC used for rendering. + * @param src_x Source X coordinate within pixbuf. + * @param src_y Source Y coordinate within pixbuf. + * @param dest_x Destination X coordinate within drawable. + * @param dest_y Destination Y coordinate within drawable. + * @param width Width of region to render, in pixels, or -1 to use pixbuf width. + * @param height Height of region to render, in pixels, or -1 to use pixbuf height. + * @param dither Dithering mode for GdkRGB. + * @param x_dither X offset for dither. + * @param y_dither Y offset for dither. + */ + void render_to_drawable(const Glib::RefPtr<Drawable>& drawable, + const Glib::RefPtr<Gdk::GC>& gc, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height, + RgbDither dither, + int x_dither, int y_dither); + + /** Renders a rectangular portion of a pixbuf to a drawable. The destination + * drawable must have a colormap. All windows have a colormap, however, pixmaps + * only have colormap by default if they were created with a non-<tt>0</tt> window argument. + * Otherwise a colormap must be set on them with gdk_drawable_set_colormap. + * + * On older X servers, rendering pixbufs with an alpha channel involves round trips + * to the X server, and may be somewhat slow. + * + * Deprecated: This function is obsolete. Use gdk_draw_pixbuf() instead. + * @param drawable Destination drawable. + * @param src_x Source X coordinate within pixbuf. + * @param src_y Source Y coordinates within pixbuf. + * @param dest_x Destination X coordinate within drawable. + * @param dest_y Destination Y coordinate within drawable. + * @param width Width of region to render, in pixels, or -1 to use pixbuf width. + * @param height Height of region to render, in pixels, or -1 to use pixbuf height. + * @param alpha_mode Ignored. Present for backwards compatibility. + * @param alpha_threshold Ignored. Present for backwards compatibility. + * @param dither Dithering mode for GdkRGB. + * @param x_dither X offset for dither. + * @param y_dither Y offset for dither. + */ + void render_to_drawable_alpha(const Glib::RefPtr<Drawable>& drawable, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height, + PixbufAlphaMode alpha_mode, + int alpha_threshold, + RgbDither dither, + int x_dither, int y_dither); + + void render_pixmap_and_mask_for_colormap(const Glib::RefPtr<Colormap>& colormap, + Glib::RefPtr<Pixmap>& pixmap_return, + Glib::RefPtr<Bitmap>& mask_return, + int alpha_threshold); + + void render_pixmap_and_mask(Glib::RefPtr<Pixmap>& pixmap_return, + Glib::RefPtr<Bitmap>& mask_return, int alpha_threshold); + + + /** Looks up @a key in the list of options that may have been attached to the + * @a pixbuf when it was loaded. + * @param key A nul-terminated string. + * @return The value associated with @a key . This is a nul-terminated + * string that should not be freed or <tt>0</tt> if @a key was not found. + */ + Glib::ustring get_option(const Glib::ustring& key) const; + + + typedef Glib::SListHandle< Glib::RefPtr<PixbufFormat>, PixbufFormatTraits > SListHandle_PixbufFormat; + static SListHandle_PixbufFormat get_formats(); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Gdk + + +namespace Glib +{ + /** @relates Gdk::Pixbuf + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Gdk::Pixbuf> wrap(GdkPixbuf* object, bool take_copy = false); +} + + +#endif /* _GDKMM_PIXBUF_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/pixbufanimation.cc b/libs/gtkmm2/gdk/gdkmm/pixbufanimation.cc new file mode 100644 index 0000000000..a558a55044 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbufanimation.cc @@ -0,0 +1,172 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/pixbufanimation.h> +#include <gdkmm/private/pixbufanimation_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdk/gdkcolor.h> + +namespace Gdk +{ + +Glib::RefPtr<PixbufAnimation> PixbufAnimation::create_from_file(const Glib::ustring& filename) +{ + GError* pError = 0; + return Glib::wrap(gdk_pixbuf_animation_new_from_file(filename.c_str(), &pError)); +} + +} //Gdk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr<Gdk::PixbufAnimation> wrap(GdkPixbufAnimation* object, bool take_copy) +{ + return Glib::RefPtr<Gdk::PixbufAnimation>( dynamic_cast<Gdk::PixbufAnimation*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& PixbufAnimation_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &PixbufAnimation_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_pixbuf_animation_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void PixbufAnimation_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* PixbufAnimation_Class::wrap_new(GObject* object) +{ + return new PixbufAnimation((GdkPixbufAnimation*)object); +} + + +/* The implementation: */ + +GdkPixbufAnimation* PixbufAnimation::gobj_copy() +{ + reference(); + return gobj(); +} + +PixbufAnimation::PixbufAnimation(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +PixbufAnimation::PixbufAnimation(GdkPixbufAnimation* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +PixbufAnimation::~PixbufAnimation() +{} + + +PixbufAnimation::CppClassType PixbufAnimation::pixbufanimation_class_; // initialize static member + +GType PixbufAnimation::get_type() +{ + return pixbufanimation_class_.init().get_type(); +} + +GType PixbufAnimation::get_base_type() +{ + return gdk_pixbuf_animation_get_type(); +} + + +int PixbufAnimation::get_width() const +{ + return gdk_pixbuf_animation_get_width(const_cast<GdkPixbufAnimation*>(gobj())); +} + +int PixbufAnimation::get_height() const +{ + return gdk_pixbuf_animation_get_height(const_cast<GdkPixbufAnimation*>(gobj())); +} + +bool PixbufAnimation::is_static_image() const +{ + return gdk_pixbuf_animation_is_static_image(const_cast<GdkPixbufAnimation*>(gobj())); +} + +Glib::RefPtr<Pixbuf> PixbufAnimation::get_static_image() +{ + + Glib::RefPtr<Pixbuf> retvalue = Glib::wrap(gdk_pixbuf_animation_get_static_image(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<PixbufAnimationIter> PixbufAnimation::get_iter(const GTimeVal* start_time) +{ + + Glib::RefPtr<PixbufAnimationIter> retvalue = Glib::wrap(gdk_pixbuf_animation_get_iter(gobj(), start_time)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/pixbufanimation.h b/libs/gtkmm2/gdk/gdkmm/pixbufanimation.h new file mode 100644 index 0000000000..dd5afec672 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbufanimation.h @@ -0,0 +1,194 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUFANIMATION_H +#define _GDKMM_PIXBUFANIMATION_H + +#include <glibmm.h> + +/* $Id$ */ + +/* box.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <glibmm/object.h> +#include <gdkmm/pixbuf.h> +#include <gdkmm/pixbufanimationiter.h> +#include <gdk-pixbuf/gdk-pixbuf.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkPixbufAnimation GdkPixbufAnimation; +typedef struct _GdkPixbufAnimationClass GdkPixbufAnimationClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class PixbufAnimation_Class; } // namespace Gdk +namespace Gdk +{ + + +class PixbufAnimation : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef PixbufAnimation CppObjectType; + typedef PixbufAnimation_Class CppClassType; + typedef GdkPixbufAnimation BaseObjectType; + typedef GdkPixbufAnimationClass BaseClassType; + +private: friend class PixbufAnimation_Class; + static CppClassType pixbufanimation_class_; + +private: + // noncopyable + PixbufAnimation(const PixbufAnimation&); + PixbufAnimation& operator=(const PixbufAnimation&); + +protected: + explicit PixbufAnimation(const Glib::ConstructParams& construct_params); + explicit PixbufAnimation(GdkPixbufAnimation* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~PixbufAnimation(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkPixbufAnimation* gobj() { return reinterpret_cast<GdkPixbufAnimation*>(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkPixbufAnimation* gobj() const { return reinterpret_cast<GdkPixbufAnimation*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkPixbufAnimation* gobj_copy(); + +private: + + +protected: + +public: + + static Glib::RefPtr<PixbufAnimation> create_from_file(const Glib::ustring& filename); + + + /** Queries the width of the bounding box of a pixbuf animation. + * @return Width of the bounding box of the animation. + */ + int get_width() const; + + /** Queries the height of the bounding box of a pixbuf animation. + * @return Height of the bounding box of the animation. + */ + int get_height() const; + + /** If you load a file with new_from_file() and it turns + * out to be a plain, unanimated image, then this function will return + * <tt>true</tt>. Use get_static_image() to retrieve + * the image. + * @return <tt>true</tt> if the "animation" was really just an image. + */ + bool is_static_image() const; + + /** If an animation is really just a plain image (has only one frame), + * this function returns that image. If the animation is an animation, + * this function returns a reasonable thing to display as a static + * unanimated image, which might be the first frame, or something more + * sophisticated. If an animation hasn't loaded any frames yet, this + * function will return <tt>0</tt>. + * @return Unanimated image representing the animation. + */ + Glib::RefPtr<Pixbuf> get_static_image(); + + /** Get an iterator for displaying an animation. The iterator provides + * the frames that should be displayed at a given time. + * It should be freed after use with Glib::object_unref(). + * + * @a start_time would normally come from Glib::get_current_time(), and + * marks the beginning of animation playback. After creating an + * iterator, you should immediately display the pixbuf returned by + * Gdk::PixbufAnimationIter::get_pixbuf(). Then, you should install a + * timeout (with Glib::timeout_add()) or by some other mechanism ensure + * that you'll update the image after + * Gdk::PixbufAnimationIter::get_delay_time() milliseconds. Each time + * the image is updated, you should reinstall the timeout with the new, + * possibly-changed delay time. + * + * As a shortcut, if @a start_time is <tt>0</tt>, the result of + * Glib::get_current_time() will be used automatically. + * + * To update the image (i.e. possibly change the result of + * Gdk::PixbufAnimationIter::get_pixbuf() to a new frame of the animation), + * call Gdk::PixbufAnimationIter::advance(). + * + * If you're using Gdk::PixbufLoader, in addition to updating the image + * after the delay time, you should also update it whenever you + * receive the area_updated signal and + * Gdk::PixbufAnimationIter::on_currently_loading_frame() returns + * <tt>true</tt>. In this case, the frame currently being fed into the loader + * has received new data, so needs to be refreshed. The delay time for + * a frame may also be modified after an area_updated signal, for + * example if the delay time for a frame is encoded in the data after + * the frame itself. So your timeout should be reinstalled after any + * area_updated signal. + * + * A delay time of -1 is possible, indicating "infinite." + * @param start_time Time when the animation starts playing. + * @return An iterator to move over the animation. + */ + Glib::RefPtr<PixbufAnimationIter> get_iter(const GTimeVal* start_time); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::PixbufAnimation + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Gdk::PixbufAnimation> wrap(GdkPixbufAnimation* object, bool take_copy = false); +} + + +#endif /* _GDKMM_PIXBUFANIMATION_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/pixbufanimationiter.cc b/libs/gtkmm2/gdk/gdkmm/pixbufanimationiter.cc new file mode 100644 index 0000000000..60046e4eff --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbufanimationiter.cc @@ -0,0 +1,123 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/pixbufanimationiter.h> +#include <gdkmm/private/pixbufanimationiter_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr<Gdk::PixbufAnimationIter> wrap(GdkPixbufAnimationIter* object, bool take_copy) +{ + return Glib::RefPtr<Gdk::PixbufAnimationIter>( dynamic_cast<Gdk::PixbufAnimationIter*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& PixbufAnimationIter_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &PixbufAnimationIter_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_pixbuf_animation_iter_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void PixbufAnimationIter_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* PixbufAnimationIter_Class::wrap_new(GObject* object) +{ + return new PixbufAnimationIter((GdkPixbufAnimationIter*)object); +} + + +/* The implementation: */ + +GdkPixbufAnimationIter* PixbufAnimationIter::gobj_copy() +{ + reference(); + return gobj(); +} + +PixbufAnimationIter::PixbufAnimationIter(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +PixbufAnimationIter::PixbufAnimationIter(GdkPixbufAnimationIter* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +PixbufAnimationIter::~PixbufAnimationIter() +{} + + +PixbufAnimationIter::CppClassType PixbufAnimationIter::pixbufanimationiter_class_; // initialize static member + +GType PixbufAnimationIter::get_type() +{ + return pixbufanimationiter_class_.init().get_type(); +} + +GType PixbufAnimationIter::get_base_type() +{ + return gdk_pixbuf_animation_iter_get_type(); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/pixbufanimationiter.h b/libs/gtkmm2/gdk/gdkmm/pixbufanimationiter.h new file mode 100644 index 0000000000..ceba0da1e9 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbufanimationiter.h @@ -0,0 +1,120 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUFANIMATIONITER_H +#define _GDKMM_PIXBUFANIMATIONITER_H + +#include <glibmm.h> + +/* $Id$ */ + +/* pixbufanimationiter.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <glibmm/object.h> +#include <gdk-pixbuf/gdk-pixbuf.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkPixbufAnimationIter GdkPixbufAnimationIter; +typedef struct _GdkPixbufAnimationIterClass GdkPixbufAnimationIterClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class PixbufAnimationIter_Class; } // namespace Gdk +namespace Gdk +{ + + +class PixbufAnimationIter : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef PixbufAnimationIter CppObjectType; + typedef PixbufAnimationIter_Class CppClassType; + typedef GdkPixbufAnimationIter BaseObjectType; + typedef GdkPixbufAnimationIterClass BaseClassType; + +private: friend class PixbufAnimationIter_Class; + static CppClassType pixbufanimationiter_class_; + +private: + // noncopyable + PixbufAnimationIter(const PixbufAnimationIter&); + PixbufAnimationIter& operator=(const PixbufAnimationIter&); + +protected: + explicit PixbufAnimationIter(const Glib::ConstructParams& construct_params); + explicit PixbufAnimationIter(GdkPixbufAnimationIter* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~PixbufAnimationIter(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkPixbufAnimationIter* gobj() { return reinterpret_cast<GdkPixbufAnimationIter*>(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkPixbufAnimationIter* gobj() const { return reinterpret_cast<GdkPixbufAnimationIter*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkPixbufAnimationIter* gobj_copy(); + +private: + +protected: + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::PixbufAnimationIter + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Gdk::PixbufAnimationIter> wrap(GdkPixbufAnimationIter* object, bool take_copy = false); +} + + +#endif /* _GDKMM_PIXBUFANIMATIONITER_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/pixbufformat.cc b/libs/gtkmm2/gdk/gdkmm/pixbufformat.cc new file mode 100644 index 0000000000..63dc4c43a4 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbufformat.cc @@ -0,0 +1,118 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/pixbufformat.h> +#include <gdkmm/private/pixbufformat_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <glibmm/utility.h> +#include <gdk-pixbuf/gdk-pixbuf.h> + +namespace Gdk +{ + +PixbufFormat::PixbufFormat() +: gobject_ (0) +{} + +PixbufFormat::PixbufFormat(const GdkPixbufFormat* gobject) +: gobject_ (gobject) +{} + +PixbufFormat::~PixbufFormat() +{ + //We don't free anything because we did not take ownership of the underlying C instance + //(because we can't.) +} + +PixbufFormat::PixbufFormat(const PixbufFormat& src) +: gobject_(src.gobject_) +{ +} + +PixbufFormat& PixbufFormat::operator=(const PixbufFormat& src) +{ + gobject_ = src.gobject_; + return *this; +} + + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + + +namespace Gdk +{ + + +Glib::ustring PixbufFormat::get_name() const +{ + return Glib::convert_return_gchar_ptr_to_ustring(gdk_pixbuf_format_get_name(const_cast<GdkPixbufFormat*>(gobj()))); +} + +Glib::ustring PixbufFormat::get_description() const +{ + return Glib::convert_return_gchar_ptr_to_ustring(gdk_pixbuf_format_get_description(const_cast<GdkPixbufFormat*>(gobj()))); +} + +Glib::StringArrayHandle PixbufFormat::get_mime_types() const +{ + return Glib::StringArrayHandle(gdk_pixbuf_format_get_mime_types(const_cast<GdkPixbufFormat*>(gobj()))); +} + +Glib::StringArrayHandle PixbufFormat::get_extensions() const +{ + return Glib::StringArrayHandle(gdk_pixbuf_format_get_extensions(const_cast<GdkPixbufFormat*>(gobj()))); +} + +bool PixbufFormat::is_writable() const +{ + return gdk_pixbuf_format_is_writable(const_cast<GdkPixbufFormat*>(gobj())); +} + +bool PixbufFormat::is_scalable() const +{ + return gdk_pixbuf_format_is_scalable(const_cast<GdkPixbufFormat*>(gobj())); +} + +bool PixbufFormat::is_disabled() const +{ + return gdk_pixbuf_format_is_disabled(const_cast<GdkPixbufFormat*>(gobj())); +} + +void PixbufFormat::set_disabled(bool disabled) +{ + gdk_pixbuf_format_set_disabled(gobj(), static_cast<int>(disabled)); +} + +Glib::ustring PixbufFormat::get_license() const +{ + return Glib::convert_return_gchar_ptr_to_ustring(gdk_pixbuf_format_get_license(const_cast<GdkPixbufFormat*>(gobj()))); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/pixbufformat.h b/libs/gtkmm2/gdk/gdkmm/pixbufformat.h new file mode 100644 index 0000000000..b9adddf08d --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbufformat.h @@ -0,0 +1,150 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUFFORMAT_H +#define _GDKMM_PIXBUFFORMAT_H + +#include <glibmm.h> + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include <gdkmmconfig.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GdkPixbufFormat GdkPixbufFormat; } +#endif + +namespace Gdk +{ + +class PixbufFormat +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef PixbufFormat CppObjectType; + typedef GdkPixbufFormat BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +public: + PixbufFormat(); + explicit PixbufFormat(const GdkPixbufFormat* gobject); + virtual ~PixbufFormat(); + + PixbufFormat(const PixbufFormat& src); + PixbufFormat& operator=(const PixbufFormat& src); + + + /** Returns the name of the format. + * @return The name of the format. + * + * Since: 2.2. + */ + Glib::ustring get_name() const; + + /** Returns a description of the format. + * @return A description of the format. + * + * Since: 2.2. + */ + Glib::ustring get_description() const; + + /** Returns the mime types supported by the format. + * @return A <tt>0</tt>-terminated array of mime types which must be freed with + * Glib::strfreev() when it is no longer needed. + * + * Since: 2.2. + */ + Glib::StringArrayHandle get_mime_types() const; + + /** Returns the filename extensions typically used for files in the + * given format. + * @return A <tt>0</tt>-terminated array of filename extensions which must be + * freed with Glib::strfreev() when it is no longer needed. + * + * Since: 2.2. + */ + Glib::StringArrayHandle get_extensions() const; + + /** Returns whether pixbufs can be saved in the given format. + * @return Whether pixbufs can be saved in the given format. + * + * Since: 2.2. + */ + bool is_writable() const; + + + /** Returns whether this image format is scalable. If a file is in a + * scalable format, it is preferable to load it at the desired size, + * rather than loading it at the default size and scaling the + * resulting pixbuf to the desired size. + * @return Whether this image format is scalable. + * + * Since: 2.6. + */ + bool is_scalable() const; + + /** Returns whether this image format is disabled. See + * gdk_pixbuf_format_set_disabled(). + * @return Whether this image format is disabled. + * + * Since: 2.6. + */ + bool is_disabled() const; + + /** Disables or enables an image format. If a format is disabled, + * gdk-pixbuf won't use the image loader for this format to load + * images. Applications can use this to avoid using image loaders + * with an inappropriate license, see gdk_pixbuf_format_get_license(). + * + * Since: 2.6 + * @param disabled <tt>true</tt> to disable the format @a format . + */ + void set_disabled(bool disabled = true); + + /** Returns information about the license of the image loader + * for the format. The returned string should be a shorthand for + * a wellknown license, e.g. "LGPL", "GPL", "QPL", "GPL/QPL", + * or "other" to indicate some other license. + * @return A string describing the license of @a format . + * + * Since: 2.6. + */ + Glib::ustring get_license() const; + + /// Provides access to the underlying C GObject. + GdkPixbufFormat* gobj() { return const_cast<GdkPixbufFormat*>(gobject_); } + /// Provides access to the underlying C GObject. + const GdkPixbufFormat* gobj() const { return gobject_; } + +protected: + const GdkPixbufFormat* gobject_; + + +}; + +} // namespace Gdk + + +#endif /* _GDKMM_PIXBUFFORMAT_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/pixbufloader.cc b/libs/gtkmm2/gdk/gdkmm/pixbufloader.cc new file mode 100644 index 0000000000..41af07e520 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbufloader.cc @@ -0,0 +1,465 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/pixbufloader.h> +#include <gdkmm/private/pixbufloader_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdk/gdkcolor.h> +#include <gdk-pixbuf/gdk-pixbuf.h> + + +namespace +{ + +/* We use this helper function in the constructor to be able to throw + * before the base class' (Glib::Object) constructor is called. + */ +GdkPixbufLoader* pixbuf_loader_create_with_type(const Glib::ustring& image_type, bool mime_type) +{ + GError* error = 0; + GdkPixbufLoader *const loader = 0; + + if(mime_type) + gdk_pixbuf_loader_new_with_mime_type(image_type.c_str(), &error); + else + gdk_pixbuf_loader_new_with_type(image_type.c_str(), &error); + + if(error) + Glib::Error::throw_exception(error); + + return loader; +} + +} // anonymous namespace + + +namespace Gdk +{ + +PixbufLoader::PixbufLoader(const Glib::ustring& image_type, bool mime_type) +: + Glib::ObjectBase(0), + Glib::Object((GObject*) pixbuf_loader_create_with_type(image_type, mime_type)) +{} + +void PixbufLoader::write(const guint8* buf, gsize count) +{ + GError* error = 0; + gdk_pixbuf_loader_write(gobj(), buf, count, &error); + + if(error) + Glib::Error::throw_exception(error); +} + +void PixbufLoader::close() +{ + GError* error = 0; + gdk_pixbuf_loader_close(gobj(), &error); + + if(error) + Glib::Error::throw_exception(error); +} + +} // namespace Gdk + + +namespace +{ + +const Glib::SignalProxyInfo PixbufLoader_signal_area_prepared_info = +{ + "area_prepared", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +void PixbufLoader_signal_area_updated_callback(GdkPixbufLoader* self, gint p0,gint p1,gint p2,gint p3,void* data) +{ + using namespace Gdk; + typedef sigc::slot< void,int,int,int,int > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast<SlotType*>(slot))(p0 +, p1 +, p2 +, p3 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo PixbufLoader_signal_area_updated_info = +{ + "area_updated", + (GCallback) &PixbufLoader_signal_area_updated_callback, + (GCallback) &PixbufLoader_signal_area_updated_callback +}; + + +const Glib::SignalProxyInfo PixbufLoader_signal_closed_info = +{ + "closed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +void PixbufLoader_signal_size_prepared_callback(GdkPixbufLoader* self, gint p0,gint p1,void* data) +{ + using namespace Gdk; + typedef sigc::slot< void,int,int > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast<SlotType*>(slot))(p0 +, p1 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo PixbufLoader_signal_size_prepared_info = +{ + "size_prepared", + (GCallback) &PixbufLoader_signal_size_prepared_callback, + (GCallback) &PixbufLoader_signal_size_prepared_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr<Gdk::PixbufLoader> wrap(GdkPixbufLoader* object, bool take_copy) +{ + return Glib::RefPtr<Gdk::PixbufLoader>( dynamic_cast<Gdk::PixbufLoader*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& PixbufLoader_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &PixbufLoader_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_pixbuf_loader_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void PixbufLoader_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->area_prepared = &area_prepared_callback; + klass->area_updated = &area_updated_callback; + klass->closed = &closed_callback; +} + + +void PixbufLoader_Class::area_prepared_callback(GdkPixbufLoader* self) +{ + CppObjectType *const obj = dynamic_cast<CppObjectType*>( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_area_prepared(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast<BaseClassType*>( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->area_prepared) + (*base->area_prepared)(self); + } +} + +void PixbufLoader_Class::area_updated_callback(GdkPixbufLoader* self, gint p0, gint p1, gint p2, gint p3) +{ + CppObjectType *const obj = dynamic_cast<CppObjectType*>( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_area_updated(p0 +, p1 +, p2 +, p3 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast<BaseClassType*>( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->area_updated) + (*base->area_updated)(self, p0, p1, p2, p3); + } +} + +void PixbufLoader_Class::closed_callback(GdkPixbufLoader* self) +{ + CppObjectType *const obj = dynamic_cast<CppObjectType*>( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_closed(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast<BaseClassType*>( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->closed) + (*base->closed)(self); + } +} + + +Glib::ObjectBase* PixbufLoader_Class::wrap_new(GObject* object) +{ + return new PixbufLoader((GdkPixbufLoader*)object); +} + + +/* The implementation: */ + +GdkPixbufLoader* PixbufLoader::gobj_copy() +{ + reference(); + return gobj(); +} + +PixbufLoader::PixbufLoader(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +PixbufLoader::PixbufLoader(GdkPixbufLoader* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +PixbufLoader::~PixbufLoader() +{} + + +PixbufLoader::CppClassType PixbufLoader::pixbufloader_class_; // initialize static member + +GType PixbufLoader::get_type() +{ + return pixbufloader_class_.init().get_type(); +} + +GType PixbufLoader::get_base_type() +{ + return gdk_pixbuf_loader_get_type(); +} + + +PixbufLoader::PixbufLoader() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(pixbufloader_class_.init())) +{ + } + +Glib::RefPtr<PixbufLoader> PixbufLoader::create() +{ + return Glib::RefPtr<PixbufLoader>( new PixbufLoader() ); +} +Glib::RefPtr<PixbufLoader> PixbufLoader::create(const Glib::ustring& image_type, bool mime_type) +{ + return Glib::RefPtr<PixbufLoader>( new PixbufLoader(image_type, mime_type) ); +} +void PixbufLoader::set_size(int width, int height) +{ + gdk_pixbuf_loader_set_size(gobj(), width, height); +} + +Glib::RefPtr<Gdk::Pixbuf> PixbufLoader::get_pixbuf() +{ + + Glib::RefPtr<Gdk::Pixbuf> retvalue = Glib::wrap(gdk_pixbuf_loader_get_pixbuf(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Gdk::PixbufAnimation> PixbufLoader::get_animation() +{ + + Glib::RefPtr<Gdk::PixbufAnimation> retvalue = Glib::wrap(gdk_pixbuf_loader_get_animation(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +PixbufFormat PixbufLoader::get_format() const +{ + return PixbufFormat(gdk_pixbuf_loader_get_format(const_cast<GdkPixbufLoader*>(gobj()))); +} + + +Glib::SignalProxy0< void > PixbufLoader::signal_area_prepared() +{ + return Glib::SignalProxy0< void >(this, &PixbufLoader_signal_area_prepared_info); +} + +Glib::SignalProxy4< void,int,int,int,int > PixbufLoader::signal_area_updated() +{ + return Glib::SignalProxy4< void,int,int,int,int >(this, &PixbufLoader_signal_area_updated_info); +} + +Glib::SignalProxy0< void > PixbufLoader::signal_closed() +{ + return Glib::SignalProxy0< void >(this, &PixbufLoader_signal_closed_info); +} + +Glib::SignalProxy2< void,int,int > PixbufLoader::signal_size_prepared() +{ + return Glib::SignalProxy2< void,int,int >(this, &PixbufLoader_signal_size_prepared_info); +} + + +void Gdk::PixbufLoader::on_area_prepared() +{ + BaseClassType *const base = static_cast<BaseClassType*>( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->area_prepared) + (*base->area_prepared)(gobj()); +} + +void Gdk::PixbufLoader::on_area_updated(int x, int y, int width, int height) +{ + BaseClassType *const base = static_cast<BaseClassType*>( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->area_updated) + (*base->area_updated)(gobj(),x,y,width,height); +} + +void Gdk::PixbufLoader::on_closed() +{ + BaseClassType *const base = static_cast<BaseClassType*>( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->closed) + (*base->closed)(gobj()); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/pixbufloader.h b/libs/gtkmm2/gdk/gdkmm/pixbufloader.h new file mode 100644 index 0000000000..c89288740f --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbufloader.h @@ -0,0 +1,269 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUFLOADER_H +#define _GDKMM_PIXBUFLOADER_H + +#include <glibmm.h> + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <glibmm/object.h> +#include <gdkmm/pixbuf.h> +#include <gdkmm/pixbufanimation.h> +#include <gdkmm/pixbufformat.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkPixbufLoader GdkPixbufLoader; +typedef struct _GdkPixbufLoaderClass GdkPixbufLoaderClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class PixbufLoader_Class; } // namespace Gdk +namespace Gdk +{ + + +class PixbufLoader : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef PixbufLoader CppObjectType; + typedef PixbufLoader_Class CppClassType; + typedef GdkPixbufLoader BaseObjectType; + typedef GdkPixbufLoaderClass BaseClassType; + +private: friend class PixbufLoader_Class; + static CppClassType pixbufloader_class_; + +private: + // noncopyable + PixbufLoader(const PixbufLoader&); + PixbufLoader& operator=(const PixbufLoader&); + +protected: + explicit PixbufLoader(const Glib::ConstructParams& construct_params); + explicit PixbufLoader(GdkPixbufLoader* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~PixbufLoader(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkPixbufLoader* gobj() { return reinterpret_cast<GdkPixbufLoader*>(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkPixbufLoader* gobj() const { return reinterpret_cast<GdkPixbufLoader*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkPixbufLoader* gobj_copy(); + +private: + +protected: + + /** Constructs a pixbuf loader object. + */ + PixbufLoader(); + + /** Constructs a pixbuf loader object for a specific image type. + * Constructs a new pixbuf loader object that always attempts to parse image + * data as if it were an image of type @a image_type, instead of identifying + * the type automatically. Useful if you want an error if the image isn't the + * expected type, for loading image formats that can't be reliably identified + * by looking at the data, or if the user manually forces a specific type. + * + * The image_type can be one of the types returned by Gdk::Pixbuf::get_formats(), or a MIME type. + * + * Common MIME Types are listed here + * http://www.iana.org/assignments/media-types/ + * and here: + * http://www.freedesktop.org/Software/shared-mime-info + * + * @param image_type Name of the image format to be loaded with the image. + * @param mime_type If this is true then the image_type is a MIME type. + * @throw Gdk::PixbufError + */ + explicit PixbufLoader(const Glib::ustring& image_type, bool mime_type = false); + //TODO: What non-mime-types names are possible? + +public: + + /** Creates a new pixbuf loader object. + * @return A newly-created pixbuf loader. + */ + + static Glib::RefPtr<PixbufLoader> create(); + + + /** Constructs a pixbuf loader object for a specific image type. + * Constructs a new pixbuf loader object that always attempts to parse image + * data as if it were an image of type @a image_type, instead of identifying + * the type automatically. Useful if you want an error if the image isn't the + * expected type, for loading image formats that can't be reliably identified + * by looking at the data, or if the user manually forces a specific type. + * + * The image_type can be one of the types returned by Gdk::Pixbuf::get_formats(), or a MIME type. + * + * Common MIME Types are listed here + * http://www.iana.org/assignments/media-types/ + * and here: + * http://www.freedesktop.org/Software/shared-mime-info + * + * @param image_type Name of the image format to be loaded with the image. + * @param mime_type If this is true then the image_type is a MIME type. + * @throw Gdk::PixbufError + */ + + static Glib::RefPtr<PixbufLoader> create(const Glib::ustring& image_type, bool mime_type = false); + + + /** Causes the image to be scaled while it is loaded. The desired + * image size can be determined relative to the original size of + * the image by calling set_size() from a + * signal handler for the ::size_prepared signal. + * + * Attempts to set the desired image size are ignored after the + * emission of the ::size_prepared signal. + * + * Since: 2.2 + * @param width The desired width of the image being loaded. + * @param height The desired height of the image being loaded. + */ + void set_size(int width, int height); + + /** Causes the pixbuf loader to parse the next @a count bytes of an image. + * It will return if the data was loaded successfully, and throw an exception + * if an error occurred. In the latter case, the loader will be closed, and + * will not accept further writes. + * @param buf Pointer to image data. + * @param count Length of the @a buf buffer in bytes. + * @throw Gdk::PixbufError + * @throw Glib::FileError + */ + void write(const guint8* buf, gsize count); + + + /** Informs a pixbuf loader that no further writes with PixbufLoader::write() + * will occur, so that it can free its internal loading structures. Also, + * tries to parse any data that hasn't yet been parsed; if the remaining data + * is partial or corrupt, an exception will be thrown. If you're just + * cancelling a load rather than expecting it to be finished, writing an + * empty <tt>catch()</tt> block to ignore errors is reasonable. + * @throw Gdk::PixbufError + * @throw Glib::FileError + */ + void close(); + + + /** Queries the Gdk::Pixbuf that a pixbuf loader is currently creating. + * In general it only makes sense to call this function after the + * "area_prepared" signal has been emitted by the loader; this means + * that enough data has been read to know the size of the image that + * will be allocated. If the loader has not received enough data via + * write(), then this function returns <tt>0</tt>. The + * returned pixbuf will be the same in all future calls to the loader, + * so simply calling Glib::object_ref() should be sufficient to continue + * using it. Additionally, if the loader is an animation, it will + * return the "static image" of the animation + * (see Gdk::PixbufAnimation::get_static_image()). + * @return The Gdk::Pixbuf that the loader is creating, or <tt>0</tt> if not + * enough data has been read to determine how to create the image buffer. + */ + Glib::RefPtr<Gdk::Pixbuf> get_pixbuf(); + + /** Queries the Gdk::PixbufAnimation that a pixbuf loader is currently creating. + * In general it only makes sense to call this function after the "area_prepared" + * signal has been emitted by the loader. If the loader doesn't have enough + * bytes yet (hasn't emitted the "area_prepared" signal) this function will + * return <tt>0</tt>. + * @return The Gdk::PixbufAnimation that the loader is loading, or <tt>0</tt> if + * not enough data has been read to determine the information. + */ + Glib::RefPtr<Gdk::PixbufAnimation> get_animation(); + + + /** Obtains the available information about the format of the + * currently loading image file. + * @return A Gdk::PixbufFormat or <tt>0</tt>. The return value is owned + * by GdkPixbuf and should not be freed. + * + * Since: 2.2. + */ + PixbufFormat get_format() const; + + + Glib::SignalProxy0< void > signal_area_prepared(); + + + Glib::SignalProxy4< void,int,int,int,int > signal_area_updated(); + + + Glib::SignalProxy0< void > signal_closed(); + + + //We use no_default_handler for this, because we can not add a new vfunc to 2.5 without breaking ABI. + //TODO: Remove no_default_handler when we do an ABI-break-with-parallel-install. + + + Glib::SignalProxy2< void,int,int > signal_size_prepared(); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_area_prepared(); + virtual void on_area_updated(int x, int y, int width, int height); + virtual void on_closed(); + + +}; + +} // namespace Gdk + + +namespace Glib +{ + /** @relates Gdk::PixbufLoader + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Gdk::PixbufLoader> wrap(GdkPixbufLoader* object, bool take_copy = false); +} + + +#endif /* _GDKMM_PIXBUFLOADER_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/pixmap.cc b/libs/gtkmm2/gdk/gdkmm/pixmap.cc new file mode 100644 index 0000000000..a64cfb6aed --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixmap.cc @@ -0,0 +1,320 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/pixmap.h> +#include <gdkmm/private/pixmap_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdkmm/window.h> +#include <gdkmm/display.h> +#include <gdk/gdkpixmap.h> + + +namespace Gdk +{ + +Glib::ObjectBase* Pixmap_Class::wrap_new(GObject* object) +{ + GdkPixmapObject *const pixmap_object = GDK_PIXMAP_OBJECT(object); + + g_return_val_if_fail(pixmap_object != 0, 0); + + // GdkPixmap and GdkBitmap are actually both of type GdkPixmapObject. + // A Bitmap is is a Pixmap with a depth of 1. Since these are distinct + // types in gtkmm, we dynamically create either a Pixmap or a Bitmap, + // depending on the depth field. + + if(pixmap_object->depth != 1) + return new Gdk::Pixmap((GdkPixmap*) pixmap_object); + else + return new Gdk::Bitmap((GdkBitmap*) pixmap_object); +} + + +Pixmap::Pixmap(const Glib::RefPtr<Drawable>& drawable, int width, int height, int depth) +: + Drawable((GdkDrawable*) gdk_pixmap_new(Glib::unwrap(drawable), width, height, depth)) +{ + //gdk_pixmap_new() is implemented differently for x11, win32, etc, + //so we can't really derived a new GType for GdkPixmap. +} + +Pixmap::Pixmap(const Glib::RefPtr<Drawable>& drawable, const char* data, int width, int height, int depth, + const Color& fg, const Color& bg) +: + Drawable((GdkDrawable*) gdk_pixmap_create_from_data( + Glib::unwrap(drawable), data, width, height, depth, + const_cast<GdkColor*>(fg.gobj()), const_cast<GdkColor*>(bg.gobj()))) +{ + //gdk_pixmap_new() is implemented differently for x11, win32, etc, + //so we can't really derived a new GType for GdkPixmap. +} + +Pixmap::Pixmap(const Glib::RefPtr<Display>& display, NativeWindow anid) +: + Drawable( (GdkDrawable*) gdk_pixmap_foreign_new_for_display(display->gobj(), anid) ) +{ + //gdk_pixmap_new() is implemented differently for x11, win32, etc, + //so we can't really derived a new GType for GdkPixmap. +} + +Glib::RefPtr<Pixmap> Pixmap::create_from_data(const Glib::RefPtr<const Drawable>& drawable, + const char* data, int width, int height, int depth, + const Color& fg, const Color& bg) +{ + GdkPixmap *const pixmap = gdk_pixmap_create_from_data( + const_cast<GdkDrawable*>(Glib::unwrap<Drawable>(drawable)), + const_cast<char*>(data), width, height, depth, + const_cast<GdkColor*>(fg.gobj()), + const_cast<GdkColor*>(bg.gobj())); + + return Glib::wrap((GdkPixmapObject*) pixmap); +} + + +Glib::RefPtr<Pixmap> Pixmap::create_from_xpm(const Glib::RefPtr<const Drawable>& drawable, + const Color& transparent_color, + const std::string& filename) +{ + GdkPixmap *const pixmap = gdk_pixmap_create_from_xpm( + const_cast<GdkDrawable*>(Glib::unwrap<Drawable>(drawable)), 0, + const_cast<GdkColor*>(transparent_color.gobj()), + const_cast<char*>(filename.c_str())); + + return Glib::wrap((GdkPixmapObject*) pixmap); +} + +Glib::RefPtr<Pixmap> Pixmap::create_from_xpm(const Glib::RefPtr<const Drawable>& drawable, + Glib::RefPtr<Bitmap>& mask, + const Color& transparent_color, + const std::string& filename) +{ + GdkBitmap* bitmap = 0; + + GdkPixmap *const pixmap = gdk_pixmap_create_from_xpm( + const_cast<GdkDrawable*>(Glib::unwrap<Drawable>(drawable)), &bitmap, + const_cast<GdkColor*>(transparent_color.gobj()), + const_cast<char*>(filename.c_str())); + + mask = Glib::RefPtr<Bitmap>::cast_dynamic(Glib::wrap((GdkPixmapObject*) bitmap)); + return Glib::wrap((GdkPixmapObject*) pixmap); +} + +Glib::RefPtr<Pixmap> Pixmap::create_from_xpm(const Glib::RefPtr<const Drawable>& drawable, + const Glib::RefPtr<Colormap>& colormap, + Glib::RefPtr<Bitmap>& mask, + const Color& transparent_color, + const std::string& filename) +{ + GdkBitmap* bitmap = 0; + + GdkPixmap *const pixmap = gdk_pixmap_colormap_create_from_xpm( + const_cast<GdkDrawable*>(Glib::unwrap<Drawable>(drawable)), + Glib::unwrap(colormap), &bitmap, + const_cast<GdkColor*>(transparent_color.gobj()), + const_cast<char*>(filename.c_str())); + + mask = Glib::RefPtr<Bitmap>::cast_dynamic(Glib::wrap((GdkPixmapObject*) bitmap)); + return Glib::wrap((GdkPixmapObject*) pixmap); +} + + +Glib::RefPtr<Pixmap> Pixmap::create_from_xpm(const Glib::RefPtr<const Drawable>& drawable, + Glib::RefPtr<Bitmap>& mask, + const Color& transparent_color, + const char* const* data) +{ + GdkBitmap* bitmap = 0; + + GdkPixmap *const pixmap = gdk_pixmap_create_from_xpm_d( + const_cast<GdkDrawable*>(Glib::unwrap<Drawable>(drawable)), + &bitmap, + const_cast<GdkColor*>(transparent_color.gobj()), + const_cast<char**>(data)); + + mask = Glib::RefPtr<Bitmap>::cast_dynamic(Glib::wrap((GdkPixmapObject*) bitmap)); + return Glib::wrap((GdkPixmapObject*) pixmap); +} + +Glib::RefPtr<Pixmap> Pixmap::create_from_xpm(const Glib::RefPtr<const Drawable>& drawable, + const Glib::RefPtr<Colormap>& colormap, + Glib::RefPtr<Bitmap>& mask, + const Color& transparent_color, + const char* const* data) +{ + GdkBitmap* bitmap = 0; + + GdkPixmap *const pixmap = gdk_pixmap_colormap_create_from_xpm_d( + const_cast<GdkDrawable*>(Glib::unwrap<Drawable>(drawable)), + Glib::unwrap(colormap), &bitmap, + const_cast<GdkColor*>(transparent_color.gobj()), + const_cast<char**>(data)); + + mask = Glib::RefPtr<Bitmap>::cast_dynamic(Glib::wrap((GdkPixmapObject*) bitmap)); + return Glib::wrap((GdkPixmapObject*) pixmap); +} + +Glib::RefPtr<Pixmap> Pixmap::create_from_xpm(const Glib::RefPtr<Colormap>& colormap, + Glib::RefPtr<Bitmap>& mask, + const Color& transparent_color, + const char* const* data) +{ + GdkBitmap* bitmap = 0; + + GdkPixmap *const pixmap = gdk_pixmap_colormap_create_from_xpm_d( + 0, // drawable + Glib::unwrap(colormap), &bitmap, + const_cast<GdkColor*>(transparent_color.gobj()), + const_cast<char**>(data)); + + mask = Glib::RefPtr<Bitmap>::cast_dynamic(Glib::wrap((GdkPixmapObject*) bitmap)); + return Glib::wrap((GdkPixmapObject*) pixmap); +} + +Glib::RefPtr<Pixmap> Pixmap::create_from_xpm(const Glib::RefPtr<Colormap>& colormap, + Glib::RefPtr<Bitmap>& mask, + const char* const* data) +{ + GdkBitmap* bitmap = 0; + + GdkPixmap *const pixmap = gdk_pixmap_colormap_create_from_xpm_d( + 0, // drawable + Glib::unwrap(colormap), &bitmap, + 0, // transparent_color + const_cast<char**>(data)); + + mask = Glib::RefPtr<Bitmap>::cast_dynamic(Glib::wrap((GdkPixmapObject*) bitmap)); + return Glib::wrap((GdkPixmapObject*) pixmap); +} + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr<Gdk::Pixmap> wrap(GdkPixmapObject* object, bool take_copy) +{ + return Glib::RefPtr<Gdk::Pixmap>( dynamic_cast<Gdk::Pixmap*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Pixmap_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Pixmap_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_pixmap_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Pixmap_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +/* The implementation: */ + +GdkPixmap* Pixmap::gobj_copy() +{ + reference(); + return gobj(); +} + +Pixmap::Pixmap(const Glib::ConstructParams& construct_params) +: + Gdk::Drawable(construct_params) +{} + +Pixmap::Pixmap(GdkPixmap* castitem) +: + Gdk::Drawable((GdkDrawable*)(castitem)) +{} + +Pixmap::~Pixmap() +{} + + +Pixmap::CppClassType Pixmap::pixmap_class_; // initialize static member + +GType Pixmap::get_type() +{ + return pixmap_class_.init().get_type(); +} + +GType Pixmap::get_base_type() +{ + return gdk_pixmap_get_type(); +} + + +Pixmap::Pixmap() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gdk::Drawable(Glib::ConstructParams(pixmap_class_.init())) +{ + } + +Glib::RefPtr<Pixmap> Pixmap::create(const Glib::RefPtr<Drawable>& drawable, int width, int height, int depth) +{ + return Glib::RefPtr<Pixmap>( new Pixmap(drawable, width, height, depth) ); +} +Glib::RefPtr<Pixmap> Pixmap::create(const Glib::RefPtr<Drawable>& drawable, const char* data, int width, int height, int depth, const Color& fg, const Color& bg) +{ + return Glib::RefPtr<Pixmap>( new Pixmap(drawable, data, width, height, depth, fg, bg) ); +} +Glib::RefPtr<Pixmap> Pixmap::create(const Glib::RefPtr<Display>& display, NativeWindow anid) +{ + return Glib::RefPtr<Pixmap>( new Pixmap(display, anid) ); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/pixmap.h b/libs/gtkmm2/gdk/gdkmm/pixmap.h new file mode 100644 index 0000000000..6a7a1d978d --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixmap.h @@ -0,0 +1,202 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXMAP_H +#define _GDKMM_PIXMAP_H + +#include <glibmm.h> + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdkmm/drawable.h> +#include <gdkmm/color.h> +#include <gdkmm/colormap.h> +#include <gdkmm/types.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { +//Custom stuct prototypes, because they aren't what the code-generator expects: +typedef struct _GdkDrawable GdkPixmap; +typedef struct _GdkPixmapClass GdkPixmapClass; +} // extern "C" +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Pixmap_Class; } // namespace Gdk +namespace Gdk +{ + +class Window; + +/** Pixmaps are offscreen drawables. They can be drawn upon with the standard drawing primitives, then copied to another + * drawable (such as a Gdk::Window) with Gdk::Drawable::draw_drawable(). The depth of a pixmap is the number of bits per + * pixels. + * Bitmaps are simply pixmaps with a depth of 1. (That is, they are monochrome bitmaps - each pixel can be either on or off). + */ + +class Pixmap : public Gdk::Drawable +{ + // GdkPixmap is a typedef to GdkDrawable, but it's actually a GdkPixmapObject. + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Pixmap CppObjectType; + typedef Pixmap_Class CppClassType; + typedef GdkPixmap BaseObjectType; + typedef GdkPixmapObjectClass BaseClassType; + +private: friend class Pixmap_Class; + static CppClassType pixmap_class_; + +private: + // noncopyable + Pixmap(const Pixmap&); + Pixmap& operator=(const Pixmap&); + +protected: + explicit Pixmap(const Glib::ConstructParams& construct_params); + explicit Pixmap(GdkPixmap* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Pixmap(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkPixmap* gobj() { return reinterpret_cast<GdkPixmap*>(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkPixmap* gobj() const { return reinterpret_cast<GdkPixmap*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkPixmap* gobj_copy(); + +private: + + // see wrap_new() implementation in pixmap.ccg + + +protected: + Pixmap(); + + Pixmap(const Glib::RefPtr<Drawable>& drawable, int width, int height, int depth = -1); + + /// Initialize a Pixmap from data. + Pixmap(const Glib::RefPtr<Drawable>& drawable, + const char* data, int width, int height, int depth, + const Color& fg, const Color& bg); + + Pixmap(const Glib::RefPtr<Display>& display, NativeWindow anid); + +public: + + + static Glib::RefPtr<Pixmap> create(const Glib::RefPtr<Drawable>& drawable, int width, int height, int depth = -1); + + + static Glib::RefPtr<Pixmap> create(const Glib::RefPtr<Drawable>& drawable, const char* data, int width, int height, int depth, const Color& fg, const Color& bg); + + + static Glib::RefPtr<Pixmap> create(const Glib::RefPtr<Display>& display, NativeWindow anid); + + + static Glib::RefPtr<Pixmap> create_from_data(const Glib::RefPtr<const Drawable>& drawable, + const char* data, int width, int height, int depth, + const Color& fg, const Color& bg); + + /// Create a Pixmap from a xpm file. + static Glib::RefPtr<Pixmap> create_from_xpm(const Glib::RefPtr<const Drawable>& drawable, + const Color& transparent_color, + const std::string& filename); + + // Create a Pixmap from a xpm file. + static Glib::RefPtr<Pixmap> create_from_xpm(const Glib::RefPtr<const Drawable>& drawable, + Glib::RefPtr<Bitmap>& mask, + const Color& transparent_color, + const std::string& filename); + + /// Create a Pixmap from a xpm file with colormap. + static Glib::RefPtr<Pixmap> create_from_xpm(const Glib::RefPtr<const Drawable>& drawable, + const Glib::RefPtr<Colormap>& colormap, + Glib::RefPtr<Bitmap>& mask, + const Color& transparent_color, + const std::string& filename); + + static Glib::RefPtr<Pixmap> create_from_xpm(const Glib::RefPtr<const Drawable>& drawable, + Glib::RefPtr<Bitmap>& mask, + const Color& transparent_color, + const char* const* data); + + static Glib::RefPtr<Pixmap> create_from_xpm(const Glib::RefPtr<const Drawable>& drawable, + const Glib::RefPtr<Colormap>& colormap, + Glib::RefPtr<Bitmap>& mask, + const Color& transparent_color, + const char* const* data); + + static Glib::RefPtr<Pixmap> create_from_xpm(const Glib::RefPtr<Colormap>& colormap, + Glib::RefPtr<Bitmap>& mask, + const Color& transparent_color, + const char* const* data); + + static Glib::RefPtr<Pixmap> create_from_xpm(const Glib::RefPtr<Colormap>& colormap, + Glib::RefPtr<Bitmap>& mask, + const char* const* data); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Gdk + + +namespace Glib +{ + /** @relates Gdk::Pixmap + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Gdk::Pixmap> wrap(GdkPixmapObject* object, bool take_copy = false); +} + + +#endif /* _GDKMM_PIXMAP_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/bitmap_p.h b/libs/gtkmm2/gdk/gdkmm/private/bitmap_p.h new file mode 100644 index 0000000000..13a2e31932 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/bitmap_p.h @@ -0,0 +1,7 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_BITMAP_P_H +#define _GDKMM_BITMAP_P_H +#include <gdkmm/private/pixmap_p.h> +#endif /* _GDKMM_BITMAP_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/color_p.h b/libs/gtkmm2/gdk/gdkmm/private/color_p.h new file mode 100644 index 0000000000..10e8370c05 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/color_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_COLOR_P_H +#define _GDKMM_COLOR_P_H +#endif /* _GDKMM_COLOR_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/colormap_p.h b/libs/gtkmm2/gdk/gdkmm/private/colormap_p.h new file mode 100644 index 0000000000..3ceb776d16 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/colormap_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_COLORMAP_P_H +#define _GDKMM_COLORMAP_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Gdk +{ + +class Colormap_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Colormap CppObjectType; + typedef GdkColormap BaseObjectType; + typedef GdkColormapClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Colormap; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_COLORMAP_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/cursor_p.h b/libs/gtkmm2/gdk/gdkmm/private/cursor_p.h new file mode 100644 index 0000000000..5400e45e0a --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/cursor_p.h @@ -0,0 +1,7 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_CURSOR_P_H +#define _GDKMM_CURSOR_P_H +#include <glibmm/private/object_p.h> +#endif /* _GDKMM_CURSOR_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/device_p.h b/libs/gtkmm2/gdk/gdkmm/private/device_p.h new file mode 100644 index 0000000000..f19b9c8ccd --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/device_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DEVICE_P_H +#define _GDKMM_DEVICE_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Gdk +{ + +class Device_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Device CppObjectType; + typedef GdkDevice BaseObjectType; + typedef GdkDeviceClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Device; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_DEVICE_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/display_p.h b/libs/gtkmm2/gdk/gdkmm/private/display_p.h new file mode 100644 index 0000000000..0b5ba089e0 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/display_p.h @@ -0,0 +1,45 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DISPLAY_P_H +#define _GDKMM_DISPLAY_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Gdk +{ + +class Display_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Display CppObjectType; + typedef GdkDisplay BaseObjectType; + typedef GdkDisplayClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Display; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + static void closed_callback(GdkDisplay* self, gboolean p0); + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_DISPLAY_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/displaymanager_p.h b/libs/gtkmm2/gdk/gdkmm/private/displaymanager_p.h new file mode 100644 index 0000000000..25ff018c44 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/displaymanager_p.h @@ -0,0 +1,45 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DISPLAYMANAGER_P_H +#define _GDKMM_DISPLAYMANAGER_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Gdk +{ + +class DisplayManager_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef DisplayManager CppObjectType; + typedef GdkDisplayManager BaseObjectType; + typedef GdkDisplayManagerClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class DisplayManager; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + static void display_opened_callback(GdkDisplayManager* self, GdkDisplay* p0); + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_DISPLAYMANAGER_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/dragcontext_p.h b/libs/gtkmm2/gdk/gdkmm/private/dragcontext_p.h new file mode 100644 index 0000000000..13dfd57ccc --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/dragcontext_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DRAGCONTEXT_P_H +#define _GDKMM_DRAGCONTEXT_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Gdk +{ + +class DragContext_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef DragContext CppObjectType; + typedef GdkDragContext BaseObjectType; + typedef GdkDragContextClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class DragContext; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_DRAGCONTEXT_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/drawable_p.h b/libs/gtkmm2/gdk/gdkmm/private/drawable_p.h new file mode 100644 index 0000000000..59e22d083e --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/drawable_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DRAWABLE_P_H +#define _GDKMM_DRAWABLE_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Gdk +{ + +class Drawable_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Drawable CppObjectType; + typedef GdkDrawable BaseObjectType; + typedef GdkDrawableClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Drawable; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_DRAWABLE_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/event_p.h b/libs/gtkmm2/gdk/gdkmm/private/event_p.h new file mode 100644 index 0000000000..999db9b7fc --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/event_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_EVENT_P_H +#define _GDKMM_EVENT_P_H +#endif /* _GDKMM_EVENT_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/gc_p.h b/libs/gtkmm2/gdk/gdkmm/private/gc_p.h new file mode 100644 index 0000000000..82725a3a1a --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/gc_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_GC_P_H +#define _GDKMM_GC_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Gdk +{ + +class GC_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef GC CppObjectType; + typedef GdkGC BaseObjectType; + typedef GdkGCClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class GC; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_GC_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/image_p.h b/libs/gtkmm2/gdk/gdkmm/private/image_p.h new file mode 100644 index 0000000000..2b6fe88d3d --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/image_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_IMAGE_P_H +#define _GDKMM_IMAGE_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Gdk +{ + +class Image_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Image CppObjectType; + typedef GdkImage BaseObjectType; + typedef GdkImageClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Image; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_IMAGE_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/pixbuf_p.h b/libs/gtkmm2/gdk/gdkmm/private/pixbuf_p.h new file mode 100644 index 0000000000..659bd0d8d7 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/pixbuf_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUF_P_H +#define _GDKMM_PIXBUF_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Gdk +{ + +class Pixbuf_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Pixbuf CppObjectType; + typedef GdkPixbuf BaseObjectType; + typedef GdkPixbufClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Pixbuf; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_PIXBUF_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/pixbufanimation_p.h b/libs/gtkmm2/gdk/gdkmm/private/pixbufanimation_p.h new file mode 100644 index 0000000000..ca03e440c2 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/pixbufanimation_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUFANIMATION_P_H +#define _GDKMM_PIXBUFANIMATION_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Gdk +{ + +class PixbufAnimation_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef PixbufAnimation CppObjectType; + typedef GdkPixbufAnimation BaseObjectType; + typedef GdkPixbufAnimationClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class PixbufAnimation; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_PIXBUFANIMATION_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/pixbufanimationiter_p.h b/libs/gtkmm2/gdk/gdkmm/private/pixbufanimationiter_p.h new file mode 100644 index 0000000000..f7de22ffd8 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/pixbufanimationiter_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUFANIMATIONITER_P_H +#define _GDKMM_PIXBUFANIMATIONITER_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Gdk +{ + +class PixbufAnimationIter_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef PixbufAnimationIter CppObjectType; + typedef GdkPixbufAnimationIter BaseObjectType; + typedef GdkPixbufAnimationIterClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class PixbufAnimationIter; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_PIXBUFANIMATIONITER_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/pixbufformat_p.h b/libs/gtkmm2/gdk/gdkmm/private/pixbufformat_p.h new file mode 100644 index 0000000000..6a0b196620 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/pixbufformat_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUFFORMAT_P_H +#define _GDKMM_PIXBUFFORMAT_P_H +#endif /* _GDKMM_PIXBUFFORMAT_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/pixbufloader_p.h b/libs/gtkmm2/gdk/gdkmm/private/pixbufloader_p.h new file mode 100644 index 0000000000..7bceceef72 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/pixbufloader_p.h @@ -0,0 +1,47 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUFLOADER_P_H +#define _GDKMM_PIXBUFLOADER_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Gdk +{ + +class PixbufLoader_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef PixbufLoader CppObjectType; + typedef GdkPixbufLoader BaseObjectType; + typedef GdkPixbufLoaderClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class PixbufLoader; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + static void area_prepared_callback(GdkPixbufLoader* self); + static void area_updated_callback(GdkPixbufLoader* self, gint p0, gint p1, gint p2, gint p3); + static void closed_callback(GdkPixbufLoader* self); + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_PIXBUFLOADER_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/pixmap_p.h b/libs/gtkmm2/gdk/gdkmm/private/pixmap_p.h new file mode 100644 index 0000000000..149ed76a07 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/pixmap_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXMAP_P_H +#define _GDKMM_PIXMAP_P_H +#include <gdkmm/private/drawable_p.h> + +#include <glibmm/class.h> + +namespace Gdk +{ + +class Pixmap_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Pixmap CppObjectType; + typedef GdkPixmapObject BaseObjectType; + typedef GdkPixmapObjectClass BaseClassType; + typedef Gdk::Drawable_Class CppClassParent; + typedef GdkDrawableClass BaseClassParent; + + friend class Pixmap; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_PIXMAP_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/rectangle_p.h b/libs/gtkmm2/gdk/gdkmm/private/rectangle_p.h new file mode 100644 index 0000000000..51088336bb --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/rectangle_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_RECTANGLE_P_H +#define _GDKMM_RECTANGLE_P_H +#endif /* _GDKMM_RECTANGLE_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/region_p.h b/libs/gtkmm2/gdk/gdkmm/private/region_p.h new file mode 100644 index 0000000000..b0a7f8cdf2 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/region_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_REGION_P_H +#define _GDKMM_REGION_P_H +#endif /* _GDKMM_REGION_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/rgbcmap_p.h b/libs/gtkmm2/gdk/gdkmm/private/rgbcmap_p.h new file mode 100644 index 0000000000..d5845141c4 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/rgbcmap_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_RGBCMAP_P_H +#define _GDKMM_RGBCMAP_P_H +#endif /* _GDKMM_RGBCMAP_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/screen_p.h b/libs/gtkmm2/gdk/gdkmm/private/screen_p.h new file mode 100644 index 0000000000..9888f6c9db --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/screen_p.h @@ -0,0 +1,45 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_SCREEN_P_H +#define _GDKMM_SCREEN_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Gdk +{ + +class Screen_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Screen CppObjectType; + typedef GdkScreen BaseObjectType; + typedef GdkScreenClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Screen; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + static void size_changed_callback(GdkScreen* self); + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_SCREEN_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/types_p.h b/libs/gtkmm2/gdk/gdkmm/private/types_p.h new file mode 100644 index 0000000000..474d473ad8 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/types_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_TYPES_P_H +#define _GDKMM_TYPES_P_H +#endif /* _GDKMM_TYPES_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/visual_p.h b/libs/gtkmm2/gdk/gdkmm/private/visual_p.h new file mode 100644 index 0000000000..b11005c9db --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/visual_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_VISUAL_P_H +#define _GDKMM_VISUAL_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Gdk +{ + +class Visual_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Visual CppObjectType; + typedef GdkVisual BaseObjectType; + typedef GdkVisualClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Visual; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_VISUAL_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/window_p.h b/libs/gtkmm2/gdk/gdkmm/private/window_p.h new file mode 100644 index 0000000000..c9fc8a9e85 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/window_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_WINDOW_P_H +#define _GDKMM_WINDOW_P_H +#include <gdkmm/private/drawable_p.h> + +#include <glibmm/class.h> + +namespace Gdk +{ + +class Window_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Window CppObjectType; + typedef GdkWindowObject BaseObjectType; + typedef GdkWindowObjectClass BaseClassType; + typedef Gdk::Drawable_Class CppClassParent; + typedef GdkDrawableClass BaseClassParent; + + friend class Window; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_WINDOW_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/rectangle.cc b/libs/gtkmm2/gdk/gdkmm/rectangle.cc new file mode 100644 index 0000000000..a59a22bd75 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/rectangle.cc @@ -0,0 +1,160 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/rectangle.h> +#include <gdkmm/private/rectangle_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +namespace Gdk +{ + +Rectangle::Rectangle(int x, int y, int width, int height) +{ + gobject_.x = x; + gobject_.y = y; + gobject_.width = width; + gobject_.height = height; +} + +// gdk_rectangle_union() and gdk_rectangle_intersect() work fine even if +// the destination points to one of the input rectangles. The join() and +// intersect() implementations rely on this ability. + +Rectangle& Rectangle::join(const Rectangle& src2) +{ + gdk_rectangle_union( + &gobject_, const_cast<GdkRectangle*>(&src2.gobject_), &gobject_); + return *this; +} + +Rectangle& Rectangle::intersect(const Rectangle& src2) +{ + gdk_rectangle_intersect( + &gobject_, const_cast<GdkRectangle*>(&src2.gobject_), &gobject_); + return *this; +} + +Rectangle& Rectangle::intersect(const Rectangle& src2, bool& rectangles_intersect) +{ + rectangles_intersect = gdk_rectangle_intersect( + &gobject_, const_cast<GdkRectangle*>(&src2.gobject_), &gobject_); + return *this; +} + +bool Rectangle::has_zero_area() const +{ + return (gobject_.width == 0 || gobject_.height == 0); +} + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gdk::Rectangle& wrap(GdkRectangle* object) +{ + return *reinterpret_cast<Gdk::Rectangle*>(object); +} + +const Gdk::Rectangle& wrap(const GdkRectangle* object) +{ + return *reinterpret_cast<const Gdk::Rectangle*>(object); +} + +} // namespace Glib + + +namespace Gdk +{ + + +// static +GType Rectangle::get_type() +{ + return gdk_rectangle_get_type(); +} + +Rectangle::Rectangle() +{ + GLIBMM_INITIALIZE_STRUCT(gobject_, GdkRectangle); +} + +Rectangle::Rectangle(const GdkRectangle* gobject) +{ + if(gobject) + gobject_ = *gobject; + else + GLIBMM_INITIALIZE_STRUCT(gobject_, GdkRectangle); +} + + +int Rectangle::get_x() const +{ + return gobj()->x; +} + +void Rectangle::set_x(const int& value) +{ + gobj()->x = value; +} + +int Rectangle::get_y() const +{ + return gobj()->y; +} + +void Rectangle::set_y(const int& value) +{ + gobj()->y = value; +} + +int Rectangle::get_width() const +{ + return gobj()->width; +} + +void Rectangle::set_width(const int& value) +{ + gobj()->width = value; +} + +int Rectangle::get_height() const +{ + return gobj()->height; +} + +void Rectangle::set_height(const int& value) +{ + gobj()->height = value; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/rectangle.h b/libs/gtkmm2/gdk/gdkmm/rectangle.h new file mode 100644 index 0000000000..5a92e1b22d --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/rectangle.h @@ -0,0 +1,113 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_RECTANGLE_H +#define _GDKMM_RECTANGLE_H + +#include <glibmm.h> + +/* $Id$ */ + +/* rectangle.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdk/gdk.h> + + +namespace Gdk +{ + +/** Gdk::Rectangle is a structure holding the position and size of a rectangle. + * The intersection of two rectangles can be computed with intersect(). To find the union of two rectangles use union(). + */ +class Rectangle +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Rectangle CppObjectType; + typedef GdkRectangle BaseObjectType; + + static GType get_type() G_GNUC_CONST; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + Rectangle(); + + explicit Rectangle(const GdkRectangle* gobject); // always takes a copy + + ///Provides access to the underlying C instance. + GdkRectangle* gobj() { return &gobject_; } + + ///Provides access to the underlying C instance. + const GdkRectangle* gobj() const { return &gobject_; } + +protected: + GdkRectangle gobject_; + +private: + +public: +//_CUSTOM_DEFAULT_CTOR +//Rectangle(); + Rectangle(int x, int y, int width, int height); + + Rectangle& join(const Rectangle& src2); + Rectangle& intersect(const Rectangle& src2); + Rectangle& intersect(const Rectangle& src2, bool& rectangles_intersect); + + bool has_zero_area() const; + + int get_x() const; + void set_x(const int& value); + int get_y() const; + void set_y(const int& value); + int get_width() const; + void set_width(const int& value); + int get_height() const; + void set_height(const int& value); + + +}; + +} // namespace Gdk + + +namespace Glib +{ + +/** @relates Gdk::Rectangle + * @param object The C instance + * @result A C++ instance that wraps this C instance. + */ +Gdk::Rectangle& wrap(GdkRectangle* object); + +/** @relates Gdk::Rectangle + * @param object The C instance + * @result A C++ instance that wraps this C instance. + */ +const Gdk::Rectangle& wrap(const GdkRectangle* object); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template <> +class Value<Gdk::Rectangle> : public Glib::Value_Boxed<Gdk::Rectangle> +{}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + +#endif /* _GDKMM_RECTANGLE_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/region.cc b/libs/gtkmm2/gdk/gdkmm/region.cc new file mode 100644 index 0000000000..7206c1e239 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/region.cc @@ -0,0 +1,226 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/region.h> +#include <gdkmm/private/region_p.h> + +#include <gdk/gdkenumtypes.h> +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdk/gdkregion.h> + +namespace Gdk +{ + +Region::Region(const Glib::ArrayHandle<Gdk::Point>& points, FillRule fill_rule) +: + // The dangerous-looking cast to GdkPoint* works, because Gdk::Point + // has only one member variable of type GdkPoint, and no vtable. Please + // don't copy this code, casts like that won't work with most other types. + + gobject_ (gdk_region_polygon( + reinterpret_cast<GdkPoint*>(const_cast<Gdk::Point*>(points.data())), + points.size(), (GdkFillRule)(fill_rule))) +{} + +Region::Region(const Rectangle& rectangle) +: + gobject_ (gdk_region_rectangle(const_cast<GdkRectangle*>(rectangle.gobj()))) +{} + +Glib::ArrayHandle<Rectangle> Region::get_rectangles() const +{ + GdkRectangle* rectangles = 0; + int n_rectangles = 0; + + gdk_region_get_rectangles(gobject_, &rectangles, &n_rectangles); + + // The dangerous-looking cast to Rectangle* works, because Gdk::Rectangle + // has only one member variable of type GdkRectangle, and no vtable. Please + // don't copy this code, casts like that won't work with most other types. + + return Glib::ArrayHandle<Rectangle>( + reinterpret_cast<Rectangle*>(rectangles), n_rectangles, Glib::OWNERSHIP_SHALLOW); +} + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Gdk::FillRule>::value_type() +{ + return gdk_fill_rule_get_type(); +} + +// static +GType Glib::Value<Gdk::OverlapType>::value_type() +{ + return gdk_overlap_type_get_type(); +} + + +namespace Glib +{ + +Gdk::Region wrap(GdkRegion* object, bool take_copy /* = false */) +{ + return Gdk::Region(object, take_copy); +} + +} // namespace Glib + + +namespace Gdk +{ + + +Region::Region() +: + gobject_ (gdk_region_new()) +{} + +Region::Region(const Region& src) +: + gobject_ ((src.gobject_) ? gdk_region_copy(src.gobject_) : 0) +{} + +Region::Region(GdkRegion* castitem, bool make_a_copy /* = false */) +{ + if(!make_a_copy) + { + // It was given to us by a function which has already made a copy for us to keep. + gobject_ = castitem; + } + else + { + // We are probably getting it via direct access to a struct, + // so we can not just take it - we have to take a copy of it. + if(castitem) + gobject_ = gdk_region_copy(castitem); + else + gobject_ = 0; + } +} + +Region& Region::operator=(const Region& src) +{ + GdkRegion *const new_gobject = (src.gobject_) ? gdk_region_copy(src.gobject_) : 0; + + if(gobject_) + gdk_region_destroy(gobject_); + + gobject_ = new_gobject; + + return *this; +} + +Region::~Region() +{ + if(gobject_) + gdk_region_destroy(gobject_); +} + +GdkRegion* Region::gobj_copy() const +{ + return gdk_region_copy(gobject_); +} + + +void Region::get_clipbox(const Rectangle& rectangle) +{ + gdk_region_get_clipbox(gobj(), const_cast<GdkRectangle*>(rectangle.gobj())); +} + +bool Region::empty() +{ + return gdk_region_empty(gobj()); +} + +bool Region::point_in(int x, int y) +{ + return gdk_region_point_in(gobj(), x, y); +} + +OverlapType Region::rect_in(const Rectangle& rect) +{ + return ((OverlapType)(gdk_region_rect_in(gobj(), const_cast<GdkRectangle*>(rect.gobj())))); +} + +void Region::offset(int dx, int dy) +{ + gdk_region_offset(gobj(), dx, dy); +} + +void Region::shrink(int dx, int dy) +{ + gdk_region_shrink(gobj(), dx, dy); +} + +void Region::union_with_rect(const Rectangle& rect) +{ + gdk_region_union_with_rect(gobj(), const_cast<GdkRectangle*>(rect.gobj())); +} + +void Region::intersect(const Region& source2) +{ + gdk_region_intersect(gobj(), const_cast<GdkRegion*>((source2).gobj())); +} + +void Region::union_(const Region& source2) +{ + gdk_region_union(gobj(), const_cast<GdkRegion*>((source2).gobj())); +} + +void Region::subtract(const Region& source2) +{ + gdk_region_subtract(gobj(), const_cast<GdkRegion*>((source2).gobj())); +} + +void Region::xor_(const Region& source2) +{ + gdk_region_xor(gobj(), const_cast<GdkRegion*>((source2).gobj())); +} + +void Region::spans_intersect_foreach(GdkSpan* spans, int n_spans, bool sorted, GdkSpanFunc function, gpointer data) +{ + gdk_region_spans_intersect_foreach(gobj(), spans, n_spans, static_cast<int>(sorted), function, data); +} + + +bool operator==(const Region& lhs, const Region& rhs) +{ + return (gdk_region_equal(const_cast<GdkRegion*>(lhs.gobj()), const_cast<GdkRegion*>(rhs.gobj())) != 0); +} + +bool operator!=(const Region& lhs, const Region& rhs) +{ + return (gdk_region_equal(const_cast<GdkRegion*>(lhs.gobj()), const_cast<GdkRegion*>(rhs.gobj())) == 0); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/region.h b/libs/gtkmm2/gdk/gdkmm/region.h new file mode 100644 index 0000000000..bcea009aa7 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/region.h @@ -0,0 +1,234 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_REGION_H +#define _GDKMM_REGION_H + +#include <glibmm.h> + +/* $Id$ */ + +/* region.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +extern "C" { typedef struct _GdkRegion GdkRegion; } + +#include <glibmm/arrayhandle.h> +#include <gdkmm/types.h> +#include <gdkmm/rectangle.h> + + +namespace Gdk +{ + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum FillRule +{ + EVEN_ODD_RULE, + WINDING_RULE +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::FillRule> : public Glib::Value_Enum<Gdk::FillRule> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum OverlapType +{ + OVERLAP_RECTANGLE_IN, + OVERLAP_RECTANGLE_OUT, + OVERLAP_RECTANGLE_PART +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::OverlapType> : public Glib::Value_Enum<Gdk::OverlapType> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +/** This is an opaque data type holding a set of arbitrary pixels, and is usually used for clipping graphical operations + * (see Gdk::GC::set_clip_region()). + */ +class Region +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Region CppObjectType; + typedef GdkRegion BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + Region(); + + // Use make_a_copy=true when getting it directly from a struct. + explicit Region(GdkRegion* castitem, bool make_a_copy = false); + + Region(const Region& src); + Region& operator=(const Region& src); + + ~Region(); + + GdkRegion* gobj() { return gobject_; } + const GdkRegion* gobj() const { return gobject_; } + + ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. + GdkRegion* gobj_copy() const; + +protected: + GdkRegion* gobject_; + +private: + + +public: + + Region(const Glib::ArrayHandle<Gdk::Point>& points, FillRule fill_rule); + explicit Region(const Rectangle& rectangle); + + + void get_clipbox(const Rectangle& rectangle); + Glib::ArrayHandle<Rectangle> get_rectangles() const; + + + bool empty(); + + bool point_in(int x, int y); + + OverlapType rect_in(const Rectangle& rect); + + + void offset(int dx, int dy); + + void shrink(int dx, int dy); + + /** Sets the area of @a region to the union of the areas of @a region and + * @a rect . The resulting area is the set of pixels contained in + * either @a region or @a rect . + * @param rect A Gdk::Rectangle. + */ + void union_with_rect(const Rectangle& rect); + + /** Sets the area of @a source1 to the intersection of the areas of @a source1 + * and @a source2 . The resulting area is the set of pixels contained in + * both @a source1 and @a source2 . + * @param source2 Another Gdk::Region. + */ + void intersect(const Region& source2); + + /** Sets the area of @a source1 to the union of the areas of @a source1 and + * @a source2 . The resulting area is the set of pixels contained in + * either @a source1 or @a source2 . + * @param source2 A Gdk::Region. + */ + void union_(const Region& source2); //union is a keyword. + + /** Subtracts the area of @a source2 from the area @a source1 . The resulting + * area is the set of pixels contained in @a source1 but not in @a source2 . + * @param source2 Another Gdk::Region. + */ + void subtract(const Region& source2); + + /** Sets the area of @a source1 to the exclusive-OR of the areas of @a source1 + * and @a source2 . The resulting area is the set of pixels contained in one + * or the other of the two sources but not in both. + * @param source2 Another Gdk::Region. + */ + void xor_(const Region& source2); //xor is a keyword + + void spans_intersect_foreach(GdkSpan* spans, int n_spans, bool sorted, GdkSpanFunc function, gpointer data); + + +}; + +} //namespace Gdk + + +namespace Gdk +{ + +/** @relates Gdk::Region + * @param lhs The left-hand side + * @param rhs The right-hand side + * @result The result + */ +bool operator==(const Region& lhs, const Region& rhs); + +/** @relates Gdk::Region + * @param lhs The left-hand side + * @param rhs The right-hand side + * @result The result + */ +bool operator!=(const Region& lhs, const Region& rhs); + + +} // namespace Gdk + + +namespace Glib +{ + + /** @relates Gdk::Region + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ +Gdk::Region wrap(GdkRegion* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _GDKMM_REGION_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/rgb.cc b/libs/gtkmm2/gdk/gdkmm/rgb.cc new file mode 100644 index 0000000000..08c8cd58a2 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/rgb.cc @@ -0,0 +1,43 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2004 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdkmm/rgb.h> +#include <gdk/gdk.h> + +namespace Gdk +{ + +Glib::RefPtr<Colormap> rgb_get_colormap() +{ + return Glib::wrap( gdk_rgb_get_colormap() ); +} + +Glib::RefPtr<Visual> rgb_get_visual() +{ + return Glib::wrap( gdk_rgb_get_visual() ); +} + +bool rgb_ditherable() +{ + return gdk_rgb_ditherable(); +} + +} //namespace Gdk + diff --git a/libs/gtkmm2/gdk/gdkmm/rgb.h b/libs/gtkmm2/gdk/gdkmm/rgb.h new file mode 100644 index 0000000000..fa504ae68c --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/rgb.h @@ -0,0 +1,55 @@ +/* $Id$ */ + +/* Copyright 2004 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _GDKMM_RGB_H +#define _GDKMM_RGB_H + +#include <gdkmm/colormap.h> +#include <gdkmm/visual.h> + +namespace Gdk +{ + +/** Get the preferred colormap for rendering image data. + * Not a very useful function; historically, GDK could only render RGB image data to one colormap and visual, + * but in the current version it can render to any colormap and visual. So there's no need to call this function. + * + * @result The preferred colormap + */ +Glib::RefPtr<Colormap> rgb_get_colormap(); + +/** Gets a "preferred visual" chosen by GdkRGB for rendering image data on the default screen. + * In previous versions of GDK, this was the only visual GdkRGB could use for rendering. In current versions, + * it's simply the visual GdkRGB would have chosen as the optimal one in those previous versions. + * GdkRGB can now render to drawables with any visual. + * @result The Gdk::Visual chosen by GdkRGB. + */ +Glib::RefPtr<Visual> rgb_get_visual(); + +/** Determines whether the visual is ditherable. + * This function may be useful for presenting a user interface choice to the user about which dither mode is desired; + * if the display is not ditherable, it may make sense to gray out or hide the corresponding UI widget. + * result true if the visual is ditherable. + */ +bool rgb_ditherable(); + +} //namespace Gdk + +#endif //_GDKMM_RGB_H + diff --git a/libs/gtkmm2/gdk/gdkmm/rgbcmap.cc b/libs/gtkmm2/gdk/gdkmm/rgbcmap.cc new file mode 100644 index 0000000000..84a87d5439 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/rgbcmap.cc @@ -0,0 +1,72 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/rgbcmap.h> +#include <gdkmm/private/rgbcmap_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <glibmm/utility.h> +#include <gdk/gdkrgb.h> + +namespace Gdk +{ + +RgbCmap::RgbCmap(const Glib::ArrayHandle<guint32>& colors) +: gobject_ (gdk_rgb_cmap_new(const_cast<guint32*>(colors.data()), colors.size())) +{} + +RgbCmap::~RgbCmap() +{ + if(gobject_) + gdk_rgb_cmap_free(gobject_); +} + +guint32& RgbCmap::operator[](unsigned long index) +{ + return gobject_->colors[index]; +} + +const guint32& RgbCmap::operator[](unsigned long index) const +{ + return gobject_->colors[index]; +} + + +unsigned long RgbCmap::size() const +{ + return gobject_->n_colors; +} + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + + +namespace Gdk +{ + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/rgbcmap.h b/libs/gtkmm2/gdk/gdkmm/rgbcmap.h new file mode 100644 index 0000000000..0f01f1e619 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/rgbcmap.h @@ -0,0 +1,82 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_RGBCMAP_H +#define _GDKMM_RGBCMAP_H + +#include <glibmm.h> + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include <gdkmmconfig.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GdkRgbCmap GdkRgbCmap; } +#endif + +namespace Gdk +{ + +class RgbCmap +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef RgbCmap CppObjectType; + typedef GdkRgbCmap BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +public: + explicit RgbCmap(const Glib::ArrayHandle<guint32>& colors); + virtual ~RgbCmap(); + + ///Number of colors. + unsigned long size() const; + + ///Access the colors. + guint32& operator[](unsigned long index); + + ///Access the colors. + const guint32& operator[](unsigned long index) const; + + /// Provides access to the underlying C GObject. + GdkRgbCmap* gobj() { return gobject_; } + /// Provides access to the underlying C GObject. + const GdkRgbCmap* gobj() const { return gobject_; } + +protected: + GdkRgbCmap* gobject_; + +private: + // noncopyable + RgbCmap(const RgbCmap&); + RgbCmap& operator=(const RgbCmap&); + + +}; + +} // namespace Gdk + + +#endif /* _GDKMM_RGBCMAP_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/screen.cc b/libs/gtkmm2/gdk/gdkmm/screen.cc new file mode 100644 index 0000000000..0b64a27a59 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/screen.cc @@ -0,0 +1,416 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/screen.h> +#include <gdkmm/private/screen_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdkmm/display.h> +#include <gdkmm/visual.h> +#include <gdkmm/window.h> +#include <gdkmm/rectangle.h> +#include <gdk/gdkscreen.h> + +namespace Gdk +{ + +} //Gdk + + +namespace +{ + +const Glib::SignalProxyInfo Screen_signal_size_changed_info = +{ + "size-changed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr<Gdk::Screen> wrap(GdkScreen* object, bool take_copy) +{ + return Glib::RefPtr<Gdk::Screen>( dynamic_cast<Gdk::Screen*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Screen_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Screen_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_screen_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Screen_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->size_changed = &size_changed_callback; +} + + +void Screen_Class::size_changed_callback(GdkScreen* self) +{ + CppObjectType *const obj = dynamic_cast<CppObjectType*>( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_size_changed(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast<BaseClassType*>( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->size_changed) + (*base->size_changed)(self); + } +} + + +Glib::ObjectBase* Screen_Class::wrap_new(GObject* object) +{ + return new Screen((GdkScreen*)object); +} + + +/* The implementation: */ + +GdkScreen* Screen::gobj_copy() +{ + reference(); + return gobj(); +} + +Screen::Screen(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Screen::Screen(GdkScreen* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Screen::~Screen() +{} + + +Screen::CppClassType Screen::screen_class_; // initialize static member + +GType Screen::get_type() +{ + return screen_class_.init().get_type(); +} + +GType Screen::get_base_type() +{ + return gdk_screen_get_type(); +} + + +Glib::RefPtr<Colormap> Screen::get_default_colormap() +{ + + Glib::RefPtr<Colormap> retvalue = Glib::wrap(gdk_screen_get_default_colormap(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Colormap> Screen::get_default_colormap() const +{ + + Glib::RefPtr<const Colormap> retvalue = Glib::wrap(gdk_screen_get_default_colormap(const_cast<GdkScreen*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +void Screen::set_default_colormap(const Glib::RefPtr<const Colormap>& colormap) +{ + gdk_screen_set_default_colormap(gobj(), const_cast<GdkColormap*>(Glib::unwrap<Colormap>(colormap))); +} + +Glib::RefPtr<Colormap> Screen::get_system_colormap() +{ + + Glib::RefPtr<Colormap> retvalue = Glib::wrap(gdk_screen_get_system_colormap(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Colormap> Screen::get_system_colormap() const +{ + + Glib::RefPtr<const Colormap> retvalue = Glib::wrap(gdk_screen_get_system_colormap(const_cast<GdkScreen*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Visual> Screen::get_system_visual() +{ + + Glib::RefPtr<Visual> retvalue = Glib::wrap(gdk_screen_get_system_visual(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Visual> Screen::get_system_visual() const +{ + + Glib::RefPtr<const Visual> retvalue = Glib::wrap(gdk_screen_get_system_visual(const_cast<GdkScreen*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Colormap> Screen::get_rgb_colormap() +{ + + Glib::RefPtr<Colormap> retvalue = Glib::wrap(gdk_screen_get_rgb_colormap(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Colormap> Screen::get_rgb_colormap() const +{ + + Glib::RefPtr<const Colormap> retvalue = Glib::wrap(gdk_screen_get_rgb_colormap(const_cast<GdkScreen*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Visual> Screen::get_rgb_visual() +{ + + Glib::RefPtr<Visual> retvalue = Glib::wrap(gdk_screen_get_rgb_visual(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Visual> Screen::get_rgb_visual() const +{ + + Glib::RefPtr<const Visual> retvalue = Glib::wrap(gdk_screen_get_rgb_visual(const_cast<GdkScreen*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Window> Screen::get_root_window() +{ + + Glib::RefPtr<Window> retvalue = Glib::wrap((GdkWindowObject*)(gdk_screen_get_root_window(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Window> Screen::get_root_window() const +{ + + Glib::RefPtr<const Window> retvalue = Glib::wrap((GdkWindowObject*)(gdk_screen_get_root_window(const_cast<GdkScreen*>(gobj())))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Display> Screen::get_display() +{ + + Glib::RefPtr<Display> retvalue = Glib::wrap(gdk_screen_get_display(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Display> Screen::get_display() const +{ + + Glib::RefPtr<const Display> retvalue = Glib::wrap(gdk_screen_get_display(const_cast<GdkScreen*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +int Screen::get_number() const +{ + return gdk_screen_get_number(const_cast<GdkScreen*>(gobj())); +} + +int Screen::get_width() const +{ + return gdk_screen_get_width(const_cast<GdkScreen*>(gobj())); +} + +int Screen::get_height() const +{ + return gdk_screen_get_height(const_cast<GdkScreen*>(gobj())); +} + +int Screen::get_width_mm() const +{ + return gdk_screen_get_width_mm(const_cast<GdkScreen*>(gobj())); +} + +int Screen::get_height_mm() const +{ + return gdk_screen_get_height_mm(const_cast<GdkScreen*>(gobj())); +} + +Glib::ListHandle< Glib::RefPtr<Visual> > Screen::list_visuals() +{ + return Glib::ListHandle< Glib::RefPtr<Visual> >(gdk_screen_list_visuals(gobj()), Glib::OWNERSHIP_SHALLOW); +} + +Glib::ListHandle< Glib::RefPtr<Window> > Screen::get_toplevel_windows() +{ + return Glib::ListHandle< Glib::RefPtr<Window> >(gdk_screen_get_toplevel_windows(gobj()), Glib::OWNERSHIP_SHALLOW); +} + +Glib::ustring Screen::make_display_name() +{ + return Glib::convert_return_gchar_ptr_to_ustring(gdk_screen_make_display_name(gobj())); +} + +int Screen::get_n_monitors() const +{ + return gdk_screen_get_n_monitors(const_cast<GdkScreen*>(gobj())); +} + +void Screen::get_monitor_geometry(int monitor_num, Rectangle& dest) const +{ + gdk_screen_get_monitor_geometry(const_cast<GdkScreen*>(gobj()), monitor_num, (dest).gobj()); +} + +int Screen::get_monitor_at_point(int x, int y) const +{ + return gdk_screen_get_monitor_at_point(const_cast<GdkScreen*>(gobj()), x, y); +} + +int Screen::get_monitor_at_window(const Glib::RefPtr<Window>& window) const +{ + return gdk_screen_get_monitor_at_window(const_cast<GdkScreen*>(gobj()), Glib::unwrap(window)); +} + +void Screen::broadcast_client_message(GdkEvent* event) +{ + gdk_screen_broadcast_client_message(gobj(), event); +} + +Glib::RefPtr<Screen> Screen::get_default() +{ + + Glib::RefPtr<Screen> retvalue = Glib::wrap(gdk_screen_get_default()); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + + +Glib::SignalProxy0< void > Screen::signal_size_changed() +{ + return Glib::SignalProxy0< void >(this, &Screen_signal_size_changed_info); +} + + +void Gdk::Screen::on_size_changed() +{ + BaseClassType *const base = static_cast<BaseClassType*>( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->size_changed) + (*base->size_changed)(gobj()); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/screen.h b/libs/gtkmm2/gdk/gdkmm/screen.h new file mode 100644 index 0000000000..29ae15d54f --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/screen.h @@ -0,0 +1,423 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_SCREEN_H +#define _GDKMM_SCREEN_H + +#include <glibmm.h> + +/* $Id$ */ + +/* screen.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +//#include <gdkmm/visual.h> +//#include <gdkmm/window.h> +#include <gdkmm/rectangle.h> +#include <glibmm/object.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkScreen GdkScreen; +typedef struct _GdkScreenClass GdkScreenClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Screen_Class; } // namespace Gdk +namespace Gdk +{ + +class Display; +class Colormap; +class Visual; +class Window; + +/** Object representing a physical screen + * Gdk::Screen objects are the GDK representation of a physical screen. It is used throughout GDK and GTK+ to specify + * which screen the top level windows are to be displayed on. It is also used to query the screen specification and + * default settings such as the default colormap (get_default_colormap()), the screen width (get_width()), etc. + * Note that a screen may consist of multiple monitors which are merged to form a large screen area. + */ + +class Screen : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Screen CppObjectType; + typedef Screen_Class CppClassType; + typedef GdkScreen BaseObjectType; + typedef GdkScreenClass BaseClassType; + +private: friend class Screen_Class; + static CppClassType screen_class_; + +private: + // noncopyable + Screen(const Screen&); + Screen& operator=(const Screen&); + +protected: + explicit Screen(const Glib::ConstructParams& construct_params); + explicit Screen(GdkScreen* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Screen(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkScreen* gobj() { return reinterpret_cast<GdkScreen*>(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkScreen* gobj() const { return reinterpret_cast<GdkScreen*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkScreen* gobj_copy(); + +private: + +protected: + +public: + + /** Gets the default colormap for @a screen . + * @return The default Gdk::Colormap. + * + * Since: 2.2. + */ + Glib::RefPtr<Colormap> get_default_colormap(); + + /** Gets the default colormap for @a screen . + * @return The default Gdk::Colormap. + * + * Since: 2.2. + */ + Glib::RefPtr<const Colormap> get_default_colormap() const; + + + /** Sets the default @a colormap for @a screen . + * + * Since: 2.2 + * @param colormap A Gdk::Colormap. + */ + void set_default_colormap(const Glib::RefPtr<const Colormap>& colormap); + + /** Gets the system's default colormap for @a screen + * @return The default colormap for @a screen . + * + * Since: 2.2. + */ + Glib::RefPtr<Colormap> get_system_colormap(); + + /** Gets the system's default colormap for @a screen + * @return The default colormap for @a screen . + * + * Since: 2.2. + */ + Glib::RefPtr<const Colormap> get_system_colormap() const; + + + /** Get the system's default visual for @a screen . + * This is the visual for the root window of the display. + * The return value should not be freed. + * @return The system visual + * + * Since: 2.2. + */ + Glib::RefPtr<Visual> get_system_visual(); + + /** Get the system's default visual for @a screen . + * This is the visual for the root window of the display. + * The return value should not be freed. + * @return The system visual + * + * Since: 2.2. + */ + Glib::RefPtr<const Visual> get_system_visual() const; + + + /** Gets the preferred colormap for rendering image data on @a screen . + * Not a very useful function; historically, GDK could only render RGB + * image data to one colormap and visual, but in the current version + * it can render to any colormap and visual. So there's no need to + * call this function. + * @return The preferred colormap + * + * Since: 2.2. + */ + Glib::RefPtr<Colormap> get_rgb_colormap(); + + /** Gets the preferred colormap for rendering image data on @a screen . + * Not a very useful function; historically, GDK could only render RGB + * image data to one colormap and visual, but in the current version + * it can render to any colormap and visual. So there's no need to + * call this function. + * @return The preferred colormap + * + * Since: 2.2. + */ + Glib::RefPtr<const Colormap> get_rgb_colormap() const; + + + /** Gets a "preferred visual" chosen by GdkRGB for rendering image data + * on @a screen . In previous versions of + * GDK, this was the only visual GdkRGB could use for rendering. In + * current versions, it's simply the visual GdkRGB would have chosen as + * the optimal one in those previous versions. GdkRGB can now render to + * drawables with any visual. + * @return The Gdk::Visual chosen by GdkRGB. + * + * Since: 2.2. + */ + Glib::RefPtr<Visual> get_rgb_visual(); + + /** Gets a "preferred visual" chosen by GdkRGB for rendering image data + * on @a screen . In previous versions of + * GDK, this was the only visual GdkRGB could use for rendering. In + * current versions, it's simply the visual GdkRGB would have chosen as + * the optimal one in those previous versions. GdkRGB can now render to + * drawables with any visual. + * @return The Gdk::Visual chosen by GdkRGB. + * + * Since: 2.2. + */ + Glib::RefPtr<const Visual> get_rgb_visual() const; + + + /** Gets the root window of @a screen . + * @return The root window + * + * Since: 2.2. + */ + Glib::RefPtr<Window> get_root_window(); + + /** Gets the root window of @a screen . + * @return The root window + * + * Since: 2.2. + */ + Glib::RefPtr<const Window> get_root_window() const; + + + /** Gets the display to which the @a screen belongs. + * @return The display to which @a screen belongs + * + * Since: 2.2. + */ + Glib::RefPtr<Display> get_display(); + + /** Gets the display to which the @a screen belongs. + * @return The display to which @a screen belongs + * + * Since: 2.2. + */ + Glib::RefPtr<const Display> get_display() const; + + + /** Gets the index of @a screen among the screens in the display + * to which it belongs. (See get_display()) + * @return The index + * + * Since: 2.2. + */ + int get_number() const; + + /** Gets the width of @a screen in pixels + * @return The width of @a screen in pixels. + * + * Since: 2.2. + */ + int get_width() const; + + /** Gets the height of @a screen in pixels + * @return The height of @a screen in pixels. + * + * Since: 2.2. + */ + int get_height() const; + + /** Gets the width of @a screen in millimeters. + * Note that on some X servers this value will not be correct. + * @return The width of @a screen in pixels. + * + * Since: 2.2. + */ + int get_width_mm() const; + + /** Returns the height of @a screen in millimeters. + * Note that on some X servers this value will not be correct. + * @return The heigth of @a screen in pixels. + * + * Since: 2.2. + */ + int get_height_mm() const; + + + /** Lists the available visuals for the specified @a screen . + * A visual describes a hardware image data format. + * For example, a visual might support 24-bit color, or 8-bit color, + * and might expect pixels to be in a certain format. + * @return A list of visuals. + * + * Since: 2.2. + */ + Glib::ListHandle< Glib::RefPtr<Visual> > list_visuals(); + + /** Obtains a list of all toplevel windows known to GDK on the screen @a screen . + * A toplevel window is a child of the root window (see + * gdk_get_default_root_window()). + * @return List of toplevel windows. + * + * Since: 2.2. + */ + Glib::ListHandle< Glib::RefPtr<Window> > get_toplevel_windows(); + + /** Determines the name to pass to Gdk::Display::open() to get + * a Gdk::Display with this screen as the default screen. + * @return The name. + * + * Since: 2.2. + */ + Glib::ustring make_display_name(); + + + /** Returns the number of monitors which @a screen consists of. + * @return Number of monitors which @a screen consists of. + * + * Since: 2.2. + */ + int get_n_monitors() const; + + /** Retrieves the Gdk::Rectangle representing the size and position of + * the individual monitor within the the entire screen area. + * + * Note that the size of the entire screen area can be retrieved via + * get_width() and get_height(). + * + * Since: 2.2 + * @param monitor_num The monitor number. + * @param dest A Gdk::Rectangle to be filled with the monitor geometry. + */ + void get_monitor_geometry(int monitor_num, Rectangle& dest) const; + + /** Returns the monitor number in which the point ( @a x , @a y ) is located. + * @param x The x coordinate in the virtual screen. + * @param y The y coordinate in the virtual screen. + * @return The monitor number in which the point ( @a x , @a y ) lies, or + * a monitor close to ( @a x , @a y ) if the point is not in any monitor. + * + * Since: 2.2. + */ + int get_monitor_at_point(int x, int y) const; + + /** + * @param window A Gdk::Window. + * @return The monitor number in which most of @a window is located, + * or if @a window does not intersect any monitors, a monitor, + * close to @a window . + * the number of the monitor in which the largest area of the + * bounding rectangle of @a window resides. + * + * Since: 2.2. + */ + int get_monitor_at_window(const Glib::RefPtr<Window>& window) const; + + + /** On X11, sends an X ClientMessage event to all toplevel windows on + * @a screen . + * + * Toplevel windows are determined by checking for the WM_STATE property, + * as described in the Inter-Client Communication Conventions Manual (ICCCM). + * If no windows are found with the WM_STATE property set, the message is + * sent to all children of the root window. + * + * On Windows, broadcasts a message registered with the name + * GDK_WIN32_CLIENT_MESSAGE to all top-level windows. The amount of + * data is limited to one long, i.e. four bytes. + * + * Since: 2.2 + * @param event The Gdk::Event. + */ + void broadcast_client_message(GdkEvent* event); + + + /** Gets the default screen for the default display. (See + * Gdk::Display::get_default()). + * @return A Gdk::Screen, or <tt>0</tt> if there is no default display. + * + * Since: 2.2. + */ + static Glib::RefPtr<Screen> get_default(); + + template <class ValueType> + bool get_setting(const Glib::ustring& name, ValueType& value) const; + + + Glib::SignalProxy0< void > signal_size_changed(); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_size_changed(); + + +}; + +template <class ValueType> +bool Screen::get_setting(const Glib::ustring& name, ValueType& value) const +{ + Glib::Value<ValueType> glibmmvalue; + glibmmvalue.init(Glib::Value<ValueType>::value_type()); + + gboolean result = gdk_screen_get_setting(const_cast<GdkScreen*>(gobj()), name.c_str(), glibmmvalue.gobj()); + + value = glibmmvalue.get(); + return result; +} + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::Screen + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Gdk::Screen> wrap(GdkScreen* object, bool take_copy = false); +} + + +#endif /* _GDKMM_SCREEN_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/types.cc b/libs/gtkmm2/gdk/gdkmm/types.cc new file mode 100644 index 0000000000..e15170aadb --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/types.cc @@ -0,0 +1,116 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/types.h> +#include <gdkmm/private/types_p.h> + +#include <gdk/gdkenumtypes.h> +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +namespace Gdk +{ + +Point::Point() +{ + gobject_.x = 0; + gobject_.y = 0; +} + +Point::Point(int x, int y) +{ + gobject_.x = x; + gobject_.y = y; +} + +bool Point::equal(const Gdk::Point& rhs) const +{ + return (gobject_.x == rhs.gobject_.x) && (gobject_.y == rhs.gobject_.y); +} + +// static +GdkAtom AtomStringTraits::to_c_type(const std::string& atom_name) +{ + return gdk_atom_intern(atom_name.c_str(), 0); +} + +// static +std::string AtomStringTraits::to_cpp_type(GdkAtom atom) +{ + if(char *const atom_name = gdk_atom_name(atom)) + return std::string(Glib::ScopedPtr<char>(atom_name).get()); + else + return std::string(); +} + +} // namespace Gdk + + +namespace Glib +{ + +Gdk::Point& wrap(GdkPoint* object) +{ + return *reinterpret_cast<Gdk::Point*>(object); +} + +const Gdk::Point& wrap(const GdkPoint* object) +{ + return *reinterpret_cast<const Gdk::Point*>(object); +} + +} // namespace Glib + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Gdk::ByteOrder>::value_type() +{ + return gdk_byte_order_get_type(); +} + +// static +GType Glib::Value<Gdk::ModifierType>::value_type() +{ + return gdk_modifier_type_get_type(); +} + +// static +GType Glib::Value<Gdk::Status>::value_type() +{ + return gdk_status_get_type(); +} + +// static +GType Glib::Value<Gdk::InputCondition>::value_type() +{ + return gdk_input_condition_get_type(); +} + + +namespace Gdk +{ + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/types.h b/libs/gtkmm2/gdk/gdkmm/types.h new file mode 100644 index 0000000000..1f0c0fafd4 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/types.h @@ -0,0 +1,370 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_TYPES_H +#define _GDKMM_TYPES_H + +#include <glibmm.h> + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include <gdk/gdk.h> +#include <gdkmmconfig.h> + +/* Shadow ERROR macro (from wingdi.h). + */ +#if defined(ERROR) && !defined(GTKMM_MACRO_SHADOW_ERROR) +enum { GTKMM_MACRO_DEFINITION_ERROR = ERROR }; +#undef ERROR +enum { ERROR = GTKMM_MACRO_DEFINITION_ERROR }; +#define ERROR ERROR +#define GTKMM_MACRO_SHADOW_ERROR 1 +#endif + +/********************************************************************* +***** Version macros +*********************************************************************/ + +/* macro for controlling version numbers */ +#ifndef _GDK_VERSION + +#define GDK_VERSION_GT(major,minor) ((GTK_MAJOR_VERSION>major)||(GTK_MAJOR_VERSION==major)&&(GTK_MINOR_VERSION>minor)) +#define GDK_VERSION_GE(major,minor) ((GTK_MAJOR_VERSION>major)||(GTK_MAJOR_VERSION==major)&&(GTK_MINOR_VERSION>=minor)) +#define GDK_VERSION_EQ(major,minor) ((GTK_MAJOR_VERSION==major)&&(GTK_MINOR_VERSION==minor)) +#define GDK_VERSION_NE(major,minor) ((GTK_MAJOR_VERSION!=major)||(GTK_MINOR_VERSION!=minor)) +#define GDK_VERSION_LE(major,minor) ((GTK_MAJOR_VERSION<major)||(GTK_MAJOR_VERSION==major)&&(GTK_MINOR_VERSION<=minor)) +#define GDK_VERSION_LT(major,minor) ((GTK_MAJOR_VERSION<major)||(GTK_MAJOR_VERSION==major)&&(GTK_MINOR_VERSION<minor)) + +//Note: Use GTK_CHECK_VERSION to check that a version is equal or more than (the micro version). + +#endif /* _GDK_VERSION */ + +namespace Gdk +{ + +class Bitmap; +class Colormap; +class Pixmap; +class Window; +class Font; +class GC; +class Color; +class Image; + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum ByteOrder +{ + LSB_FIRST, + MSB_FIRST +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::ByteOrder> : public Glib::Value_Enum<Gdk::ByteOrder> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * <tt>%ModifierType operator|(ModifierType, ModifierType)</tt><br> + * <tt>%ModifierType operator&(ModifierType, ModifierType)</tt><br> + * <tt>%ModifierType operator^(ModifierType, ModifierType)</tt><br> + * <tt>%ModifierType operator~(ModifierType)</tt><br> + * <tt>%ModifierType& operator|=(ModifierType&, ModifierType)</tt><br> + * <tt>%ModifierType& operator&=(ModifierType&, ModifierType)</tt><br> + * <tt>%ModifierType& operator^=(ModifierType&, ModifierType)</tt><br> + */ +enum ModifierType +{ + SHIFT_MASK = 1 << 0, + LOCK_MASK = 1 << 1, + CONTROL_MASK = 1 << 2, + MOD1_MASK = 1 << 3, + MOD2_MASK = 1 << 4, + MOD3_MASK = 1 << 5, + MOD4_MASK = 1 << 6, + MOD5_MASK = 1 << 7, + BUTTON1_MASK = 1 << 8, + BUTTON2_MASK = 1 << 9, + BUTTON3_MASK = 1 << 10, + BUTTON4_MASK = 1 << 11, + BUTTON5_MASK = 1 << 12, + RELEASE_MASK = 1 << 30, + MODIFIER_MASK = 0x40001FFF +}; + +/** @ingroup gdkmmEnums */ +inline ModifierType operator|(ModifierType lhs, ModifierType rhs) + { return static_cast<ModifierType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline ModifierType operator&(ModifierType lhs, ModifierType rhs) + { return static_cast<ModifierType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline ModifierType operator^(ModifierType lhs, ModifierType rhs) + { return static_cast<ModifierType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline ModifierType operator~(ModifierType flags) + { return static_cast<ModifierType>(~static_cast<unsigned>(flags)); } + +/** @ingroup gdkmmEnums */ +inline ModifierType& operator|=(ModifierType& lhs, ModifierType rhs) + { return (lhs = static_cast<ModifierType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline ModifierType& operator&=(ModifierType& lhs, ModifierType rhs) + { return (lhs = static_cast<ModifierType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline ModifierType& operator^=(ModifierType& lhs, ModifierType rhs) + { return (lhs = static_cast<ModifierType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::ModifierType> : public Glib::Value_Flags<Gdk::ModifierType> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum Status +{ + OK = 0, + ERROR = -1, + ERROR_PARAM = -2, + ERROR_FILE = -3, + ERROR_MEM = -4 +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::Status> : public Glib::Value_Enum<Gdk::Status> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * <tt>%InputCondition operator|(InputCondition, InputCondition)</tt><br> + * <tt>%InputCondition operator&(InputCondition, InputCondition)</tt><br> + * <tt>%InputCondition operator^(InputCondition, InputCondition)</tt><br> + * <tt>%InputCondition operator~(InputCondition)</tt><br> + * <tt>%InputCondition& operator|=(InputCondition&, InputCondition)</tt><br> + * <tt>%InputCondition& operator&=(InputCondition&, InputCondition)</tt><br> + * <tt>%InputCondition& operator^=(InputCondition&, InputCondition)</tt><br> + */ +enum InputCondition +{ + INPUT_READ = 1 << 0, + INPUT_WRITE = 1 << 1, + INPUT_EXCEPTION = 1 << 2 +}; + +/** @ingroup gdkmmEnums */ +inline InputCondition operator|(InputCondition lhs, InputCondition rhs) + { return static_cast<InputCondition>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline InputCondition operator&(InputCondition lhs, InputCondition rhs) + { return static_cast<InputCondition>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline InputCondition operator^(InputCondition lhs, InputCondition rhs) + { return static_cast<InputCondition>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline InputCondition operator~(InputCondition flags) + { return static_cast<InputCondition>(~static_cast<unsigned>(flags)); } + +/** @ingroup gdkmmEnums */ +inline InputCondition& operator|=(InputCondition& lhs, InputCondition rhs) + { return (lhs = static_cast<InputCondition>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline InputCondition& operator&=(InputCondition& lhs, InputCondition rhs) + { return (lhs = static_cast<InputCondition>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline InputCondition& operator^=(InputCondition& lhs, InputCondition rhs) + { return (lhs = static_cast<InputCondition>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::InputCondition> : public Glib::Value_Flags<Gdk::InputCondition> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +typedef GdkGeometry Geometry; //It's not used enough to justify having a wrapper. +typedef GdkNativeWindow NativeWindow; + +/** This is a simple structure containing an x and y coordinate of a point. + */ +class Point +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Point CppObjectType; + typedef GdkPoint BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +public: + Point(); + Point(int x, int y); + + void set_x(int x) { gobject_.x = x; } + void set_y(int y) { gobject_.y = y; } + + int get_x() const { return gobject_.x; } + int get_y() const { return gobject_.y; } + + bool equal(const Gdk::Point& rhs) const; + + /// Provides access to the underlying C GObject. + GdkPoint* gobj() { return &gobject_; } + /// Provides access to the underlying C GObject. + const GdkPoint* gobj() const { return &gobject_; } + +protected: + GdkPoint gobject_; + + +}; + +/** @relates Gdk::Point */ +inline bool operator==(const Point& lhs, const Point& rhs) + { return lhs.equal(rhs); } + +/** @relates Gdk::Point */ +inline bool operator!=(const Point& lhs, const Point& rhs) + { return !lhs.equal(rhs); } + + +struct AtomStringTraits +{ + typedef std::string CppType; + typedef GdkAtom CType; + typedef GdkAtom CTypeNonConst; + + static GdkAtom to_c_type(GdkAtom atom) { return atom; } + static void release_c_type(GdkAtom) {} + + // These aren't worth to be inlined since doing so + // would expose way too much of the implementation. + static GdkAtom to_c_type (const std::string& atom_name); + static std::string to_cpp_type(GdkAtom atom); +}; + +// I'm typedef'ing this because when we call to_c_type or to_c_type, +// we don't want it to look like we're calling a template trait, but +// a utility function. -Bryan +typedef AtomStringTraits AtomString; + +typedef Glib::ArrayHandle<std::string,AtomStringTraits> ArrayHandle_AtomString; + +} // namespace Gdk + + +namespace Glib +{ + +/** @relates Gdk::Point */ +Gdk::Point& wrap(GdkPoint* object); + +/** @relates Gdk::Point */ +const Gdk::Point& wrap(const GdkPoint* object); + +} // namespace Glib + + +#endif /* _GDKMM_TYPES_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/visual.cc b/libs/gtkmm2/gdk/gdkmm/visual.cc new file mode 100644 index 0000000000..4d4e84774c --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/visual.cc @@ -0,0 +1,226 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/visual.h> +#include <gdkmm/private/visual_p.h> + +#include <gdk/gdkenumtypes.h> +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdk/gdkvisual.h> + +namespace Gdk +{ + + +} //namespace + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Gdk::VisualType>::value_type() +{ + return gdk_visual_type_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr<Gdk::Visual> wrap(GdkVisual* object, bool take_copy) +{ + return Glib::RefPtr<Gdk::Visual>( dynamic_cast<Gdk::Visual*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Visual_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Visual_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_visual_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Visual_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Visual_Class::wrap_new(GObject* object) +{ + return new Visual((GdkVisual*)object); +} + + +/* The implementation: */ + +GdkVisual* Visual::gobj_copy() +{ + reference(); + return gobj(); +} + +Visual::Visual(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Visual::Visual(GdkVisual* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Visual::~Visual() +{} + + +Visual::CppClassType Visual::visual_class_; // initialize static member + +GType Visual::get_type() +{ + return visual_class_.init().get_type(); +} + +GType Visual::get_base_type() +{ + return gdk_visual_get_type(); +} + + +Visual::Visual() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(visual_class_.init())) +{ + } + +Glib::RefPtr<Visual> Visual::get_system() +{ + + Glib::RefPtr<Visual> retvalue = Glib::wrap(gdk_visual_get_system()); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Visual> Visual::get_best() +{ + + Glib::RefPtr<Visual> retvalue = Glib::wrap(gdk_visual_get_best()); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Visual> Visual::get_best(int depth) +{ + + Glib::RefPtr<Visual> retvalue = Glib::wrap(gdk_visual_get_best_with_depth(depth)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Visual> Visual::get_best(VisualType visual_type) +{ + + Glib::RefPtr<Visual> retvalue = Glib::wrap(gdk_visual_get_best_with_type(((GdkVisualType)(visual_type)))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Visual> Visual::get_best(int depth, VisualType visual_type) +{ + + Glib::RefPtr<Visual> retvalue = Glib::wrap(gdk_visual_get_best_with_both(depth, ((GdkVisualType)(visual_type)))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +int Visual::get_best_depth() +{ + return gdk_visual_get_best_depth(); +} + +VisualType Visual::get_best_type() +{ + return ((VisualType)(gdk_visual_get_best_type())); +} + +Glib::RefPtr<Screen> Visual::get_screen() +{ + + Glib::RefPtr<Screen> retvalue = Glib::wrap(gdk_visual_get_screen(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Screen> Visual::get_screen() const +{ + + Glib::RefPtr<const Screen> retvalue = Glib::wrap(gdk_visual_get_screen(const_cast<GdkVisual*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/visual.h b/libs/gtkmm2/gdk/gdkmm/visual.h new file mode 100644 index 0000000000..66f3cd5807 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/visual.h @@ -0,0 +1,253 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_VISUAL_H +#define _GDKMM_VISUAL_H + +#include <glibmm.h> + +/* $Id$ */ + +/* bitmap.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <glibmm/object.h> +#include <gdkmm/screen.h> +#include <gdk/gdkvisual.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkVisual GdkVisual; +typedef struct _GdkVisualClass GdkVisualClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Visual_Class; } // namespace Gdk +namespace Gdk +{ + +class Screen; + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum VisualType +{ + VISUAL_STATIC_GRAY, + VISUAL_GRAYSCALE, + VISUAL_STATIC_COLOR, + VISUAL_PSEUDO_COLOR, + VISUAL_TRUE_COLOR, + VISUAL_DIRECT_COLOR +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::VisualType> : public Glib::Value_Enum<Gdk::VisualType> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +/** A Gdk::Visual describes a particular video hardware display format. + * It includes information about the number of bits used for each color, the way the bits are translated into an RGB value + * for display, and the way the bits are stored in memory. For example, a piece of display hardware might support 24-bit + * color, 16-bit color, or 8-bit color; meaning 24/16/8-bit pixel sizes. For a given pixel size, pixels can be in different + * formats; for example the "red" element of an RGB pixel may be in the top 8 bits of the pixel, or may be in the lower 4 + * bits. + * + * Usually you can avoid thinking about visuals in GTK+. Visuals are useful to interpret the contents of a GdkImage, but + * you should avoid Gdk::Image precisely because its contents depend on the display hardware; use Gdk::Pixbuf instead, for + * all but the most low-level purposes. Also, anytime you provide a Gdk::Colormap, the visual is implied as part of the + * colormap (Gdk::Colormap::get_visual()), so you won't have to provide a visual in addition. + * + * There are several standard visuals. The visual returned by get_system() is the system's default visual. get_visual() + * returns the visual most suited to displaying full-color image data. If you use the calls in Gdk::RGB, you should create + * your windows using this visual (and the colormap returned by Gdk::Rgb::get_colormap()). + * + * A number of methods are provided for determining the "best" available visual. For the purposes of making this + * determination, higher bit depths are considered better, and for visuals of the same bit depth, GDK_VISUAL_PSEUDO_COLOR + * is preferred at 8bpp, otherwise, the visual types are ranked in the order of (highest to lowest) GDK_VISUAL_DIRECT_COLOR, + * GDK_VISUAL_TRUE_COLOR, GDK_VISUAL_PSEUDO_COLOR, GDK_VISUAL_STATIC_COLOR, GDK_VISUAL_GRAYSCALE, then + * GDK_VISUAL_STATIC_GRAY. + */ + +class Visual : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Visual CppObjectType; + typedef Visual_Class CppClassType; + typedef GdkVisual BaseObjectType; + typedef GdkVisualClass BaseClassType; + +private: friend class Visual_Class; + static CppClassType visual_class_; + +private: + // noncopyable + Visual(const Visual&); + Visual& operator=(const Visual&); + +protected: + explicit Visual(const Glib::ConstructParams& construct_params); + explicit Visual(GdkVisual* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Visual(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkVisual* gobj() { return reinterpret_cast<GdkVisual*>(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkVisual* gobj() const { return reinterpret_cast<GdkVisual*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkVisual* gobj_copy(); + +private: + +protected: + + Visual(); + +public: + + /** Get the system'sdefault visual for the default GDK screen. + * This is the visual for the root window of the display. + * The return value should not be freed. + * @return System visual. + */ + static Glib::RefPtr<Visual> get_system(); + + /** Get the visual with the most available colors for the default + * GDK screen. The return value should not be freed. + * @return Best visual. + */ + static Glib::RefPtr<Visual> get_best(); + + /** Get the best visual with depth @a depth for the default GDK screen. + * Color visuals and visuals with mutable colormaps are preferred + * over grayscale or fixed-colormap visuals. The return value should not + * be freed. <tt>0</tt> may be returned if no visual supports @a depth . + * @param depth A bit depth. + * @return Best visual for the given depth. + */ + static Glib::RefPtr<Visual> get_best(int depth); + + /** Get the best visual of the given @a visual_type for the default GDK screen. + * Visuals with higher color depths are considered better. The return value + * should not be freed. <tt>0</tt> may be returned if no visual has type + * @a visual_type . + * @param visual_type A visual type. + * @return Best visual of the given type. + */ + static Glib::RefPtr<Visual> get_best(VisualType visual_type); + + /** Combines gdk_visual_get_best_with_depth() and gdk_visual_get_best_with_type(). + * @param depth A bit depth. + * @param visual_type A visual type. + * @return Best visual with both @a depth and @a visual_type , or <tt>0</tt> if none. + */ + static Glib::RefPtr<Visual> get_best(int depth, VisualType visual_type); + + + /** Get the best available depth for the default GDK screen. "Best" + * means "largest," i.e. 32 preferred over 24 preferred over 8 bits + * per pixel. + * @return Best available depth. + */ + static int get_best_depth(); + + /** Return the best available visual type for the default GDK screen. + * @return Best visual type. + */ + static VisualType get_best_type(); + + + /** Gets the screen to which this visual belongs + * @return The screen to which this visual belongs. + * + * Since: 2.2. + */ + Glib::RefPtr<Screen> get_screen(); + + /** Gets the screen to which this visual belongs + * @return The screen to which this visual belongs. + * + * Since: 2.2. + */ + Glib::RefPtr<const Screen> get_screen() const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} //namespace Gdk + + +namespace Glib +{ + /** @relates Gdk::Visual + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Gdk::Visual> wrap(GdkVisual* object, bool take_copy = false); +} + + +#endif /* _GDKMM_VISUAL_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/window.cc b/libs/gtkmm2/gdk/gdkmm/window.cc new file mode 100644 index 0000000000..9419c5b01b --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/window.cc @@ -0,0 +1,769 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gdkmm/window.h> +#include <gdkmm/private/window_p.h> + +#include <gdk/gdkenumtypes.h> +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gdk/gdkwindow.h> +#include <gdkmm/pixmap.h> +#include <gdkmm/cursor.h> +#include <gdkmm/types.h> + + +namespace Gdk +{ + +Window::Window(const Glib::RefPtr<Window>& parent, GdkWindowAttr* attributes, int attributes_mask) +: + Drawable((GdkDrawable*) gdk_window_new(parent->gobj(), attributes, attributes_mask)) +{ + //GdkWindow is X11/win32-specific, so we probably can't derived our own GType. +} + +void Window::set_cursor() +{ + gdk_window_set_cursor(gobj(), 0); +} + +GrabStatus Window::pointer_grab(bool owner_events, EventMask event_mask, const Cursor& cursor, guint32 timestamp) +{ + return ((GrabStatus)(gdk_pointer_grab(gobj(), static_cast<int>(owner_events), ((GdkEventMask)(event_mask)), 0, (cursor).gobj_copy(), timestamp))); +} + +GrabStatus Window::pointer_grab(bool owner_events, EventMask event_mask, guint32 timestamp) +{ + return ((GrabStatus)(gdk_pointer_grab(gobj(), static_cast<int>(owner_events), ((GdkEventMask)(event_mask)), 0, 0, timestamp))); +} + +//static +void Window::unset_sm_client_id() +{ + gdk_set_sm_client_id(0 /* see GDK docs */); +} + +void Window::set_icon(const Glib::RefPtr<Window>& icon_window, const Glib::RefPtr<Pixmap>& pixmap) +{ + gdk_window_set_icon(gobj(), icon_window->gobj(), pixmap->gobj(), 0); /* See GDK docs */ +} + +void Window::unset_icon() +{ + gdk_window_set_icon(gobj(), 0, 0, 0); /* See GDK docs */ +} + +void Window::unset_shape_combine_mask() +{ + gdk_window_shape_combine_mask(gobj(), 0, 0, 0); //See GDK docs. +} + +void Window::get_internal_paint_info(Glib::RefPtr<Drawable>& real_drawable, int& x_offset, int& y_offset) const +{ + GdkDrawable* temp_drawable = 0; + gdk_window_get_internal_paint_info(const_cast<GdkWindow*>(gobj()), &temp_drawable, &x_offset, &y_offset); + real_drawable = Glib::wrap(temp_drawable); +} + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Gdk::EventMask>::value_type() +{ + return gdk_event_mask_get_type(); +} + +// static +GType Glib::Value<Gdk::WindowState>::value_type() +{ + return gdk_window_state_get_type(); +} + +// static +GType Glib::Value<Gdk::WindowType>::value_type() +{ + return gdk_window_type_get_type(); +} + +// static +GType Glib::Value<Gdk::WindowAttributesType>::value_type() +{ + return gdk_window_attributes_type_get_type(); +} + +// static +GType Glib::Value<Gdk::WindowHints>::value_type() +{ + return gdk_window_hints_get_type(); +} + +// static +GType Glib::Value<Gdk::WindowTypeHint>::value_type() +{ + return gdk_window_type_hint_get_type(); +} + +// static +GType Glib::Value<Gdk::WMDecoration>::value_type() +{ + return gdk_wm_decoration_get_type(); +} + +// static +GType Glib::Value<Gdk::WMFunction>::value_type() +{ + return gdk_wm_function_get_type(); +} + +// static +GType Glib::Value<Gdk::WindowEdge>::value_type() +{ + return gdk_window_edge_get_type(); +} + +// static +GType Glib::Value<Gdk::Gravity>::value_type() +{ + return gdk_gravity_get_type(); +} + +// static +GType Glib::Value<Gdk::GrabStatus>::value_type() +{ + return gdk_grab_status_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr<Gdk::Window> wrap(GdkWindowObject* object, bool take_copy) +{ + return Glib::RefPtr<Gdk::Window>( dynamic_cast<Gdk::Window*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Window_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Window_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_window_object_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Window_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Window_Class::wrap_new(GObject* object) +{ + return new Window((GdkWindow*)object); +} + + +/* The implementation: */ + +GdkWindow* Window::gobj_copy() +{ + reference(); + return gobj(); +} + +Window::Window(const Glib::ConstructParams& construct_params) +: + Gdk::Drawable(construct_params) +{} + +Window::Window(GdkWindow* castitem) +: + Gdk::Drawable((GdkDrawable*)(castitem)) +{} + +Window::~Window() +{} + + +Window::CppClassType Window::window_class_; // initialize static member + +GType Window::get_type() +{ + return window_class_.init().get_type(); +} + +GType Window::get_base_type() +{ + return gdk_window_object_get_type(); +} + + +Glib::RefPtr<Window> Window::create(const Glib::RefPtr<Window>& parent, GdkWindowAttr* attributes, int attributes_mask) +{ + return Glib::RefPtr<Window>( new Window(parent, attributes, attributes_mask) ); +} +WindowType Window::get_window_type() const +{ + return ((WindowType)(gdk_window_get_window_type(const_cast<GdkWindow*>(gobj())))); +} + +void Window::show() +{ + gdk_window_show(gobj()); +} + +void Window::hide() +{ + gdk_window_hide(gobj()); +} + +void Window::withdraw() +{ + gdk_window_withdraw(gobj()); +} + +void Window::show_unraised() +{ + gdk_window_show_unraised(gobj()); +} + +void Window::move(int x, int y) +{ + gdk_window_move(gobj(), x, y); +} + +void Window::resize(int width, int height) +{ + gdk_window_resize(gobj(), width, height); +} + +void Window::move_resize(int x, int y, int width, int height) +{ + gdk_window_move_resize(gobj(), x, y, width, height); +} + +void Window::reparent(const Glib::RefPtr<Window>& new_parent, int x, int y) +{ + gdk_window_reparent(gobj(), Glib::unwrap(new_parent), x, y); +} + +void Window::clear() +{ + gdk_window_clear(gobj()); +} + +void Window::clear_area(int x, int y, int width, int height) +{ + gdk_window_clear_area(gobj(), x, y, width, height); +} + +void Window::clear_area_e(int x, int y, int width, int height) +{ + gdk_window_clear_area_e(gobj(), x, y, width, height); +} + +void Window::raise() +{ + gdk_window_raise(gobj()); +} + +void Window::lower() +{ + gdk_window_lower(gobj()); +} + +void Window::focus(guint32 timestamp) +{ + gdk_window_focus(gobj(), timestamp); +} + +void Window::set_user_data(gpointer user_data) +{ + gdk_window_set_user_data(gobj(), user_data); +} + +void Window::set_override_redirect(bool override_redirect) +{ + gdk_window_set_override_redirect(gobj(), static_cast<int>(override_redirect)); +} + +void Window::add_filter(GdkFilterFunc function, gpointer data) +{ + gdk_window_add_filter(gobj(), function, data); +} + +void Window::remove_filter(GdkFilterFunc function, gpointer data) +{ + gdk_window_remove_filter(gobj(), function, data); +} + +void Window::scroll(int dx, int dy) +{ + gdk_window_scroll(gobj(), dx, dy); +} + +void Window::shape_combine_mask(const Glib::RefPtr<Bitmap>& mask, int x, int y) +{ + gdk_window_shape_combine_mask(gobj(), Glib::unwrap(mask), x, y); +} + +void Window::shape_combine_region(const Region& shape_region, int offset_x, int offset_y) +{ + gdk_window_shape_combine_region(gobj(), const_cast<GdkRegion*>((shape_region).gobj()), offset_x, offset_y); +} + +void Window::set_child_shapes() +{ + gdk_window_set_child_shapes(gobj()); +} + +void Window::merge_child_shapes() +{ + gdk_window_merge_child_shapes(gobj()); +} + +bool Window::is_visible() const +{ + return gdk_window_is_visible(const_cast<GdkWindow*>(gobj())); +} + +bool Window::is_viewable() const +{ + return gdk_window_is_viewable(const_cast<GdkWindow*>(gobj())); +} + +WindowState Window::get_state() const +{ + return ((WindowState)(gdk_window_get_state(const_cast<GdkWindow*>(gobj())))); +} + +bool Window::set_static_gravities(bool use_static) +{ + return gdk_window_set_static_gravities(gobj(), static_cast<int>(use_static)); +} + +void Window::set_type_hint(WindowTypeHint hint) +{ + gdk_window_set_type_hint(gobj(), ((GdkWindowTypeHint)(hint))); +} + +void Window::set_modal_hint(bool modal) +{ + gdk_window_set_modal_hint(gobj(), static_cast<int>(modal)); +} + +void Window::set_geometry_hints(const Geometry& geometry, WindowHints geom_mask) +{ + gdk_window_set_geometry_hints(gobj(), const_cast<GdkGeometry*>(&(geometry)), ((GdkWindowHints)(geom_mask))); +} + +void Window::set_sm_client_id(const Glib::ustring& sm_client_id) +{ + gdk_set_sm_client_id(sm_client_id.c_str()); +} + +void Window::begin_paint_rect(Rectangle& rectangle) +{ + gdk_window_begin_paint_rect(gobj(), (rectangle).gobj()); +} + +void Window::begin_paint_region(const Region& region) +{ + gdk_window_begin_paint_region(gobj(), const_cast<GdkRegion*>((region).gobj())); +} + +void Window::end_paint() +{ + gdk_window_end_paint(gobj()); +} + +void Window::set_title(const Glib::ustring& title) +{ + gdk_window_set_title(gobj(), title.c_str()); +} + +void Window::set_role(const Glib::ustring& role) +{ + gdk_window_set_role(gobj(), role.c_str()); +} + +void Window::set_transient_for(const Glib::RefPtr<Window>& parent) +{ + gdk_window_set_transient_for(gobj(), Glib::unwrap(parent)); +} + +void Window::set_background(const Color& color) +{ + gdk_window_set_background(gobj(), (color).gobj()); +} + +void Window::set_back_pixmap(const Glib::RefPtr<Pixmap>& pixmap, bool parent_relative) +{ + gdk_window_set_back_pixmap(gobj(), Glib::unwrap(pixmap), static_cast<int>(parent_relative)); +} + +void Window::set_cursor(const Cursor& cursor) +{ + gdk_window_set_cursor(gobj(), (cursor).gobj_copy()); +} + +void Window::get_user_data(gpointer* data) +{ + gdk_window_get_user_data(gobj(), data); +} + +void Window::get_geometry(int& x, int& y, int& width, int& height, int& depth) const +{ + gdk_window_get_geometry(const_cast<GdkWindow*>(gobj()), &x, &y, &width, &height, &depth); +} + +void Window::get_position(int& x, int& y) const +{ + gdk_window_get_position(const_cast<GdkWindow*>(gobj()), &x, &y); +} + +int Window::get_origin(int& x, int& y) const +{ + return gdk_window_get_origin(const_cast<GdkWindow*>(gobj()), &x, &y); +} + +void Window::get_root_origin(int& x, int& y) const +{ + gdk_window_get_root_origin(const_cast<GdkWindow*>(gobj()), &x, &y); +} + +void Window::get_frame_extents(Rectangle& rect) +{ + gdk_window_get_frame_extents(gobj(), (rect).gobj()); +} + +Glib::RefPtr<Window> Window::get_pointer(int& x, int& y, ModifierType& mask) +{ + + Glib::RefPtr<Window> retvalue = Glib::wrap((GdkWindowObject*)(gdk_window_get_pointer(gobj(), &x, &y, ((GdkModifierType*) &(mask))))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Window> Window::get_parent() +{ + + Glib::RefPtr<Window> retvalue = Glib::wrap((GdkWindowObject*)(gdk_window_get_parent(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Window> Window::get_parent() const +{ + + Glib::RefPtr<const Window> retvalue = Glib::wrap((GdkWindowObject*)(gdk_window_get_parent(const_cast<GdkWindow*>(gobj())))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<Window> Window::get_toplevel() +{ + + Glib::RefPtr<Window> retvalue = Glib::wrap((GdkWindowObject*)(gdk_window_get_toplevel(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const Window> Window::get_toplevel() const +{ + + Glib::RefPtr<const Window> retvalue = Glib::wrap((GdkWindowObject*)(gdk_window_get_toplevel(const_cast<GdkWindow*>(gobj())))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::ListHandle< Glib::RefPtr<Window> > Window::get_children() +{ + return Glib::ListHandle< Glib::RefPtr<Window> >(gdk_window_get_children(gobj()), Glib::OWNERSHIP_SHALLOW); +} + +Glib::ListHandle< Glib::RefPtr<const Window> > Window::get_children() const +{ + return Glib::ListHandle< Glib::RefPtr<const Window> >(gdk_window_get_children(const_cast<GdkWindow*>(gobj())), Glib::OWNERSHIP_SHALLOW); +} + +EventMask Window::get_events() const +{ + return ((EventMask)(gdk_window_get_events(const_cast<GdkWindow*>(gobj())))); +} + +void Window::set_events(EventMask event_mask) +{ + gdk_window_set_events(gobj(), ((GdkEventMask)(event_mask))); +} + +void Window::set_icon_list(const Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> >& pixbufs) +{ + gdk_window_set_icon_list(gobj(), pixbufs.data()); +} + +void Window::set_icon(const Glib::RefPtr<Window>& icon_window, const Glib::RefPtr<Pixmap>& pixmap, const Glib::RefPtr<Bitmap>& mask) +{ + gdk_window_set_icon(gobj(), Glib::unwrap(icon_window), Glib::unwrap(pixmap), Glib::unwrap(mask)); +} + +void Window::set_icon_name(const Glib::ustring& name) +{ + gdk_window_set_icon_name(gobj(), name.c_str()); +} + +void Window::set_group(const Glib::RefPtr<Window>& leader) +{ + gdk_window_set_group(gobj(), Glib::unwrap(leader)); +} + +Glib::RefPtr<Window> Window::get_group() +{ + return Glib::wrap((GdkWindowObject*)(gdk_window_get_group(gobj()))); +} + +Glib::RefPtr<const Window> Window::get_group() const +{ + return Glib::wrap((GdkWindowObject*)(gdk_window_get_group(const_cast<GdkWindow*>(gobj())))); +} + +void Window::set_decorations(WMDecoration decorations) +{ + gdk_window_set_decorations(gobj(), ((GdkWMDecoration)(decorations))); +} + +bool Window::get_decorations(WMDecoration& decorations) const +{ + return gdk_window_get_decorations(const_cast<GdkWindow*>(gobj()), ((GdkWMDecoration*) &(decorations))); +} + +void Window::set_functions(WMFunction functions) +{ + gdk_window_set_functions(gobj(), ((GdkWMFunction)(functions))); +} + +Glib::ListHandle< Glib::RefPtr<Window> > Window::get_toplevels() +{ + return Glib::ListHandle< Glib::RefPtr<Window> >(gdk_window_get_toplevels(), Glib::OWNERSHIP_SHALLOW); +} + +void Window::iconify() +{ + gdk_window_iconify(gobj()); +} + +void Window::deiconify() +{ + gdk_window_deiconify(gobj()); +} + +void Window::stick() +{ + gdk_window_stick(gobj()); +} + +void Window::unstick() +{ + gdk_window_unstick(gobj()); +} + +void Window::maximize() +{ + gdk_window_maximize(gobj()); +} + +void Window::unmaximize() +{ + gdk_window_unmaximize(gobj()); +} + +void Window::register_dnd() +{ + gdk_window_register_dnd(gobj()); +} + +void Window::begin_resize_drag(WindowEdge edge, int button, int root_x, int root_y, guint32 timestamp) +{ + gdk_window_begin_resize_drag(gobj(), ((GdkWindowEdge)(edge)), button, root_x, root_y, timestamp); +} + +void Window::begin_move_drag(int button, int root_x, int root_y, guint32 timestamp) +{ + gdk_window_begin_move_drag(gobj(), button, root_x, root_y, timestamp); +} + +void Window::invalidate_rect(const Rectangle& rect, bool invalidate_children) +{ + gdk_window_invalidate_rect(gobj(), const_cast<GdkRectangle*>(rect.gobj()), static_cast<int>(invalidate_children)); +} + +void Window::invalidate_region(const Region& region, bool invalidate_children) +{ + gdk_window_invalidate_region(gobj(), const_cast<GdkRegion*>((region).gobj()), static_cast<int>(invalidate_children)); +} + +Region Window::get_update_area() +{ + return Region(gdk_window_get_update_area(gobj())); +} + +void Window::freeze_updates() +{ + gdk_window_freeze_updates(gobj()); +} + +void Window::thaw_updates() +{ + gdk_window_thaw_updates(gobj()); +} + +void Window::process_all_updates() +{ + gdk_window_process_all_updates(); +} + +void Window::process_updates(bool update_children) +{ + gdk_window_process_updates(gobj(), static_cast<int>(update_children)); +} + +void Window::set_debug_updates(bool setting) +{ + gdk_window_set_debug_updates(static_cast<int>(setting)); +} + +void Window::constrain_size(const Geometry& geometry, guint flags, int width, int height, int& new_width, int& new_height) +{ + gdk_window_constrain_size(const_cast<GdkGeometry*>(&(geometry)), flags, width, height, &new_width, &new_height); +} + +void Window::enable_synchronized_configure() +{ + gdk_window_enable_synchronized_configure(gobj()); +} + +void Window::configure_finished() +{ + gdk_window_configure_finished(gobj()); +} + +void Window::set_skip_taskbar_hint(bool skips_taskbar) +{ + gdk_window_set_skip_taskbar_hint(gobj(), static_cast<int>(skips_taskbar)); +} + +void Window::set_skip_pager_hint(bool skips_pager) +{ + gdk_window_set_skip_pager_hint(gobj(), static_cast<int>(skips_pager)); +} + +void Window::fullscreen() +{ + gdk_window_fullscreen(gobj()); +} + +void Window::unfullscreen() +{ + gdk_window_unfullscreen(gobj()); +} + +GrabStatus Window::pointer_grab(bool owner_events, EventMask event_mask, const Glib::RefPtr<const Window>& confine_to, const Cursor& cursor, guint32 time_) +{ + return ((GrabStatus)(gdk_pointer_grab(gobj(), static_cast<int>(owner_events), ((GdkEventMask)(event_mask)), const_cast<GdkWindow*>(Glib::unwrap<Gdk::Window>(confine_to)), (cursor).gobj_copy(), time_))); +} + +void Window::pointer_ungrab(guint32 timestamp) +{ + gdk_pointer_ungrab(timestamp); +} + +GrabStatus Window::keyboard_grab(bool owner_events, guint32 timestamp) +{ + return ((GrabStatus)(gdk_keyboard_grab(gobj(), static_cast<int>(owner_events), timestamp))); +} + +void Window::keyboard_ungrab(guint32 timestamp) +{ + gdk_keyboard_ungrab(timestamp); +} + +void Window::set_keep_above(bool setting) +{ + gdk_window_set_keep_above(gobj(), static_cast<int>(setting)); +} + +void Window::set_keep_below(bool setting) +{ + gdk_window_set_keep_below(gobj(), static_cast<int>(setting)); +} + +void Window::set_accept_focus(bool accept_focus) +{ + gdk_window_set_accept_focus(gobj(), static_cast<int>(accept_focus)); +} + +void Window::set_focus_on_map(bool focus_on_map) +{ + gdk_window_set_focus_on_map(gobj(), static_cast<int>(focus_on_map)); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/window.h b/libs/gtkmm2/gdk/gdkmm/window.h new file mode 100644 index 0000000000..7b8d9c614d --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/window.h @@ -0,0 +1,1906 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_WINDOW_H +#define _GDKMM_WINDOW_H + +#include <glibmm.h> + +/* $Id$ */ + +/* Copyright(C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License or(at your option) any later version. + * + * This library is distributed in the hope that it will be useful + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not write to the Free + * Software Foundation Inc. 675 Mass Ave Cambridge MA 02139 USA. + */ + +#include <gdkmm/drawable.h> +#include <gdkmm/bitmap.h> +//#include <gdkmm/cursor.h> +#include <gdkmm/types.h> +#include <gdkmm/region.h> +#include <gdk/gdkwindow.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { +// Custom struct prototype, because this isn't what the code-generator expects: +typedef struct _GdkDrawable GdkWindow; +} // extern "C" +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Window_Class; } // namespace Gdk +namespace Gdk +{ + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * <tt>%EventMask operator|(EventMask, EventMask)</tt><br> + * <tt>%EventMask operator&(EventMask, EventMask)</tt><br> + * <tt>%EventMask operator^(EventMask, EventMask)</tt><br> + * <tt>%EventMask operator~(EventMask)</tt><br> + * <tt>%EventMask& operator|=(EventMask&, EventMask)</tt><br> + * <tt>%EventMask& operator&=(EventMask&, EventMask)</tt><br> + * <tt>%EventMask& operator^=(EventMask&, EventMask)</tt><br> + */ +enum EventMask +{ + EXPOSURE_MASK = 1 << 1, + POINTER_MOTION_MASK = 1 << 2, + POINTER_MOTION_HINT_MASK = 1 << 3, + BUTTON_MOTION_MASK = 1 << 4, + BUTTON1_MOTION_MASK = 1 << 5, + BUTTON2_MOTION_MASK = 1 << 6, + BUTTON3_MOTION_MASK = 1 << 7, + BUTTON_PRESS_MASK = 1 << 8, + BUTTON_RELEASE_MASK = 1 << 9, + KEY_PRESS_MASK = 1 << 10, + KEY_RELEASE_MASK = 1 << 11, + ENTER_NOTIFY_MASK = 1 << 12, + LEAVE_NOTIFY_MASK = 1 << 13, + FOCUS_CHANGE_MASK = 1 << 14, + STRUCTURE_MASK = 1 << 15, + PROPERTY_CHANGE_MASK = 1 << 16, + VISIBILITY_NOTIFY_MASK = 1 << 17, + PROXIMITY_IN_MASK = 1 << 18, + PROXIMITY_OUT_MASK = 1 << 19, + SUBSTRUCTURE_MASK = 1 << 20, + SCROLL_MASK = 1 << 21, + ALL_EVENTS_MASK = 0x3FFFFE +}; + +/** @ingroup gdkmmEnums */ +inline EventMask operator|(EventMask lhs, EventMask rhs) + { return static_cast<EventMask>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline EventMask operator&(EventMask lhs, EventMask rhs) + { return static_cast<EventMask>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline EventMask operator^(EventMask lhs, EventMask rhs) + { return static_cast<EventMask>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline EventMask operator~(EventMask flags) + { return static_cast<EventMask>(~static_cast<unsigned>(flags)); } + +/** @ingroup gdkmmEnums */ +inline EventMask& operator|=(EventMask& lhs, EventMask rhs) + { return (lhs = static_cast<EventMask>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline EventMask& operator&=(EventMask& lhs, EventMask rhs) + { return (lhs = static_cast<EventMask>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline EventMask& operator^=(EventMask& lhs, EventMask rhs) + { return (lhs = static_cast<EventMask>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::EventMask> : public Glib::Value_Flags<Gdk::EventMask> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * <tt>%WindowState operator|(WindowState, WindowState)</tt><br> + * <tt>%WindowState operator&(WindowState, WindowState)</tt><br> + * <tt>%WindowState operator^(WindowState, WindowState)</tt><br> + * <tt>%WindowState operator~(WindowState)</tt><br> + * <tt>%WindowState& operator|=(WindowState&, WindowState)</tt><br> + * <tt>%WindowState& operator&=(WindowState&, WindowState)</tt><br> + * <tt>%WindowState& operator^=(WindowState&, WindowState)</tt><br> + */ +enum WindowState +{ + WINDOW_STATE_WITHDRAWN = 1 << 0, + WINDOW_STATE_ICONIFIED = 1 << 1, + WINDOW_STATE_MAXIMIZED = 1 << 2, + WINDOW_STATE_STICKY = 1 << 3, + WINDOW_STATE_FULLSCREEN = 1 << 4, + WINDOW_STATE_ABOVE = 1 << 5, + WINDOW_STATE_BELOW = 1 << 6 +}; + +/** @ingroup gdkmmEnums */ +inline WindowState operator|(WindowState lhs, WindowState rhs) + { return static_cast<WindowState>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WindowState operator&(WindowState lhs, WindowState rhs) + { return static_cast<WindowState>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WindowState operator^(WindowState lhs, WindowState rhs) + { return static_cast<WindowState>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WindowState operator~(WindowState flags) + { return static_cast<WindowState>(~static_cast<unsigned>(flags)); } + +/** @ingroup gdkmmEnums */ +inline WindowState& operator|=(WindowState& lhs, WindowState rhs) + { return (lhs = static_cast<WindowState>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WindowState& operator&=(WindowState& lhs, WindowState rhs) + { return (lhs = static_cast<WindowState>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WindowState& operator^=(WindowState& lhs, WindowState rhs) + { return (lhs = static_cast<WindowState>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::WindowState> : public Glib::Value_Flags<Gdk::WindowState> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum WindowType +{ + WINDOW_ROOT, + WINDOW_TOPLEVEL, + WINDOW_CHILD, + WINDOW_DIALOG, + WINDOW_TEMP, + WINDOW_FOREIGN +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::WindowType> : public Glib::Value_Enum<Gdk::WindowType> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * <tt>%WindowAttributesType operator|(WindowAttributesType, WindowAttributesType)</tt><br> + * <tt>%WindowAttributesType operator&(WindowAttributesType, WindowAttributesType)</tt><br> + * <tt>%WindowAttributesType operator^(WindowAttributesType, WindowAttributesType)</tt><br> + * <tt>%WindowAttributesType operator~(WindowAttributesType)</tt><br> + * <tt>%WindowAttributesType& operator|=(WindowAttributesType&, WindowAttributesType)</tt><br> + * <tt>%WindowAttributesType& operator&=(WindowAttributesType&, WindowAttributesType)</tt><br> + * <tt>%WindowAttributesType& operator^=(WindowAttributesType&, WindowAttributesType)</tt><br> + */ +enum WindowAttributesType +{ + WA_TITLE = 1 << 1, + WA_X = 1 << 2, + WA_Y = 1 << 3, + WA_CURSOR = 1 << 4, + WA_COLORMAP = 1 << 5, + WA_VISUAL = 1 << 6, + WA_WMCLASS = 1 << 7, + WA_NOREDIR = 1 << 8 +}; + +/** @ingroup gdkmmEnums */ +inline WindowAttributesType operator|(WindowAttributesType lhs, WindowAttributesType rhs) + { return static_cast<WindowAttributesType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WindowAttributesType operator&(WindowAttributesType lhs, WindowAttributesType rhs) + { return static_cast<WindowAttributesType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WindowAttributesType operator^(WindowAttributesType lhs, WindowAttributesType rhs) + { return static_cast<WindowAttributesType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WindowAttributesType operator~(WindowAttributesType flags) + { return static_cast<WindowAttributesType>(~static_cast<unsigned>(flags)); } + +/** @ingroup gdkmmEnums */ +inline WindowAttributesType& operator|=(WindowAttributesType& lhs, WindowAttributesType rhs) + { return (lhs = static_cast<WindowAttributesType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WindowAttributesType& operator&=(WindowAttributesType& lhs, WindowAttributesType rhs) + { return (lhs = static_cast<WindowAttributesType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WindowAttributesType& operator^=(WindowAttributesType& lhs, WindowAttributesType rhs) + { return (lhs = static_cast<WindowAttributesType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::WindowAttributesType> : public Glib::Value_Flags<Gdk::WindowAttributesType> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * <tt>%WindowHints operator|(WindowHints, WindowHints)</tt><br> + * <tt>%WindowHints operator&(WindowHints, WindowHints)</tt><br> + * <tt>%WindowHints operator^(WindowHints, WindowHints)</tt><br> + * <tt>%WindowHints operator~(WindowHints)</tt><br> + * <tt>%WindowHints& operator|=(WindowHints&, WindowHints)</tt><br> + * <tt>%WindowHints& operator&=(WindowHints&, WindowHints)</tt><br> + * <tt>%WindowHints& operator^=(WindowHints&, WindowHints)</tt><br> + */ +enum WindowHints +{ + HINT_POS = 1 << 0, + HINT_MIN_SIZE = 1 << 1, + HINT_MAX_SIZE = 1 << 2, + HINT_BASE_SIZE = 1 << 3, + HINT_ASPECT = 1 << 4, + HINT_RESIZE_INC = 1 << 5, + HINT_WIN_GRAVITY = 1 << 6, + HINT_USER_POS = 1 << 7, + HINT_USER_SIZE = 1 << 8 +}; + +/** @ingroup gdkmmEnums */ +inline WindowHints operator|(WindowHints lhs, WindowHints rhs) + { return static_cast<WindowHints>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WindowHints operator&(WindowHints lhs, WindowHints rhs) + { return static_cast<WindowHints>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WindowHints operator^(WindowHints lhs, WindowHints rhs) + { return static_cast<WindowHints>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WindowHints operator~(WindowHints flags) + { return static_cast<WindowHints>(~static_cast<unsigned>(flags)); } + +/** @ingroup gdkmmEnums */ +inline WindowHints& operator|=(WindowHints& lhs, WindowHints rhs) + { return (lhs = static_cast<WindowHints>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WindowHints& operator&=(WindowHints& lhs, WindowHints rhs) + { return (lhs = static_cast<WindowHints>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WindowHints& operator^=(WindowHints& lhs, WindowHints rhs) + { return (lhs = static_cast<WindowHints>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::WindowHints> : public Glib::Value_Flags<Gdk::WindowHints> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum WindowTypeHint +{ + WINDOW_TYPE_HINT_NORMAL, + WINDOW_TYPE_HINT_DIALOG, + WINDOW_TYPE_HINT_MENU, + WINDOW_TYPE_HINT_TOOLBAR, + WINDOW_TYPE_HINT_SPLASHSCREEN, + WINDOW_TYPE_HINT_UTILITY, + WINDOW_TYPE_HINT_DOCK, + WINDOW_TYPE_HINT_DESKTOP +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::WindowTypeHint> : public Glib::Value_Enum<Gdk::WindowTypeHint> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * <tt>%WMDecoration operator|(WMDecoration, WMDecoration)</tt><br> + * <tt>%WMDecoration operator&(WMDecoration, WMDecoration)</tt><br> + * <tt>%WMDecoration operator^(WMDecoration, WMDecoration)</tt><br> + * <tt>%WMDecoration operator~(WMDecoration)</tt><br> + * <tt>%WMDecoration& operator|=(WMDecoration&, WMDecoration)</tt><br> + * <tt>%WMDecoration& operator&=(WMDecoration&, WMDecoration)</tt><br> + * <tt>%WMDecoration& operator^=(WMDecoration&, WMDecoration)</tt><br> + */ +enum WMDecoration +{ + DECOR_ALL = 1 << 0, + DECOR_BORDER = 1 << 1, + DECOR_RESIZEH = 1 << 2, + DECOR_TITLE = 1 << 3, + DECOR_MENU = 1 << 4, + DECOR_MINIMIZE = 1 << 5, + DECOR_MAXIMIZE = 1 << 6 +}; + +/** @ingroup gdkmmEnums */ +inline WMDecoration operator|(WMDecoration lhs, WMDecoration rhs) + { return static_cast<WMDecoration>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WMDecoration operator&(WMDecoration lhs, WMDecoration rhs) + { return static_cast<WMDecoration>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WMDecoration operator^(WMDecoration lhs, WMDecoration rhs) + { return static_cast<WMDecoration>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WMDecoration operator~(WMDecoration flags) + { return static_cast<WMDecoration>(~static_cast<unsigned>(flags)); } + +/** @ingroup gdkmmEnums */ +inline WMDecoration& operator|=(WMDecoration& lhs, WMDecoration rhs) + { return (lhs = static_cast<WMDecoration>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WMDecoration& operator&=(WMDecoration& lhs, WMDecoration rhs) + { return (lhs = static_cast<WMDecoration>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WMDecoration& operator^=(WMDecoration& lhs, WMDecoration rhs) + { return (lhs = static_cast<WMDecoration>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::WMDecoration> : public Glib::Value_Flags<Gdk::WMDecoration> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * <tt>%WMFunction operator|(WMFunction, WMFunction)</tt><br> + * <tt>%WMFunction operator&(WMFunction, WMFunction)</tt><br> + * <tt>%WMFunction operator^(WMFunction, WMFunction)</tt><br> + * <tt>%WMFunction operator~(WMFunction)</tt><br> + * <tt>%WMFunction& operator|=(WMFunction&, WMFunction)</tt><br> + * <tt>%WMFunction& operator&=(WMFunction&, WMFunction)</tt><br> + * <tt>%WMFunction& operator^=(WMFunction&, WMFunction)</tt><br> + */ +enum WMFunction +{ + FUNC_ALL = 1 << 0, + FUNC_RESIZE = 1 << 1, + FUNC_MOVE = 1 << 2, + FUNC_MINIMIZE = 1 << 3, + FUNC_MAXIMIZE = 1 << 4, + FUNC_CLOSE = 1 << 5 +}; + +/** @ingroup gdkmmEnums */ +inline WMFunction operator|(WMFunction lhs, WMFunction rhs) + { return static_cast<WMFunction>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WMFunction operator&(WMFunction lhs, WMFunction rhs) + { return static_cast<WMFunction>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WMFunction operator^(WMFunction lhs, WMFunction rhs) + { return static_cast<WMFunction>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WMFunction operator~(WMFunction flags) + { return static_cast<WMFunction>(~static_cast<unsigned>(flags)); } + +/** @ingroup gdkmmEnums */ +inline WMFunction& operator|=(WMFunction& lhs, WMFunction rhs) + { return (lhs = static_cast<WMFunction>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WMFunction& operator&=(WMFunction& lhs, WMFunction rhs) + { return (lhs = static_cast<WMFunction>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WMFunction& operator^=(WMFunction& lhs, WMFunction rhs) + { return (lhs = static_cast<WMFunction>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::WMFunction> : public Glib::Value_Flags<Gdk::WMFunction> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum WindowEdge +{ + WINDOW_EDGE_NORTH_WEST, + WINDOW_EDGE_NORTH, + WINDOW_EDGE_NORTH_EAST, + WINDOW_EDGE_WEST, + WINDOW_EDGE_EAST, + WINDOW_EDGE_SOUTH_WEST, + WINDOW_EDGE_SOUTH, + WINDOW_EDGE_SOUTH_EAST +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::WindowEdge> : public Glib::Value_Enum<Gdk::WindowEdge> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum Gravity +{ + GRAVITY_NORTH_WEST = 1, + GRAVITY_NORTH, + GRAVITY_NORTH_EAST, + GRAVITY_WEST, + GRAVITY_CENTER, + GRAVITY_EAST, + GRAVITY_SOUTH_WEST, + GRAVITY_SOUTH, + GRAVITY_SOUTH_EAST, + GRAVITY_STATIC +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::Gravity> : public Glib::Value_Enum<Gdk::Gravity> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum GrabStatus +{ + GRAB_SUCCESS, + GRAB_ALREADY_GRABBED, + GRAB_INVALID_TIME, + GRAB_NOT_VIEWABLE, + GRAB_FROZEN +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Gdk::GrabStatus> : public Glib::Value_Enum<Gdk::GrabStatus> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +class Cursor; + +/** A Gdk::Window is a rectangular region on the screen. It's a low-level object, used to implement high-level objects such + * as Gtk::Widget and Gtk::Window on the GTK+ level. A Gtk::Window is a toplevel window, the thing a user might think of as + * a "window" with a titlebar and so on; a Gtk::Window may contain many Gdk::Windows. For example, each Gtk::Button has a + * Gdk::Window associated with it. + */ + +class Window : public Gdk::Drawable +{ + // GdkWindow is a typedef to GdkDrawable, but it's actually a GdkWindowObject. + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Window CppObjectType; + typedef Window_Class CppClassType; + typedef GdkWindow BaseObjectType; + typedef GdkWindowObjectClass BaseClassType; + +private: friend class Window_Class; + static CppClassType window_class_; + +private: + // noncopyable + Window(const Window&); + Window& operator=(const Window&); + +protected: + explicit Window(const Glib::ConstructParams& construct_params); + explicit Window(GdkWindow* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Window(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkWindow* gobj() { return reinterpret_cast<GdkWindow*>(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkWindow* gobj() const { return reinterpret_cast<GdkWindow*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkWindow* gobj_copy(); + +private: + + +protected: + Window(const Glib::RefPtr<Window>& parent, GdkWindowAttr* attributes, int attributes_mask); + +public: + + static Glib::RefPtr<Window> create(const Glib::RefPtr<Window>& parent, GdkWindowAttr* attributes, int attributes_mask); + + + /** Gets the type of the window. See Gdk::WindowType. + * @return Type of window. + */ + WindowType get_window_type() const; + + /** Like gdk_window_show_unraised(), but also raises the window to the + * top of the window stack (moves the window to the front of the + * Z-order). + * + * This function maps a window so it's visible onscreen. Its opposite + * is gdk_window_hide(). + * + * When implementing a Gtk::Widget, you should call this function on the widget's + * Gdk::Window as part of the "map" method. + */ + void show(); + + /** For toplevel windows, withdraws them, so they will no longer be + * known to the window manager; for all windows, unmaps them, so + * they won't be displayed. Normally done automatically as + * part of gtk_widget_hide(). + */ + void hide(); + + /** Withdraws a window (unmaps it and asks the window manager to forget about it). + * This function is not really useful as gdk_window_hide() automatically + * withdraws toplevel windows before hiding them. + */ + void withdraw(); + + /** Shows a Gdk::Window onscreen, but does not modify its stacking + * order. In contrast, gdk_window_show() will raise the window + * to the top of the window stack. + * + * On the X11 platform, in Xlib terms, this function calls + * XMapWindow() (it also updates some internal GDK state, which means + * that you can't really use XMapWindow() directly on a GDK window). + */ + void show_unraised(); + + /** Repositions a window relative to its parent window. + * For toplevel windows, window managers may ignore or modify the move; + * you should probably use gtk_window_move() on a Gtk::Window widget + * anyway, instead of using GDK functions. For child windows, + * the move will reliably succeed. + * + * If you're also planning to resize the window, use gdk_window_move_resize() + * to both move and resize simultaneously, for a nicer visual effect. + * @param x X coordinate relative to window's parent. + * @param y Y coordinate relative to window's parent. + */ + void move(int x, int y); + + /** Resizes @a window ; for toplevel windows, asks the window manager to resize + * the window. The window manager may not allow the resize. When using GTK+, + * use gtk_window_resize() instead of this low-level GDK function. + * + * Windows may not be resized below 1x1. + * + * If you're also planning to move the window, use gdk_window_move_resize() + * to both move and resize simultaneously, for a nicer visual effect. + * @param width New width of the window. + * @param height New height of the window. + */ + void resize(int width, int height); + + /** Equivalent to calling gdk_window_move() and gdk_window_resize(), + * except that both operations are performed at once, avoiding strange + * visual effects. (i.e. the user may be able to see the window first + * move, then resize, if you don't use gdk_window_move_resize().) + * @param x New X position relative to window's parent. + * @param y New Y position relative to window's parent. + * @param width New width. + * @param height New height. + */ + void move_resize(int x, int y, int width, int height); + + /** Reparents @a window into the given @a new_parent . The window being + * reparented will be unmapped as a side effect. + * @param new_parent New parent to move @a window into. + * @param x X location inside the new parent. + * @param y Y location inside the new parent. + */ + void reparent(const Glib::RefPtr<Window>& new_parent, int x, int y); + + /** Clears an entire @a window to the background color or background pixmap. + */ + void clear(); + + /** Clears an area of @a window to the background color or background pixmap. + * @param x X coordinate of rectangle to clear. + * @param y Y coordinate of rectangle to clear. + * @param width Width of rectangle to clear. + * @param height Height of rectangle to clear. + */ + void clear_area(int x, int y, int width, int height); + + /** Like gdk_window_clear_area(), but also generates an expose event for + * the cleared area. + * + * This function has a stupid name because it dates back to the mists + * time, pre-GDK-1.0. + * @param x X coordinate of rectangle to clear. + * @param y Y coordinate of rectangle to clear. + * @param width Width of rectangle to clear. + * @param height Height of rectangle to clear. + */ + void clear_area_e(int x, int y, int width, int height); + + /** Raises @a window to the top of the Z-order (stacking order), so that + * other windows with the same parent window appear below @a window . + * This is true whether or not the windows are visible. + * + * If @a window is a toplevel, the window manager may choose to deny the + * request to move the window in the Z-order, gdk_window_raise() only + * requests the restack, does not guarantee it. + */ + void raise(); + + /** Lowers @a window to the bottom of the Z-order (stacking order), so that + * other windows with the same parent window appear above @a window . + * This is true whether or not the other windows are visible. + * + * If @a window is a toplevel, the window manager may choose to deny the + * request to move the window in the Z-order, gdk_window_lower() only + * requests the restack, does not guarantee it. + * + * Note that gdk_window_show() raises the window again, so don't call this + * function before gdk_window_show(). (Try gdk_window_show_unraised().) + */ + void lower(); + + /** Sets keyboard focus to @a window . If @a window is not onscreen this + * will not work. In most cases, gtk_window_present() should be used on + * a Gtk::Window, rather than calling this function. + * @param timestamp Timestamp of the event triggering the window focus. + */ + void focus(guint32 timestamp); + + /** For most purposes this function is deprecated in favor of + * Glib::object_set_data(). However, for historical reasons GTK+ stores + * the Gtk::Widget that owns a Gdk::Window as user data on the + * Gdk::Window. So, custom widget implementations should use + * this function for that. If GTK+ receives an event for a Gdk::Window, + * and the user data for the window is non-<tt>0</tt>, GTK+ will assume the + * user data is a Gtk::Widget, and forward the event to that widget. + * @param user_data User data. + */ + void set_user_data(gpointer user_data); + + /** An override redirect window is not under the control of the window manager. + * This means it won't have a titlebar, won't be minimizable, etc. - it will + * be entirely under the control of the application. The window manager + * can't see the override redirect window at all. + * + * Override redirect should only be used for short-lived temporary + * windows, such as popup menus. Gtk::Menu uses an override redirect + * window in its implementation, for example. + * @param override_redirect <tt>true</tt> if window should be override redirect. + */ + void set_override_redirect(bool override_redirect = true); + + //We could wrap these with a Slot instead of a C callback, but these methods are very low-level anyway. + + /** Adds an event filter to @a window , allowing you to intercept events + * before they reach GDK. This is a low-level operation and makes it + * easy to break GDK and/or GTK+, so you have to know what you're + * doing. Pass <tt>0</tt> for @a window to get all events for all windows, + * instead of events for a specific window. + * @param function Filter callback. + * @param data Data to pass to filter callback. + */ + void add_filter(GdkFilterFunc function, gpointer data); + + /** Remove a filter previously added with gdk_window_add_filter(). + * @param function Previously-added filter function. + * @param data User data for previously-added filter function. + */ + void remove_filter(GdkFilterFunc function, gpointer data); + + + /** Scroll the contents of @a window , both pixels and children, by the given + * amount. @a window itself does not move. Portions of the window that the scroll + * operation brings in from offscreen areas are invalidated. The invalidated + * region may be bigger than what would strictly be necessary. (For X11, a + * minimum area will be invalidated if the window has no subwindows, or if the + * edges of the window's parent do not extend beyond the edges of the window. In + * other cases, a multi-step process is used to scroll the window which may + * produce temporary visual artifacts and unnecessary invalidations.) + * @param dx Amount to scroll in the X direction. + * @param dy Amount to scroll in the Y direction. + */ + void scroll(int dx, int dy); + + /** Applies a shape mask to @a window . Pixels in @a window corresponding to + * set bits in the @a mask will be visible; pixels in @a window + * corresponding to unset bits in the @a mask will be transparent. This + * gives a non-rectangular window. + * + * If @a mask is <tt>0</tt>, the shape mask will be unset, and the @a x / @a y + * parameters are not used. + * + * On the X11 platform, this uses an X server extension which is + * widely available on most common platforms, but not available on + * very old X servers, and occasionally the implementation will be + * buggy. On servers without the shape extension, this function + * will do nothing. + * + * This function works on both toplevel and child windows. + * @param mask Shape mask. + * @param x X position of shape mask with respect to @a window . + * @param y Y position of shape mask with respect to @a window . + */ + void shape_combine_mask(const Glib::RefPtr<Bitmap>& mask, int x, int y); + void unset_shape_combine_mask(); + + + /** Makes pixels in @a window outside @a shape_region be transparent, + * so that the window may be nonrectangular. See also + * gdk_window_shape_combine_mask() to use a bitmap as the mask. + * + * If @a shape_region is <tt>0</tt>, the shape will be unset, so the whole + * window will be opaque again. @a offset_x and @a offset_y are ignored + * if @a shape_region is <tt>0</tt>. + * + * On the X11 platform, this uses an X server extension which is + * widely available on most common platforms, but not available on + * very old X servers, and occasionally the implementation will be + * buggy. On servers without the shape extension, this function + * will do nothing. + * + * This function works on both toplevel and child windows. + * @param shape_region Region of window to be non-transparent. + * @param offset_x X position of @a shape_region in @a window coordinates. + * @param offset_y Y position of @a shape_region in @a window coordinates. + */ + void shape_combine_region(const Region& shape_region, int offset_x, int offset_y); + + /** Sets the shape mask of @a window to the union of shape masks + * for all children of @a window , ignoring the shape mask of @a window + * itself. Contrast with gdk_window_merge_child_shapes() which includes + * the shape mask of @a window in the masks to be merged. + */ + void set_child_shapes(); + + /** Merges the shape masks for any child windows into the + * shape mask for @a window . i.e. the union of all masks + * for @a window and its children will become the new mask + * for @a window . See gdk_window_shape_combine_mask(). + * + * This function is distinct from gdk_window_set_child_shapes() + * because it includes @a window 's shape mask in the set of shapes to + * be merged. + */ + void merge_child_shapes(); + + /** Checks whether the window has been mapped (with gdk_window_show() or + * gdk_window_show_unraised()). + * @return <tt>true</tt> if the window is mapped. + */ + bool is_visible() const; + + /** Check if the window and all ancestors of the window are + * mapped. (This is not necessarily "viewable" in the X sense, since + * we only check as far as we have GDK window parents, not to the root + * window.) + * @return <tt>true</tt> if the window is viewable. + */ + bool is_viewable() const; + + /** Gets the bitwise OR of the currently active window state flags, + * from the Gdk::WindowState enumeration. + * @return Window state bitfield. + */ + WindowState get_state() const; + + /** Set the bit gravity of the given window to static, and flag it so + * all children get static subwindow gravity. This is used if you are + * implementing scary features that involve deep knowledge of the + * windowing system. Don't worry about it unless you have to. + * @param use_static <tt>true</tt> to turn on static gravity. + * @return <tt>true</tt> if the server supports static gravity. + */ + bool set_static_gravities(bool use_static = true); + + /** The application can use this call to provide a hint to the window + * manager about the functionality of a window. The window manager + * can use this information when determining the decoration and behaviour + * of the window. + * + * The hint must be set before the window is mapped. + * @param hint A hint of the function this window will have. + */ + void set_type_hint(WindowTypeHint hint); + + /** The application can use this hint to tell the window manager + * that a certain window has modal behaviour. The window manager + * can use this information to handle modal windows in a special + * way. + * + * You should only use this on windows for which you have + * previously called #gdk_window_set_transient_for() + * @param modal <tt>true</tt> if the window is modal, <tt>false</tt> otherwise. + */ + void set_modal_hint(bool modal = true); + + /** Sets the geometry hints for @a window . Hints flagged in @a geom_mask + * are set, hints not flagged in @a geom_mask are unset. + * To unset all hints, use a @a geom_mask of 0 and a @a geometry of <tt>0</tt>. + * + * This function provides hints to the windowing system about + * acceptable sizes for a toplevel window. The purpose of + * this is to constrain user resizing, but the windowing system + * will typically (but is not required to) also constrain the + * current size of the window to the provided values and + * constrain programatic resizing via gdk_window_resize() or + * gdk_window_move_resize(). + * + * Note that on X11, this effect has no effect on windows + * of type GDK_WINDOW_TEMP or windows where override_redirect + * has been turned on via gdk_window_set_override_redirect() + * since these windows are not resizable by the user. + * + * Since you can't count on the windowing system doing the + * constraints for programmatic resizes, you should generally + * call gdk_window_constrain_size() yourself to determine + * appropriate sizes. + * @param geometry Geometry hints. + * @param geom_mask Bitmask indicating fields of @a geometry to pay attention to. + */ + void set_geometry_hints(const Geometry& geometry, WindowHints geom_mask); + + /** Sets the <tt>SM_CLIENT_ID</tt> property on the application's leader window so that + * the window manager can save the application's state using the X11R6 ICCCM + * session management protocol. + * + * See the X Session Management Library documentation for more information on + * session management and the Inter-Client Communication Conventions Manual + * (ICCCM) for information on the <tt>WM_CLIENT_LEADER</tt> property. + * (Both documents are part of the X %Window System distribution.) + * @param sm_client_id The client id assigned by the session manager when the + * connection was opened. + */ + static void set_sm_client_id(const Glib::ustring& sm_client_id); + static void unset_sm_client_id(); + + + /** A convenience wrapper around gdk_window_begin_paint_region() which + * creates a rectangular region for you. See + * gdk_window_begin_paint_region() for details. + * @param rectangle Rectangle you intend to draw to. + */ + void begin_paint_rect(Rectangle&rectangle); + + /** Indicates that you are beginning the process of redrawing @a region . + * A backing store (offscreen buffer) large enough to contain @a region + * will be created. The backing store will be initialized with the + * background color or background pixmap for @a window . Then, all + * drawing operations performed on @a window will be diverted to the + * backing store. When you call gdk_window_end_paint(), the backing + * store will be copied to @a window , making it visible onscreen. Only + * the part of @a window contained in @a region will be modified; that is, + * drawing operations are clipped to @a region . + * + * The net result of all this is to remove flicker, because the user + * sees the finished product appear all at once when you call + * gdk_window_end_paint(). If you draw to @a window directly without + * calling gdk_window_begin_paint_region(), the user may see flicker + * as individual drawing operations are performed in sequence. The + * clipping and background-initializing features of + * gdk_window_begin_paint_region() are conveniences for the + * programmer, so you can avoid doing that work yourself. + * + * When using GTK+, the widget system automatically places calls to + * gdk_window_begin_paint_region() and gdk_window_end_paint() around + * emissions of the expose_event signal. That is, if you're writing an + * expose event handler, you can assume that the exposed area in + * Gdk::EventExpose has already been cleared to the window background, + * is already set as the clip region, and already has a backing store. + * Therefore in most cases, application code need not call + * gdk_window_begin_paint_region(). (You can disable the automatic + * calls around expose events on a widget-by-widget basis by calling + * gtk_widget_set_double_buffered().) + * + * If you call this function multiple times before calling the + * matching gdk_window_end_paint(), the backing stores are pushed onto + * a stack. gdk_window_end_paint() copies the topmost backing store + * onscreen, subtracts the topmost region from all other regions in + * the stack, and pops the stack. All drawing operations affect only + * the topmost backing store in the stack. One matching call to + * gdk_window_end_paint() is required for each call to + * gdk_window_begin_paint_region(). + * @param region Region you intend to draw to. + */ + void begin_paint_region(const Region& region); + + /** Indicates that the backing store created by the most recent call to + * gdk_window_begin_paint_region() should be copied onscreen and + * deleted, leaving the next-most-recent backing store or no backing + * store at all as the active paint region. See + * gdk_window_begin_paint_region() for full details. It is an error to + * call this function without a matching + * gdk_window_begin_paint_region() first. + */ + void end_paint(); + + /** Sets the title of a toplevel window, to be displayed in the titlebar. + * If you haven't explicitly set the icon name for the window + * (using gdk_window_set_icon_name()), the icon name will be set to + * @a title as well. @a title must be in UTF-8 encoding (as with all + * user-readable strings in GDK/GTK+). @a title may not be <tt>0</tt>. + * @param title Title of @a window . + */ + void set_title(const Glib::ustring& title); + + /** When using GTK+, typically you should use gtk_window_set_role() instead + * of this low-level function. + * + * The window manager and session manager use a window's role to + * distinguish it from other kinds of window in the same application. + * When an application is restarted after being saved in a previous + * session, all windows with the same title and role are treated as + * interchangeable. So if you have two windows with the same title + * that should be distinguished for session management purposes, you + * should set the role on those windows. It doesn't matter what string + * you use for the role, as long as you have a different role for each + * non-interchangeable kind of window. + * @param role A string indicating its role. + */ + void set_role(const Glib::ustring& role); + + /** Indicates to the window manager that @a window is a transient dialog + * associated with the application window @a parent . This allows the + * window manager to do things like center @a window on @a parent and + * keep @a window above @a parent . + * + * See gtk_window_set_transient_for() if you're using Gtk::Window or + * Gtk::Dialog. + * @param parent Another toplevel Gdk::Window. + */ + void set_transient_for(const Glib::RefPtr<Window>& parent); + + /** Sets the background color of @a window . (However, when using GTK+, + * set the background of a widget with gtk_widget_modify_bg() - if + * you're an application - or gtk_style_set_background() - if you're + * implementing a custom widget.) + * + * The @a color must be allocated; gdk_rgb_find_color() is the best way + * to allocate a color. + * + * See also gdk_window_set_back_pixmap(). + * @param color An allocated Gdk::Color. + */ + void set_background(const Color& color); + + /** Sets the background pixmap of @a window . May also be used to set a background of + * "None" on @a window , by setting a background pixmap of <tt>0</tt>. + * A background pixmap will be tiled, positioning the first tile at the origin of + * @a window , or if @a parent_relative is <tt>true</tt>, the tiling will be done based on the + * origin of the parent window (useful to align tiles in a parent with tiles + * in a child). + * + * A background pixmap of <tt>0</tt> means that the window will have no + * background. A window with no background will never have its + * background filled by the windowing system, instead the window will + * contain whatever pixels were already in the corresponding area of + * the display. + * + * The windowing system will normally fill a window with its background + * when the window is obscured then exposed, and when you call + * gdk_window_clear(). + * @param pixmap A Gdk::Pixmap, or <tt>0</tt>. + * @param parent_relative Whether the tiling origin is at the origin of @a window 's parent. + */ + void set_back_pixmap(const Glib::RefPtr<Pixmap>&pixmap, bool parent_relative); + + /** Sets the mouse pointer for a Gdk::Window. + * To make the cursor invisible, use gdk_cursor_new_from_pixmap() to create + * a cursor with no pixels in it. + * @param cursor A cursor. + */ + void set_cursor(const Cursor& cursor); + + /** Use the parent window's cursor. + * For top-level windows this means that it will use the default cursor for the ROOT window. + */ + void set_cursor(); + + + /** Retrieves the user data for @a window , which is normally the widget + * that @a window belongs to. See gdk_window_set_user_data(). + * @param data Return location for user data. + */ + void get_user_data(gpointer* data); + + /** Any of the return location arguments to this function may be <tt>0</tt>, + * if you aren't interested in getting the value of that field. + * + * The X and Y coordinates returned are relative to the parent window + * of @a window , which for toplevels usually means relative to the + * window decorations (titlebar, etc.) rather than relative to the + * root window (screen-size background window). + * + * On the X11 platform, the geometry is obtained from the X server, + * so reflects the latest position of @a window ; this may be out-of-sync + * with the position of @a window delivered in the most-recently-processed + * Gdk::EventConfigure. gdk_window_get_position() in contrast gets the + * position from the most recent configure event. + * + * <note> + * If @a window is not a toplevel, it is <em>much</em> better + * to call gdk_window_get_position() and Gdk::Drawable::get_size() instead, + * because it avoids the roundtrip to the X server and because + * Gdk::Drawable::get_size() supports the full 32-bit coordinate space, + * whereas gdk_window_get_geometry() is restricted to the 16-bit + * coordinates of X11. + * </note> + * @param x Return location for X coordinate of window (relative to its parent). + * @param y Return location for Y coordinate of window (relative to its parent). + * @param width Return location for width of window. + * @param height Return location for height of window. + * @param depth Return location for bit depth of window. + */ + void get_geometry(int& x, int& y, int& width, int& height, int& depth) const; + + /** Obtains the position of the window as reported in the + * most-recently-processed Gdk::EventConfigure. Contrast with + * gdk_window_get_geometry() which queries the X server for the + * current window position, regardless of which events have been + * received or processed. + * + * The position coordinates are relative to the window's parent window. + * @param x X coordinate of window. + * @param y Y coordinate of window. + */ + void get_position(int& x, int& y) const; + + /** Obtains the position of a window in root window coordinates. + * (Compare with gdk_window_get_position() and + * gdk_window_get_geometry() which return the position of a window + * relative to its parent window.) + * @param x Return location for X coordinate. + * @param y Return location for Y coordinate. + * @return Not meaningful, ignore. + */ + int get_origin(int& x, int& y) const; + //_WRAP_METHOD(bool get_deskrelative_origin(int& x, int& y), gdk_window_get_deskrelative_origin) + + /** Obtains the top-left corner of the window manager frame in root + * window coordinates. + * @param x Return location for X position of window frame. + * @param y Return location for Y position of window frame. + */ + void get_root_origin(int& x, int& y) const; + + /** Obtains the bounding box of the window, including window manager + * titlebar/borders if any. The frame position is given in root window + * coordinates. To get the position of the window itself (rather than + * the frame) in root window coordinates, use gdk_window_get_origin(). + * @param rect Rectangle to fill with bounding box of the window frame. + */ + void get_frame_extents(Rectangle& rect); + + /** Obtains the current pointer position and modifier state. + * The position is given in coordinates relative to @a window . + * @param x Return location for X coordinate of pointer. + * @param y Return location for Y coordinate of pointer. + * @param mask Return location for modifier mask. + * @return The window containing the pointer (as with + * gdk_window_at_pointer()), or <tt>0</tt> if the window containing the + * pointer isn't known to GDK. + */ + Glib::RefPtr<Window> get_pointer(int& x, int& y, ModifierType& mask); + + /** Obtains the parent of @a window , as known to GDK. Does not query the + * X server; thus this returns the parent as passed to gdk_window_new(), + * not the actual parent. This should never matter unless you're using + * Xlib calls mixed with GDK calls on the X11 platform. It may also + * matter for toplevel windows, because the window manager may choose + * to reparent them. + * @return Parent of @a window . + */ + Glib::RefPtr<Window> get_parent(); + + /** Obtains the parent of @a window , as known to GDK. Does not query the + * X server; thus this returns the parent as passed to gdk_window_new(), + * not the actual parent. This should never matter unless you're using + * Xlib calls mixed with GDK calls on the X11 platform. It may also + * matter for toplevel windows, because the window manager may choose + * to reparent them. + * @return Parent of @a window . + */ + Glib::RefPtr<const Window> get_parent() const; + + /** Gets the toplevel window that's an ancestor of @a window . + * @return The toplevel window containing @a window . + */ + Glib::RefPtr<Window> get_toplevel(); + + /** Gets the toplevel window that's an ancestor of @a window . + * @return The toplevel window containing @a window . + */ + Glib::RefPtr<const Window> get_toplevel() const; + + + /** Gets the list of children of @a window known to GDK. + * This function only returns children created via GDK, + * so for example it's useless when used with the root window; + * it only returns windows an application created itself. + * + * The returned list must be freed, but the elements in the + * list need not be. + * @return List of child windows inside @a window . + */ + Glib::ListHandle< Glib::RefPtr<Window> > get_children(); + + /** Gets the list of children of @a window known to GDK. + * This function only returns children created via GDK, + * so for example it's useless when used with the root window; + * it only returns windows an application created itself. + * + * The returned list must be freed, but the elements in the + * list need not be. + * @return List of child windows inside @a window . + */ + Glib::ListHandle< Glib::RefPtr<const Window> > get_children() const; + //gdk_window_peek_children() is the same as gdk_window_get_children() with different memory mangement of the list. + + + /** Gets the event mask for @a window . See gdk_window_set_events(). + * @return Event mask for @a window . + */ + EventMask get_events() const; + + /** The event mask for a window determines which events will be reported + * for that window. For example, an event mask including Gdk::BUTTON_PRESS_MASK + * means the window should report button press events. The event mask + * is the bitwise OR of values from the Gdk::EventMask enumeration. + * @param event_mask Event mask for @a window . + */ + void set_events(EventMask event_mask); + + + /** Sets a list of icons for the window. One of these will be used + * to represent the window when it has been iconified. The icon is + * usually shown in an icon box or some sort of task bar. Which icon + * size is shown depends on the window manager. The window manager + * can scale the icon but setting several size icons can give better + * image quality since the window manager may only need to scale the + * icon by a small amount or not at all. + * @param pixbufs A list of pixbufs, of different sizes. + */ + void set_icon_list(const Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> >& pixbufs); + + /** Sets the icon of @a window as a pixmap or window. If using GTK+, investigate + * gtk_window_set_default_icon_list() first, and then gtk_window_set_icon_list() + * and gtk_window_set_icon(). If those don't meet your needs, look at + * gdk_window_set_icon_list(). Only if all those are too high-level do you + * want to fall back to gdk_window_set_icon(). + * @param icon_window A Gdk::Window to use for the icon. + * @param pixmap A Gdk::Pixmap to use as the icon,. + * @param mask A 1-bit pixmap (Gdk::Bitmap) to use as mask for @a pixmap . + */ + void set_icon(const Glib::RefPtr<Window>& icon_window, const Glib::RefPtr<Pixmap>& pixmap, const Glib::RefPtr<Bitmap>& mask); + void set_icon(const Glib::RefPtr<Window>& icon_window, const Glib::RefPtr<Pixmap>& pixmap); + void unset_icon(); + + /** Windows may have a name used while minimized, distinct from the + * name they display in their titlebar. Most of the time this is a bad + * idea from a user interface standpoint. But you can set such a name + * with this function, if you like. + * @param name Name of window while iconified (minimized). + */ + void set_icon_name(const Glib::ustring& name); + + + /** Sets the group leader window for @a window . By default, + * GDK sets the group leader for all toplevel windows + * to a global window implicitly created by GDK. With this function + * you can override this default. + * + * The group leader window allows the window manager to distinguish + * all windows that belong to a single application. It may for example + * allow users to minimize/unminimize all windows belonging to an + * application at once. You should only set a non-default group window + * if your application pretends to be multiple applications. + * @param leader Group leader window, or <tt>0</tt> to restore the default group leader window. + */ + void set_group(const Glib::RefPtr<Window>& leader); + + /** Returns the group leader window for @a window . See gdk_window_set_group(). + * @return The group leader window for @a window + * + * Since: 2.4. + */ + Glib::RefPtr<Window> get_group(); + + /** Returns the group leader window for @a window . See gdk_window_set_group(). + * @return The group leader window for @a window + * + * Since: 2.4. + */ + Glib::RefPtr<const Window> get_group() const; + + + /** "Decorations" are the features the window manager adds to a toplevel Gdk::Window. + * This function sets the traditional Motif window manager hints that tell the + * window manager which decorations you would like your window to have. + * Usually you should use gtk_window_set_decorated() on a Gtk::Window instead of + * using the GDK function directly. + * + * The @a decorations argument is the logical OR of the fields in + * the Gdk::WMDecoration enumeration. If Gdk::DECOR_ALL is included in the + * mask, the other bits indicate which decorations should be turned off. + * If Gdk::DECOR_ALL is not included, then the other bits indicate + * which decorations should be turned on. + * + * Most window managers honor a decorations hint of 0 to disable all decorations, + * but very few honor all possible combinations of bits. + * @param decorations Decoration hint mask. + */ + void set_decorations(WMDecoration decorations); + + /** Returns the decorations set on the GdkWindow with #gdk_window_set_decorations + * @param decorations The window decorations will be written here. + * @return <tt>true</tt> if the window has decorations set, <tt>false</tt> otherwise. + */ + bool get_decorations(WMDecoration& decorations) const; + + /** This function isn't really good for much. It sets the traditional + * Motif window manager hint for which operations the window manager + * should allow on a toplevel window. However, few window managers do + * anything reliable or interesting with this hint. Many ignore it + * entirely. + * + * The @a functions argument is the logical OR of values from the + * Gdk::WMFunction enumeration. If the bitmask includes Gdk::FUNC_ALL, + * then the other bits indicate which functions to disable; if + * it doesn't include Gdk::FUNC_ALL, it indicates which functions to + * enable. + * @param functions Bitmask of operations to allow on @a window . + */ + void set_functions(WMFunction functions); + + + /** Obtains a list of all toplevel windows known to GDK on the default + * screen (see gdk_window_get_toplevels_for_screen()). + * A toplevel window is a child of the root window (see + * gdk_get_default_root_window()). + * @return List of toplevel windows. + */ + static Glib::ListHandle< Glib::RefPtr<Window> > get_toplevels(); + + + /** Asks to iconify (minimize) @a window . The window manager may choose + * to ignore the request, but normally will honor it. Using + * gtk_window_iconify() is preferred, if you have a Gtk::Window widget. + * + * This function only makes sense when @a window is a toplevel window. + */ + void iconify(); + + /** Attempt to deiconify (unminimize) @a window . On X11 the window manager may + * choose to ignore the request to deiconify. When using GTK+, + * use gtk_window_deiconify() instead of the Gdk::Window variant. Or better yet, + * you probably want to use gtk_window_present(), which raises the window, focuses it, + * unminimizes it, and puts it on the current desktop. + */ + void deiconify(); + + /** "Pins" a window such that it's on all workspaces and does not scroll + * with viewports, for window managers that have scrollable viewports. + * (When using Gtk::Window, gtk_window_stick() may be more useful.) + * + * On the X11 platform, this function depends on window manager + * support, so may have no effect with many window managers. However, + * GDK will do the best it can to convince the window manager to stick + * the window. For window managers that don't support this operation, + * there's nothing you can do to force it to happen. + */ + void stick(); + + /** Reverse operation for gdk_window_stick(); see gdk_window_stick(), + * and gtk_window_unstick(). + */ + void unstick(); + + /** Maximizes the window. If the window was already maximized, then + * this function does nothing. + * + * On X11, asks the window manager to maximize @a window , if the window + * manager supports this operation. Not all window managers support + * this, and some deliberately ignore it or don't have a concept of + * "maximized"; so you can't rely on the maximization actually + * happening. But it will happen with most standard window managers, + * and GDK makes a best effort to get it to happen. + * + * On Windows, reliably maximizes the window. + */ + void maximize(); + + /** Unmaximizes the window. If the window wasn't maximized, then this + * function does nothing. + * + * On X11, asks the window manager to unmaximize @a window , if the + * window manager supports this operation. Not all window managers + * support this, and some deliberately ignore it or don't have a + * concept of "maximized"; so you can't rely on the unmaximization + * actually happening. But it will happen with most standard window + * managers, and GDK makes a best effort to get it to happen. + * + * On Windows, reliably unmaximizes the window. + */ + void unmaximize(); + + void register_dnd(); + + /** Begins a window resize operation (for a toplevel window). + * You might use this function to implement a "window resize grip," for + * example; in fact Gtk::Statusbar uses it. The function works best + * with window managers that support the Extended Window Manager Hints spec + * (see http://www.freedesktop.org), but has a fallback implementation + * for other window managers. + * @param edge The edge or corner from which the drag is started. + * @param button The button being used to drag. + * @param root_x Root window X coordinate of mouse click that began the drag. + * @param root_y Root window Y coordinate of mouse click that began the drag. + * @param timestamp Timestamp of mouse click that began the drag (use gdk_event_get_time()). + */ + void begin_resize_drag(WindowEdge edge, int button, int root_x, int root_y, guint32 timestamp); + + /** Begins a window move operation (for a toplevel window). You might + * use this function to implement a "window move grip," for + * example. The function works best with window managers that support + * the Extended Window Manager Hints spec (see + * http://www.freedesktop.org), but has a fallback implementation for + * other window managers. + * @param button The button being used to drag. + * @param root_x Root window X coordinate of mouse click that began the drag. + * @param root_y Root window Y coordinate of mouse click that began the drag. + * @param timestamp Timestamp of mouse click that began the drag. + */ + void begin_move_drag(int button, int root_x, int root_y, guint32 timestamp); + + /** A convenience wrapper around gdk_window_invalidate_region() which + * invalidates a rectangular region. See + * gdk_window_invalidate_region() for details. + * @param rect Rectangle to invalidate. + * @param invalidate_children Whether to also invalidate child windows. + */ + void invalidate_rect(const Rectangle& rect, bool invalidate_children); + + + /** Adds @a region to the update area for @a window . The update area is the + * region that needs to be redrawn, or "dirty region." The call + * gdk_window_process_updates() sends one or more expose events to the + * window, which together cover the entire update area. An + * application would normally redraw the contents of @a window in + * response to those expose events. + * + * GDK will call gdk_window_process_all_updates() on your behalf + * whenever your program returns to the main loop and becomes idle, so + * normally there's no need to do that manually, you just need to + * invalidate regions that you know should be redrawn. + * + * The @a invalidate_children parameter controls whether the region of + * each child window that intersects @a region will also be invalidated. + * If <tt>false</tt>, then the update area for child windows will remain + * unaffected. See gdk_window_invalidate_maybe_recurse if you need + * fine grained control over which children are invalidated. + * @param region A Gdk::Region. + * @param invalidate_children <tt>true</tt> to also invalidate child windows. + */ + void invalidate_region(const Region& region, bool invalidate_children = true); + + //TODO: Rewrite the docs, to be more C++-like. + + /** Transfers ownership of the update area from @a window to the caller + * of the function. That is, after calling this function, @a window will + * no longer have an invalid/dirty region; the update area is removed + * from @a window and handed to you. If a window has no update area, + * gdk_window_get_update_area() returns <tt>0</tt>. You are responsible for + * calling gdk_region_destroy() on the returned region if it's non-<tt>0</tt>. + * @return The update area for @a window . + */ + Region get_update_area(); + //This method should not have a const version - see the docs. + + + /** Temporarily freezes a window such that it won't receive expose + * events. The window will begin receiving expose events again when + * Gdk::Window::thaw_updates() is called. If Gdk::Window::freeze_updates() + * has been called more than once, Gdk::Window::thaw_updates() must be called + * an equal number of times to begin processing exposes. + */ + void freeze_updates(); + + /** Thaws a window frozen with Gdk::Window::freeze_updates(). + */ + void thaw_updates(); + + /** Calls gdk_window_process_updates() for all windows (see Gdk::Window) + * in the application. + */ + static void process_all_updates(); + + /** Sends one or more expose events to @a window . The areas in each + * expose event will cover the entire update area for the window (see + * gdk_window_invalidate_region() for details). Normally GDK calls + * gdk_window_process_all_updates() on your behalf, so there's no + * need to call this function unless you want to force expose events + * to be delivered immediately and synchronously (vs. the usual + * case, where GDK delivers them in an idle handler). Occasionally + * this is useful to produce nicer scrolling behavior, for example. + * @param update_children Whether to also process updates for child windows. + */ + void process_updates(bool update_children); + + /** With update debugging enabled, calls to + * gdk_window_invalidate_region() clear the invalidated region of the + * screen to a noticeable color, and GDK pauses for a short time + * before sending exposes to windows during + * gdk_window_process_updates(). The net effect is that you can see + * the invalid region for each window and watch redraws as they + * occur. This allows you to diagnose inefficiencies in your application. + * + * In essence, because the GDK rendering model prevents all flicker, + * if you are redrawing the same region 400 times you may never + * notice, aside from noticing a speed problem. Enabling update + * debugging causes GTK to flicker slowly and noticeably, so you can + * see exactly what's being redrawn when, in what order. + * + * The --gtk-debug=updates command line option passed to GTK+ programs + * enables this debug option at application startup time. That's + * usually more useful than calling gdk_window_set_debug_updates() + * yourself, though you might want to use this function to enable + * updates sometime after application startup time. + * @param setting <tt>true</tt> to turn on update debugging. + */ + static void set_debug_updates(bool setting = true); + + /** Constrains a desired width and height according to a + * set of geometry hints (such as minimum and maximum size). + * @param geometry A Gdk::Geometry structure. + * @param flags A mask indicating what portions of @a geometry are set. + * @param width Desired width of window. + * @param height Desired height of the window. + * @param new_width Location to store resulting width. + * @param new_height Location to store resulting height. + */ + static void constrain_size(const Geometry& geometry, guint flags, int width, int height, int& new_width, int& new_height); + void get_internal_paint_info(Glib::RefPtr<Drawable>& real_drawable, int& x_offset, int& y_offset) const; + + + /** Indicates that the application will cooperate with the window + * system in synchronizing the window repaint with the window + * manager during resizing operations. After an application calls + * this function, it must call gdk_window_configure_finished() every + * time it has finished all processing associated with a set of + * Configure events. Toplevel GTK+ windows automatically use this + * protocol. + * + * On X, calling this function makes @a window participate in the + * _NET_WM_SYNC_REQUEST window manager protocol. + * + * Since: 2.6 + */ + void enable_synchronized_configure(); + + /** Signal to the window system that the application has finished + * handling Configure events it has received. Window Managers can + * use this to better synchronize the frame repaint with the + * application. GTK+ applications will automatically call this + * function when appropriate. + * + * This function can only be called if gdk_window_use_configure() + * was called previously. + * + * Since: 2.6 + */ + void configure_finished(); + + + /** Toggles whether a window should appear in a task list or window + * list. If a window's semantic type as specified with + * gdk_window_set_type_hint() already fully describes the window, this + * function should NOT be called in addition, instead you should allow + * the window to be treated according to standard policy for its + * semantic type. + * + * Since: 2.2 + * @param skips_taskbar <tt>true</tt> to skip the taskbar. + */ + void set_skip_taskbar_hint(bool skips_taskbar = true); + + /** Toggles whether a window should appear in a pager (workspace + * switcher, or other desktop utility program that displays a small + * thumbnail representation of the windows on the desktop). If a + * window's semantic type as specified with gdk_window_set_type_hint() + * already fully describes the window, this function should NOT be + * called in addition, instead you should allow the window to be + * treated according to standard policy for its semantic type. + * + * Since: 2.2 + * @param skips_pager <tt>true</tt> to skip the pager. + */ + void set_skip_pager_hint(bool skips_pager = true); + + + /** Moves the window into fullscreen mode. This means the + * window covers the entire screen and is above any panels + * or task bars. + * + * If the window was already fullscreen, then this function does nothing. + * + * On X11, asks the window manager to put @a window in a fullscreen + * state, if the window manager supports this operation. Not all + * window managers support this, and some deliberately ignore it or + * don't have a concept of "fullscreen"; so you can't rely on the + * fullscreenification actually happening. But it will happen with + * most standard window managers, and GDK makes a best effort to get + * it to happen. + * + * Since: 2.2 + */ + void fullscreen(); + + /** Moves the window out of fullscreen mode. If the window was not + * fullscreen, does nothing. + * + * On X11, asks the window manager to move @a window out of the fullscreen + * state, if the window manager supports this operation. Not all + * window managers support this, and some deliberately ignore it or + * don't have a concept of "fullscreen"; so you can't rely on the + * unfullscreenification actually happening. But it will happen with + * most standard window managers, and GDK makes a best effort to get + * it to happen. + * + * Since: 2.2 + */ + void unfullscreen(); + + + GrabStatus pointer_grab(bool owner_events, EventMask event_mask, const Glib::RefPtr<const Window>& confine_to, const Cursor& cursor, guint32 time_); + + /** Grabs the pointer to a specific window. + * Requires a corresponding call to pointer_ungrab(). + * + * Arguments: + * @param owner_events Specifies whether events will be reported as is, or relative to the window. + * @param event_mask Masks only interesting events. + * @param cursor Changes the cursor for the duration of the grab. + * @param timestamp Specifies the time. + */ + GrabStatus pointer_grab(bool owner_events, EventMask event_mask, const Cursor& cursor, guint32 timestamp); + + /** Grabs the pointer to a specific window. + * Requires a corresponding call to pointer_ungrab(). + * + * Arguments: + * @param owner_events Specifies whether events will be reported as is, or relative to the window. + * @param event_mask Masks only interesting events. + * @param timestamp Specifies the time. + */ + GrabStatus pointer_grab(bool owner_events, EventMask event_mask, guint32 timestamp); + + + /** Ungrabs the pointer, if it is grabbed by this application. + * @param timestamp A timestamp from a Gdk::Event, or Gdk::CURRENT_TIME if no + * timestamp is available. + */ + static void pointer_ungrab(guint32 timestamp); + + GrabStatus keyboard_grab(bool owner_events, guint32 timestamp); + + /** Ungrabs the keyboard, if it is grabbed by this application. + * @param timestamp A timestamp from a Gdk::Event, or Gdk::CURRENT_TIME if no + * timestamp is available. + */ + static void keyboard_ungrab(guint32 timestamp); + + + /** Set if @a window must be kept above other windows. If the + * window was already above, then this function does nothing. + * + * On X11, asks the window manager to keep @a window above, if the window + * manager supports this operation. Not all window managers support + * this, and some deliberately ignore it or don't have a concept of + * "keep above"; so you can't rely on the window being kept above. + * But it will happen with most standard window managers, + * and GDK makes a best effort to get it to happen. + * + * Since: 2.4 + * @param setting Whether to keep @a window above other windows. + */ + void set_keep_above(bool setting = true); + + /** Set if @a window must be kept below other windows. If the + * window was already below, then this function does nothing. + * + * On X11, asks the window manager to keep @a window below, if the window + * manager supports this operation. Not all window managers support + * this, and some deliberately ignore it or don't have a concept of + * "keep below"; so you can't rely on the window being kept below. + * But it will happen with most standard window managers, + * and GDK makes a best effort to get it to happen. + * + * Since: 2.4 + * @param setting Whether to keep @a window below other windows. + */ + void set_keep_below(bool setting = true); + + + /** Setting @a accept_focus to <tt>false</tt> hints the desktop environment that the + * window doesn't want to receive input focus. + * + * On X, it is the responsibility of the window manager to interpret this + * hint. ICCCM-compliant window manager usually respect it. + * + * Since: 2.4 + * @param accept_focus <tt>true</tt> if the window should receive input focus. + */ + void set_accept_focus(bool accept_focus = true); + + + /** Setting @a focus_on_map to <tt>false</tt> hints the desktop environment that the + * window doesn't want to receive input focus when it is mapped. + * focus_on_map should be turned off for windows that aren't triggered + * interactively (such as popups from network activity). + * + * On X, it is the responsibility of the window manager to interpret + * this hint. %Window managers following the freedesktop.org window + * manager extension specification should respect it. + * + * Since: 2.6 + * @param focus_on_map <tt>true</tt> if the window should receive input focus when mapped. + */ + void set_focus_on_map(bool focus_on_map); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::Window + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Gdk::Window> wrap(GdkWindowObject* object, bool take_copy = false); +} + + +#endif /* _GDKMM_WINDOW_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/wrap_init.cc b/libs/gtkmm2/gdk/gdkmm/wrap_init.cc new file mode 100644 index 0000000000..e859fb7e76 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/wrap_init.cc @@ -0,0 +1,135 @@ + +#include <glib.h> + +// Disable the 'const' function attribute of the get_type() functions. +// GCC would optimize them out because we don't use the return value. +#undef G_GNUC_CONST +#define G_GNUC_CONST /* empty */ + +#include <gdkmm/wrap_init.h> +#include <glibmm/error.h> +#include <glibmm/object.h> + +// #include the widget headers so that we can call the get_type() static methods: + +#include "bitmap.h" +#include "color.h" +#include "colormap.h" +#include "cursor.h" +#include "device.h" +#include "display.h" +#include "displaymanager.h" +#include "dragcontext.h" +#include "drawable.h" +#include "event.h" +#include "gc.h" +#include "image.h" +#include "pixbuf.h" +#include "pixbufanimation.h" +#include "pixbufanimationiter.h" +#include "pixmap.h" +#include "pixbufformat.h" +#include "pixbufloader.h" +#include "rectangle.h" +#include "region.h" +#include "rgbcmap.h" +#include "screen.h" +#include "types.h" +#include "visual.h" +#include "window.h" + +extern "C" +{ + +//Declarations of the *_get_type() functions: + +GType gdk_colormap_get_type(void); +GType gdk_device_get_type(void); +GType gdk_display_get_type(void); +GType gdk_display_manager_get_type(void); +GType gdk_drag_context_get_type(void); +GType gdk_drawable_get_type(void); +GType gdk_gc_get_type(void); +GType gdk_image_get_type(void); +GType gdk_pixbuf_get_type(void); +GType gdk_pixbuf_animation_get_type(void); +GType gdk_pixbuf_animation_iter_get_type(void); +GType gdk_pixbuf_loader_get_type(void); +GType gdk_pixmap_get_type(void); +GType gdk_screen_get_type(void); +GType gdk_visual_get_type(void); +GType gdk_window_object_get_type(void); + +//Declarations of the *_error_quark() functions: + +GQuark gdk_pixbuf_error_quark(void); +} // extern "C" + + +//Declarations of the *_Class::wrap_new() methods, instead of including all the private headers: + +namespace Gdk { class Colormap_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class Device_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class Display_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class DisplayManager_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class DragContext_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class Drawable_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class GC_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class Image_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class Pixbuf_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class PixbufAnimation_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class PixbufAnimationIter_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class PixbufLoader_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class Pixmap_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class Screen_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class Visual_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class Window_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } + +namespace Gdk { + +void wrap_init() +{ + // Register Error domains: + Glib::Error::register_domain(gdk_pixbuf_error_quark(), &Gdk::PixbufError::throw_func); + +// Map gtypes to gtkmm wrapper-creation functions: + Glib::wrap_register(gdk_colormap_get_type(), &Gdk::Colormap_Class::wrap_new); + Glib::wrap_register(gdk_device_get_type(), &Gdk::Device_Class::wrap_new); + Glib::wrap_register(gdk_display_get_type(), &Gdk::Display_Class::wrap_new); + Glib::wrap_register(gdk_display_manager_get_type(), &Gdk::DisplayManager_Class::wrap_new); + Glib::wrap_register(gdk_drag_context_get_type(), &Gdk::DragContext_Class::wrap_new); + Glib::wrap_register(gdk_drawable_get_type(), &Gdk::Drawable_Class::wrap_new); + Glib::wrap_register(gdk_gc_get_type(), &Gdk::GC_Class::wrap_new); + Glib::wrap_register(gdk_image_get_type(), &Gdk::Image_Class::wrap_new); + Glib::wrap_register(gdk_pixbuf_get_type(), &Gdk::Pixbuf_Class::wrap_new); + Glib::wrap_register(gdk_pixbuf_animation_get_type(), &Gdk::PixbufAnimation_Class::wrap_new); + Glib::wrap_register(gdk_pixbuf_animation_iter_get_type(), &Gdk::PixbufAnimationIter_Class::wrap_new); + Glib::wrap_register(gdk_pixbuf_loader_get_type(), &Gdk::PixbufLoader_Class::wrap_new); + Glib::wrap_register(gdk_pixmap_get_type(), &Gdk::Pixmap_Class::wrap_new); + Glib::wrap_register(gdk_screen_get_type(), &Gdk::Screen_Class::wrap_new); + Glib::wrap_register(gdk_visual_get_type(), &Gdk::Visual_Class::wrap_new); + Glib::wrap_register(gdk_window_object_get_type(), &Gdk::Window_Class::wrap_new); + + // Register the gtkmm gtypes: + Gdk::Colormap::get_type(); + Gdk::Device::get_type(); + Gdk::Display::get_type(); + Gdk::DisplayManager::get_type(); + Gdk::DragContext::get_type(); + Gdk::Drawable::get_type(); + Gdk::GC::get_type(); + Gdk::Image::get_type(); + Gdk::Pixbuf::get_type(); + Gdk::PixbufAnimation::get_type(); + Gdk::PixbufAnimationIter::get_type(); + Gdk::PixbufLoader::get_type(); + Gdk::Pixmap::get_type(); + Gdk::Screen::get_type(); + Gdk::Visual::get_type(); + Gdk::Window::get_type(); + +} // wrap_init() + +} //Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/wrap_init.h b/libs/gtkmm2/gdk/gdkmm/wrap_init.h new file mode 100644 index 0000000000..e27d2122a7 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/wrap_init.h @@ -0,0 +1,32 @@ +#ifndef _GDKMM_WRAP_INIT_H +#define _GDKMM_WRAP_INIT_H + +/* wrap_init.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +// wrap_init.cc is generated by tools/generate_wrap_init.pl + +namespace Gdk +{ + +void wrap_init(); + +} /* namespace Gdk */ + +#endif // _GDKMM_WRAP_INIT_H |