add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gdk / src / pixmap.hg
1 /* $Id: pixmap.hg,v 1.5 2004/03/10 01:17:36 murrayc Exp $ */
2
3 /* Copyright (C) 1998-2002 The gtkmm Development Team
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19
20 #include <gdkmm/drawable.h>
21 #include <gdkmm/color.h>
22 #include <gdkmm/colormap.h>
23 #include <gdkmm/types.h>
24
25 _DEFS(gdkmm,gdk)
26 _PINCLUDE(gdkmm/private/drawable_p.h)
27
28 #ifndef DOXYGEN_SHOULD_SKIP_THIS
29 extern "C" {
30 //Custom stuct prototypes, because they aren't what the code-generator expects:
31 typedef struct _GdkDrawable GdkPixmap;
32 typedef struct _GdkPixmapClass GdkPixmapClass;
33 } // extern "C"
34 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
35
36
37 namespace Gdk
38 {
39
40 class Window;
41
42 /** Pixmaps are offscreen drawables. They can be drawn upon with the standard drawing primitives, then copied to another
43  * drawable (such as a Gdk::Window) with Gdk::Drawable::draw_drawable(). The depth of a pixmap is the number of bits per
44  * pixels.
45  * Bitmaps are simply pixmaps with a depth of 1. (That is, they are monochrome bitmaps - each pixel can be either on or off).
46  */
47 class Pixmap : public Gdk::Drawable
48 {
49   // GdkPixmap is a typedef to GdkDrawable, but it's actually a GdkPixmapObject.
50   _CLASS_GOBJECT(Pixmap,GdkPixmap,GDK_PIXMAP,Gdk::Drawable,GdkDrawable,GdkPixmapObject)
51   _CUSTOM_WRAP_NEW // see wrap_new() implementation in pixmap.ccg
52   _STRUCT_NOT_HIDDEN
53
54 protected:
55   _CTOR_DEFAULT()
56
57   Pixmap(const Glib::RefPtr<Drawable>& drawable, int width, int height, int depth = -1);
58
59   /// Initialize a Pixmap from data.
60   Pixmap(const Glib::RefPtr<Drawable>& drawable,
61          const char* data, int width, int height, int depth,
62          const Color& fg, const Color& bg);
63
64   Pixmap(const Glib::RefPtr<Display>& display, NativeWindow anid);
65
66 public:
67
68   _WRAP_CREATE(const Glib::RefPtr<Drawable>& drawable, int width, int height, int depth = -1)
69   _WRAP_CREATE(const Glib::RefPtr<Drawable>& drawable, const char* data, int width, int height, int depth, const Color& fg, const Color& bg)
70
71   _WRAP_CREATE(const Glib::RefPtr<Display>& display, NativeWindow anid)
72   _IGNORE(gdk_pixmap_foreign_new_for_display)
73   
74   static Glib::RefPtr<Pixmap> create_from_data(const Glib::RefPtr<const Drawable>& drawable,
75                                                const char* data, int width, int height, int depth,
76                                                const Color& fg, const Color& bg);
77
78   /// Create a Pixmap from a xpm file.
79   static Glib::RefPtr<Pixmap> create_from_xpm(const Glib::RefPtr<const Drawable>& drawable,
80                                               const Color& transparent_color,
81                                               const std::string& filename);
82
83   // Create a Pixmap from a xpm file.
84   static Glib::RefPtr<Pixmap> create_from_xpm(const Glib::RefPtr<const Drawable>& drawable,
85                                               Glib::RefPtr<Bitmap>& mask,
86                                               const Color& transparent_color,
87                                               const std::string& filename);
88
89   /// Create a Pixmap from a xpm file with colormap.
90   static Glib::RefPtr<Pixmap> create_from_xpm(const Glib::RefPtr<const Drawable>& drawable,
91                                               const Glib::RefPtr<Colormap>& colormap,
92                                               Glib::RefPtr<Bitmap>& mask,
93                                               const Color& transparent_color,
94                                               const std::string& filename);
95
96   static Glib::RefPtr<Pixmap> create_from_xpm(const Glib::RefPtr<const Drawable>& drawable,
97                                               Glib::RefPtr<Bitmap>& mask,
98                                               const Color& transparent_color,
99                                               const char* const* data);
100
101   static Glib::RefPtr<Pixmap> create_from_xpm(const Glib::RefPtr<const Drawable>& drawable,
102                                               const Glib::RefPtr<Colormap>& colormap,
103                                               Glib::RefPtr<Bitmap>& mask,
104                                               const Color& transparent_color,
105                                               const char* const* data);
106
107   static Glib::RefPtr<Pixmap> create_from_xpm(const Glib::RefPtr<Colormap>& colormap,
108                                               Glib::RefPtr<Bitmap>& mask,
109                                               const Color& transparent_color,
110                                               const char* const* data);
111
112   static Glib::RefPtr<Pixmap> create_from_xpm(const Glib::RefPtr<Colormap>& colormap,
113                                               Glib::RefPtr<Bitmap>& mask,
114                                               const char* const* data);
115
116
117 };
118
119 } // namespace Gdk
120