3 * Copyright (c) 2003 Lubos Lunak <l.lunak@kde.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program 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
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef KWINDECORATION_PREVIEW_H
21 #define KWINDECORATION_PREVIEW_H
24 #include <kdecoration.h>
25 #include <kdecoration_plugins_p.h>
28 class KDecorationPreviewBridge
;
29 class KDecorationPreviewOptions
;
31 class KDecorationPreview
35 explicit KDecorationPreview( KDecorationPlugins
* plugin
, QWidget
* parent
= NULL
, const char* name
= NULL
);
36 virtual ~KDecorationPreview();
38 void performRepaintTest(int n
);
39 void performCaptionTest(int n
);
40 void performResizeTest(int n
);
41 void performRecreationTest(int n
);
43 bool recreateDecoration();
44 void setPreviewMask( const QRegion
&, int );
45 QRegion
unobscuredRegion( bool, const QRegion
& ) const;
46 QRect
windowGeometry( bool ) const;
48 void positionPreviews(int shrink
= 0);
49 KDecorationPreviewOptions
* options
;
50 KDecorationPreviewBridge
* bridge
;
52 KDecorationPlugins
* m_plugin
;
55 class KDecorationPreviewBridge
56 : public KDecorationBridge
59 KDecorationPreviewBridge( KDecorationPreview
* preview
, bool active
, const QString
&caption
);
61 void setCaption(const QString
&caption
);
63 virtual bool isActive() const;
64 virtual bool isCloseable() const;
65 virtual bool isMaximizable() const;
66 virtual MaximizeMode
maximizeMode() const;
67 virtual bool isMinimizable() const;
68 virtual bool providesContextHelp() const;
69 virtual int desktop() const;
70 virtual bool isModal() const;
71 virtual bool isShadeable() const;
72 virtual bool isShade() const;
73 virtual bool isSetShade() const;
74 virtual bool keepAbove() const;
75 virtual bool keepBelow() const;
76 virtual bool isMovable() const;
77 virtual bool isResizable() const;
78 virtual NET::WindowType
windowType( unsigned long supported_types
) const;
79 virtual QIcon
icon() const;
80 virtual QString
caption() const;
81 virtual void processMousePressEvent( QMouseEvent
* );
82 virtual void showWindowMenu( const QRect
&);
83 virtual void showWindowMenu( QPoint
);
84 virtual void performWindowOperation( WindowOperation
);
85 virtual void setMask( const QRegion
&, int );
86 virtual bool isPreview() const;
87 virtual QRect
geometry() const;
88 virtual QRect
iconGeometry() const;
89 virtual QRegion
unobscuredRegion( const QRegion
& r
) const;
90 virtual WId
windowId() const;
91 virtual void closeWindow();
92 virtual void maximize( MaximizeMode mode
);
93 virtual void minimize();
94 virtual void showContextHelp();
95 virtual void setDesktop( int desktop
);
96 virtual void titlebarDblClickOperation();
97 virtual void titlebarMouseWheelOperation( int delta
);
98 virtual void setShade( bool set
);
99 virtual void setKeepAbove( bool );
100 virtual void setKeepBelow( bool );
101 virtual int currentDesktop() const;
102 virtual QWidget
* initialParentWidget() const;
103 virtual Qt::WFlags
initialWFlags() const;
104 virtual void grabXServer( bool grab
);
106 KDecorationPreview
* preview
;
111 class KDecorationPreviewOptions
112 : public KDecorationOptions
115 KDecorationPreviewOptions();
116 virtual ~KDecorationPreviewOptions();
117 virtual unsigned long updateSettings();
122 class KDecorationPreviewPlugins
123 : public KDecorationPlugins
126 KDecorationPreviewPlugins( KConfig
* cfg
);
127 virtual bool provides( Requirement
);
130 inline KDecorationPreviewPlugins::KDecorationPreviewPlugins( KConfig
* cfg
)
131 : KDecorationPlugins( cfg
)