~alan-griffiths/miral/debug

« back to all changes in this revision

Viewing changes to miral-qt/src/modules/Unity/Application/mirfocuscontroller.h

  • Committer: Gerry Boland
  • Date: 2016-06-01 22:06:51 UTC
  • mto: This revision was merged to the branch mainline in revision 178.
  • Revision ID: gerry.boland@canonical.com-20160601220651-ge508tffql4e7u7c
Import QtMir code into miral-qt subdirectory. Disabled by default, use -DMIRAL_ENABLE_QT=1 to build.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2016 Canonical, Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
#ifndef QTMIR_MIRFOCUSCONTROLLER_H
 
18
#define QTMIR_MIRFOCUSCONTROLLER_H
 
19
 
 
20
// unity-api
 
21
#include <unity/shell/application/MirFocusControllerInterface.h>
 
22
 
 
23
#include <QPointer>
 
24
 
 
25
#include "mirsurfaceinterface.h"
 
26
 
 
27
namespace qtmir {
 
28
 
 
29
class MirSurfaceInterface;
 
30
 
 
31
class MirFocusController : public unity::shell::application::MirFocusControllerInterface
 
32
{
 
33
    Q_OBJECT
 
34
public:
 
35
    MirFocusController(){}
 
36
    static MirFocusController* instance();
 
37
 
 
38
    void setFocusedSurface(unity::shell::application::MirSurfaceInterface *surface) override;
 
39
    unity::shell::application::MirSurfaceInterface* focusedSurface() const override;
 
40
    MirSurfaceInterface* previouslyFocusedSurface() { return m_previouslyFocusedSurface.data(); }
 
41
private:
 
42
    static MirFocusController *m_instance;
 
43
    QPointer<MirSurfaceInterface> m_previouslyFocusedSurface;
 
44
    QPointer<MirSurfaceInterface> m_focusedSurface;
 
45
};
 
46
 
 
47
} // namespace qtmir
 
48
 
 
49
#endif // QTMIR_MIRFOCUSCONTROLLER_H