~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kwin/effects/boxswitch/boxswitch.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/********************************************************************
 
2
 KWin - the KDE window manager
 
3
 This file is part of the KDE project.
 
4
 
 
5
Copyright (C) 2007 Philip Falkner <philip.falkner@gmail.com>
 
6
 
 
7
This program is free software; you can redistribute it and/or modify
 
8
it under the terms of the GNU General Public License as published by
 
9
the Free Software Foundation; either version 2 of the License, or
 
10
(at your option) any later version.
 
11
 
 
12
This program is distributed in the hope that it will be useful,
 
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
GNU General Public License for more details.
 
16
 
 
17
You should have received a copy of the GNU General Public License
 
18
along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
*********************************************************************/
 
20
 
 
21
#ifndef KWIN_BOXSWITCH_H
 
22
#define KWIN_BOXSWITCH_H
 
23
 
 
24
#include <kwineffects.h>
 
25
 
 
26
#include <QHash>
 
27
#include <QRect>
 
28
#include <QRegion>
 
29
#include <QSize>
 
30
#include <QTimeLine>
 
31
#include <QFont>
 
32
#include <QQueue>
 
33
 
 
34
#include <kwinglutils.h>
 
35
#include <kwinxrenderutils.h>
 
36
 
 
37
#include "boxswitch_proxy.h"
 
38
 
 
39
namespace KWin
 
40
{
 
41
 
 
42
class BoxSwitchEffect
 
43
    : public Effect
 
44
{
 
45
    Q_OBJECT
 
46
public:
 
47
    BoxSwitchEffect();
 
48
    ~BoxSwitchEffect();
 
49
    virtual void reconfigure(ReconfigureFlags);
 
50
    virtual void prePaintScreen(ScreenPrePaintData &data, int time);
 
51
    virtual void paintScreen(int mask, QRegion region, ScreenPaintData& data);
 
52
    virtual void postPaintScreen();
 
53
    virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time);
 
54
    virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
 
55
 
 
56
    virtual void windowInputMouseEvent(Window w, QEvent* e);
 
57
    virtual void* proxy();
 
58
    void activateFromProxy(int mode, bool animate, bool showText, float positioningFactor);
 
59
    void paintWindowsBox(const QRegion& region);
 
60
 
 
61
public Q_SLOTS:
 
62
    void slotWindowClosed(EffectWindow* w);
 
63
    void slotTabBoxAdded(int mode);
 
64
    void slotTabBoxClosed();
 
65
    void slotTabBoxUpdated();
 
66
    void slotWindowGeometryShapeChanged(EffectWindow *w, const QRect &old);
 
67
    void slotWindowDamaged(EffectWindow* w, const QRect& damage);
 
68
 
 
69
private:
 
70
    class ItemInfo;
 
71
    void setActive();
 
72
    void setInactive();
 
73
    void moveResizeInputWindow(int x, int y, int width, int height);
 
74
    void calculateFrameSize();
 
75
    void calculateItemSizes();
 
76
    void setSelectedWindow(EffectWindow* w);
 
77
 
 
78
    void paintWindowThumbnail(EffectWindow* w);
 
79
    void paintDesktopThumbnail(int iDesktop);
 
80
    void paintWindowIcon(EffectWindow* w);
 
81
 
 
82
    bool mActivated;
 
83
    Window mInput;
 
84
    int mMode;
 
85
 
 
86
    EffectFrame* thumbnailFrame;
 
87
 
 
88
    QRect frame_area;
 
89
    int highlight_margin;
 
90
    QSize item_max_size; // maximum item display size (including highlight)
 
91
    QRect text_area;
 
92
    QFont text_font;
 
93
    QColor color_frame;
 
94
    QColor color_highlight;
 
95
 
 
96
    float bg_opacity;
 
97
    bool elevate_window;
 
98
 
 
99
    QHash< EffectWindow*, ItemInfo* > windows;
 
100
    EffectWindowList original_windows;
 
101
    EffectWindowList referrencedWindows;
 
102
    EffectWindow* selected_window;
 
103
    QHash< int, ItemInfo* > desktops;
 
104
    QList< int > original_desktops;
 
105
    int selected_desktop;
 
106
 
 
107
    int painting_desktop;
 
108
 
 
109
    bool mAnimateSwitch;
 
110
    QTimeLine activeTimeLine;
 
111
    QTimeLine timeLine;
 
112
    bool animation;
 
113
    QRect highlight_area;
 
114
    bool highlight_is_set;
 
115
    enum Direction {
 
116
        Left,
 
117
        Right
 
118
    };
 
119
    Direction direction;
 
120
    QQueue<Direction> scheduled_directions;
 
121
    EffectWindow* edge_window;
 
122
    EffectWindow* right_window;
 
123
 
 
124
    bool primaryTabBox;
 
125
    bool secondaryTabBox;
 
126
 
 
127
    BoxSwitchEffectProxy mProxy;
 
128
    bool mProxyActivated;
 
129
    bool mProxyAnimateSwitch;
 
130
    bool mProxyShowText;
 
131
    float mPositioningFactor;
 
132
};
 
133
 
 
134
class BoxSwitchEffect::ItemInfo
 
135
{
 
136
public:
 
137
    ItemInfo();
 
138
    ~ItemInfo();
 
139
    QRect area; // maximal painting area, including any frames/highlights/etc.
 
140
    QRegion clickable;
 
141
    QRect thumbnail;
 
142
    EffectFrame* iconFrame;
 
143
};
 
144
 
 
145
} // namespace
 
146
 
 
147
#endif