add more spacing
[personal-kdebase.git] / workspace / kwin / effects / test / howto.h
blob50b9ea2255a0bf3ced2e723eba2636e32aef88b0
1 /*****************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
5 Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
7 You can Freely distribute this program under the GNU General Public
8 License. See the file "COPYING" for the exact licensing terms.
9 ******************************************************************/
13 Files howto.cpp and howto.h implement HowtoEffect, a commented demo compositing
14 effect that fades out and again in a window after it has been activated.
18 #ifndef KWIN_HOWTO_H
19 #define KWIN_HOWTO_H
21 // Include with base class for effects.
22 #include <kwineffects.h>
24 // Everything in KWin is in a namespace. There's no need to prefix names
25 // with KWin or K, there's no (big) need to care about symbol clashes.
26 namespace KWin
29 // The class implementing the effect.
30 class HowtoEffect
31 // Inherit from the base class for effects.
32 : public Effect
34 public:
35 // There are two kinds of functions in an effect:
37 // Functions related to painting: These allow the effect to affect painting.
39 // A pre-paint function. It tells the compositing code how the painting will
40 // be affected by this effect.
41 virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time );
43 // A paint function. It actually performs the modifications to the painting.
44 virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
46 // A post-paint function. It can be used for cleanups after painting, but with animations
47 // it is also used to trigger repaints during the next painting pass by manually "damaging"
48 // areas of the window.
49 virtual void postPaintWindow( EffectWindow* w );
51 // Notification functions: These inform the effect about changes such as a new window
52 // being activated.
54 // The given window has been closed.
55 virtual void windowClosed( EffectWindow* c );
57 // The given window has been activated.
58 virtual void windowActivated( EffectWindow* c );
59 private:
60 // The window that will be faded out and in again.
61 EffectWindow* fade_window;
63 // The progress of the fading.
64 int progress;
67 } // namespace
69 #endif