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

« back to all changes in this revision

Viewing changes to kwin/effects/outline/outline.cpp

  • 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) 2011 Martin Gräßlin <mgraesslin@kde.org>
 
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
#include "outline.h"
 
22
 
 
23
namespace KWin
 
24
{
 
25
 
 
26
KWIN_EFFECT(outline, OutlineEffect)
 
27
 
 
28
OutlineEffect::OutlineEffect()
 
29
    : Effect()
 
30
    , m_active(false)
 
31
{
 
32
    m_outline = effects->effectFrame(EffectFrameNone);
 
33
    connect(effects, SIGNAL(showOutline(const QRect&)), SLOT(slotShowOutline(const QRect&)));
 
34
    connect(effects, SIGNAL(hideOutline()), SLOT(slotHideOutline()));
 
35
}
 
36
 
 
37
OutlineEffect::~OutlineEffect()
 
38
{
 
39
    delete m_outline;
 
40
}
 
41
 
 
42
void OutlineEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
 
43
{
 
44
    effects->paintScreen(mask, region, data);
 
45
    if (m_active) {
 
46
        m_outline->render();
 
47
    }
 
48
}
 
49
 
 
50
bool OutlineEffect::provides(Feature feature)
 
51
{
 
52
    if (feature == Outline) {
 
53
        return true;
 
54
    } else {
 
55
        return false;
 
56
    }
 
57
}
 
58
 
 
59
 
 
60
void OutlineEffect::slotHideOutline()
 
61
{
 
62
    m_active = false;
 
63
    effects->addRepaint(m_geometry);
 
64
}
 
65
 
 
66
void OutlineEffect::slotShowOutline(const QRect& geometry)
 
67
{
 
68
    if (m_active) {
 
69
        effects->addRepaint(m_geometry);
 
70
    }
 
71
    m_active = true;
 
72
    m_geometry = geometry;
 
73
    m_outline->setGeometry(geometry);
 
74
    m_outline->setSelection(geometry);
 
75
    effects->addRepaint(geometry);
 
76
}
 
77
 
 
78
} // namespace