~ci-train-bot/unity/unity-ubuntu-yakkety-landing-089

« back to all changes in this revision

Viewing changes to lockscreen/LockScreenShield.cpp

  • Committer: Andrea Azzarone
  • Date: 2013-12-28 17:34:36 UTC
  • mto: (3566.5.438 unity)
  • mto: This revision was merged to the branch mainline in revision 3703.
  • Revision ID: azzaronea@gmail.com-20131228173436-jqschonskxaj5xx3
Initial commit for the unity lockscreen. UserAuthenticator added with tests too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
 
2
/*
 
3
* Copyright (C) 2013 Canonical Ltd
 
4
*
 
5
* This program is free software: you can redistribute it and/or modify
 
6
* it under the terms of the GNU General Public License version 3 as
 
7
* published by the Free Software Foundation.
 
8
*
 
9
* This program is distributed in the hope that it will be useful,
 
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
* GNU General Public License for more details.
 
13
*
 
14
* You should have received a copy of the GNU General Public License
 
15
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
16
*
 
17
* Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
 
18
*/
 
19
 
 
20
#include "LockScreenShield.h"
 
21
 
 
22
#include <NuxCore/Color.h> // FIXME: remove this
 
23
 
 
24
namespace unity 
 
25
{
 
26
namespace lockscreen
 
27
{
 
28
 
 
29
Shield::Shield(bool is_primary)
 
30
  : primary(is_primary)
 
31
{
 
32
  SetBackgroundColor(is_primary ?  nux::color::Red : nux::color::Yellow);
 
33
 
 
34
  mouse_enter.connect(sigc::mem_fun(this, &Shield::OnMouseEnter));
 
35
  mouse_leave.connect(sigc::mem_fun(this, &Shield::OnMouseLeave));
 
36
  primary.changed.connect(sigc::mem_fun(this, &Shield::OnPrimaryChanged));
 
37
}
 
38
 
 
39
void Shield::OnMouseEnter(int /*x*/, int /*y*/, unsigned long /**/, unsigned long /**/)
 
40
{
 
41
  primary = true;
 
42
}
 
43
 
 
44
void Shield::OnMouseLeave(int /*x*/, int /**/, unsigned long /**/, unsigned long /**/)
 
45
{
 
46
  primary = false;
 
47
}
 
48
 
 
49
void Shield::OnPrimaryChanged(bool value)
 
50
{
 
51
  SetBackgroundColor(value ?  nux::color::Red : nux::color::Yellow);
 
52
  QueueDraw();
 
53
}
 
54
 
 
55
}
 
56
}