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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
/*
*
* Copyright (c) 2003 Lubos Lunak <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KWINDECORATION_PREVIEW_H
#define KWINDECORATION_PREVIEW_H
#include <tqwidget.h>
#include <kdecoration_p.h>
#include <kdecoration_plugins_p.h>
class TQLabel;
class KDecorationPreviewBridge;
class KDecorationPreviewOptions;
class KDecorationPreview
: public TQWidget
{
Q_OBJECT
public:
// Note: Windows can't be added or removed without making changes to
// the code, since parts of it assume there's just an active
// and an inactive window.
enum Windows { Inactive = 0, Active, NumWindows };
KDecorationPreview( TQWidget* parent = NULL, const char* name = NULL );
virtual ~KDecorationPreview();
bool recreateDecoration( KDecorationPlugins* plugin );
void enablePreview();
void disablePreview();
void setPreviewMask( const TQRegion&, int, bool );
TQRegion unobscuredRegion( bool, const TQRegion& ) const;
TQRect windowGeometry( bool ) const;
void setTempBorderSize(KDecorationPlugins* plugin, KDecorationDefines::BorderSize size);
void setTempButtons(KDecorationPlugins* plugin, bool customEnabled, const TQString &left, const TQString &right);
protected:
virtual void resizeEvent( TQResizeEvent* );
private:
void positionPreviews();
KDecorationPreviewOptions* options;
KDecorationPreviewBridge* bridge[NumWindows];
KDecoration* deco[NumWindows];
TQLabel* no_preview;
TQRegion mask;
};
class KDecorationPreviewBridge
: public KDecorationBridge
{
public:
KDecorationPreviewBridge( KDecorationPreview* preview, bool active );
virtual bool isActive() const;
virtual bool isCloseable() const;
virtual bool isMaximizable() const;
virtual MaximizeMode maximizeMode() const;
virtual bool isMinimizable() const;
virtual bool providesContextHelp() const;
virtual int desktop() const;
virtual bool isModal() const;
virtual bool isShadeable() const;
virtual bool isShade() const;
virtual bool isSetShade() const;
virtual bool keepAbove() const;
virtual bool keepBelow() const;
virtual bool isMovable() const;
virtual bool isResizable() const;
virtual NET::WindowType windowType( unsigned long supported_types ) const;
virtual TQIconSet icon() const;
virtual TQString caption() const;
virtual void processMousePressEvent( TQMouseEvent* );
virtual void showWindowMenu( const TQRect &);
virtual void showWindowMenu( TQPoint );
virtual void performWindowOperation( WindowOperation );
virtual void setMask( const TQRegion&, int );
virtual bool isPreview() const;
virtual TQRect geometry() const;
virtual TQRect iconGeometry() const;
virtual TQRegion unobscuredRegion( const TQRegion& r ) const;
virtual TQWidget* workspaceWidget() const;
virtual WId windowId() const;
virtual void closeWindow();
virtual void maximize( MaximizeMode mode );
virtual void minimize();
virtual void showContextHelp();
virtual void setDesktop( int desktop );
virtual void titlebarDblClickOperation();
virtual void titlebarMouseWheelOperation( int delta );
virtual void setShade( bool set );
virtual void setKeepAbove( bool );
virtual void setKeepBelow( bool );
virtual int currentDesktop() const;
virtual TQWidget* initialParentWidget() const;
virtual Qt::WFlags initialWFlags() const;
virtual void helperShowHide( bool show );
virtual void grabXServer( bool grab );
private:
KDecorationPreview* preview;
bool active;
};
class KDecorationPreviewOptions
: public KDecorationOptions
{
public:
KDecorationPreviewOptions();
virtual ~KDecorationPreviewOptions();
virtual unsigned long updateSettings();
void setCustomBorderSize(BorderSize size);
void setCustomTitleButtonsEnabled(bool enabled);
void setCustomTitleButtons(const TQString &left, const TQString &right);
private:
BorderSize customBorderSize;
bool customButtonsChanged;
bool customButtons;
TQString customTitleButtonsLeft;
TQString customTitleButtonsRight;
};
class KDecorationPreviewPlugins
: public KDecorationPlugins
{
public:
KDecorationPreviewPlugins( TDEConfig* cfg );
virtual bool provides( Requirement );
};
inline KDecorationPreviewPlugins::KDecorationPreviewPlugins( TDEConfig* cfg )
: KDecorationPlugins( cfg )
{
}
#endif
|