1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
/*
*
* $Id$
*
* This file is part of the KDE libraries.
* Copyright (C) 1999,2000 Geert Jansen <[email protected]>
*
* 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.
*/
#ifndef __TDESharedPixmap_h_Included__
#define __TDESharedPixmap_h_Included__
#include <kpixmap.h>
#ifdef Q_MOC_RUN
#define Q_WS_X11
#endif // Q_MOC_RUN
#ifdef Q_WS_X11
#include <tqstring.h>
#include <tqpixmap.h>
#include <tqwidget.h>
class TDESharedPixmapPrivate;
/**
* Shared pixmap client.
*
* A shared pixmap is a pixmap that resides on the X server, is referenced
* by a global id string, and can be accessed by all X clients.
*
* This class is a client class to shared pixmaps in KDE. You can use it
* to copy (a part of) a shared pixmap into. TDESharedPixmap inherits KPixmap
* for that purpose.
*
* The server part of shared pixmaps is not implemented here.
* That part is provided by KPixmapServer, in the source file:
* tdebase/kdesktop/pixmapserver.cpp.
*
* An example: copy from a shared pixmap:
* \code
* TDESharedPixmap *pm = new TDESharedPixmap;
* connect(pm, TQT_SIGNAL(done(bool)), TQT_SLOT(slotDone(bool)));
* pm->loadFromShared("My Pixmap");
* \endcode
*
* @author Geert Jansen <[email protected]>
* @version $Id$
*
*/
class TDEUI_EXPORT TDESharedPixmap:
public TQWidget,
public KPixmap
{
Q_OBJECT
public:
/**
* Construct an empty pixmap.
*/
TDESharedPixmap();
/**
* Destroys the pixmap.
*/
~TDESharedPixmap();
/**
* Load from a shared pixmap reference. The signal done() is emitted
* when the operation has finished.
*
* @param name The shared pixmap name.
* @param rect If you pass a nonzero rectangle, a tile is generated which
* is able to fill up the specified rectangle completely. This is solely
* for optimization: in some cases the tile will be much smaller than the
* original pixmap. It reflects TDESharedPixmap's original use: sharing
* of the desktop background to achieve pseudo transparency.
* @return True if the shared pixmap exists and loading has started
* successfully, false otherwise.
*/
bool loadFromShared(const TQString & name, const TQRect & rect=TQRect());
/**
* Check whether a shared pixmap is available.
*
* @param name The shared pixmap name.
* @return True if the shared pixmap is available, false otherwise.
*/
bool isAvailable(const TQString & name) const;
signals:
/**
* This signal is raised when a pixmap load operation has finished.
*
* @param success True if successful, false otherwise.
*/
void done(bool success);
protected:
bool x11Event(XEvent *);
private:
bool copy(const TQString & id, const TQRect & rect);
void init();
TDESharedPixmapPrivate *d;
};
#else // WIN32, Qt Embedded
// Let's simply assume KPixmap will do for now. Yes, I know that's broken.
#define TDESharedPixmap KPixmap
#endif
#endif
|