fluxbox/src/FbTk/FbPixmap.hh

98 lines
3.2 KiB
C++
Raw Normal View History

2003-04-25 12:29:49 +00:00
// FbPixmap.hh for FbTk - Fluxbox ToolKit
2005-01-24 18:02:34 +00:00
// Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org)
2003-04-25 12:29:49 +00:00
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
2004-11-19 11:37:27 +00:00
// $Id$
2003-04-25 12:29:49 +00:00
#ifndef FBTK_FBPIXMAP_HH
#define FBTK_FBPIXMAP_HH
2003-04-29 08:53:24 +00:00
#include "FbDrawable.hh"
2003-04-25 12:29:49 +00:00
#include <X11/Xlib.h>
namespace FbTk {
/// a wrapper for X Pixmap
2003-04-29 08:53:24 +00:00
class FbPixmap:public FbDrawable {
2003-04-25 12:29:49 +00:00
public:
FbPixmap();
/// copy pixmap
2004-04-26 21:57:32 +00:00
FbPixmap(const FbPixmap &copy);
/// creates a FbPixmap from X pixmap
explicit FbPixmap(Pixmap pm);
2004-01-11 12:48:46 +00:00
FbPixmap(const FbDrawable &src,
unsigned int width, unsigned int height,
int depth);
2003-04-25 12:29:49 +00:00
FbPixmap(Drawable src,
unsigned int width, unsigned int height,
int depth);
2004-01-11 12:48:46 +00:00
virtual ~FbPixmap();
2003-04-25 12:29:49 +00:00
void copy(const FbPixmap &the_copy);
void copy(Pixmap pixmap, int depth_convert, int screen_num);
2003-07-10 11:55:01 +00:00
/// rotates the pixmap 90 deg, not implemented!
void rotate();
2003-04-27 23:55:08 +00:00
/// scales the pixmap to specified size
void scale(unsigned int width, unsigned int height);
2003-09-10 21:28:13 +00:00
void resize(unsigned int width, unsigned int height);
/// tiles the pixmap to specified size
void tile(unsigned int width, unsigned int height);
2003-04-27 23:55:08 +00:00
/// drops pixmap and returns it
Pixmap release();
2003-04-25 12:29:49 +00:00
FbPixmap &operator = (const FbPixmap &copy);
/// sets new pixmap
FbPixmap &operator = (Pixmap pm);
2003-04-25 12:29:49 +00:00
inline Drawable drawable() const { return m_pm; }
inline unsigned int width() const { return m_width; }
inline unsigned int height() const { return m_height; }
inline int depth() const { return m_depth; }
static Pixmap getRootPixmap(int screen_num);
2005-11-22 21:08:07 +00:00
static void setRootPixmap(int screen_num, Pixmap pm);
static void rootwinPropertyNotify(int screen_num, Atom atom);
2003-04-27 23:55:08 +00:00
2003-04-25 12:29:49 +00:00
void create(Drawable src,
unsigned int width, unsigned int height,
int depth);
2005-04-02 14:59:38 +00:00
private:
void free();
2003-04-25 12:29:49 +00:00
Pixmap m_pm;
unsigned int m_width, m_height;
2004-01-08 22:07:58 +00:00
int m_depth;
2005-05-10 16:29:00 +00:00
/// Functions relating to the maintenance of root window pixmap caching
static void checkAtoms();
2005-11-22 21:08:07 +00:00
2005-05-10 16:29:00 +00:00
// array of pixmaps: 1 per screen
static Pixmap *m_root_pixmaps;
static const char *root_prop_ids[];
static Atom root_prop_atoms[];
2003-04-25 12:29:49 +00:00
};
2003-12-16 17:06:52 +00:00
} // end namespace FbTk
2003-04-25 12:29:49 +00:00
#endif // FBTK_FBPIXMAP_HH