~sethj/ubuntu/wily/unity/fix-for-1445595

« back to all changes in this revision

Viewing changes to shutdown/SessionView.cpp

  • Committer: Marco Trevisan (Treviño)
  • Date: 2013-02-11 22:41:12 UTC
  • mto: This revision was merged to the branch mainline in revision 3200.
  • Revision ID: mail@3v1n0.net-20130211224112-k1nxtougs7xgdjj5
ShutdownView: first draft implementation

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: Marco Trevisan (Treviño) <marco@ubuntu.com>
 
18
*/
 
19
 
 
20
#include "SessionView.h"
 
21
 
 
22
#include <Nux/VLayout.h>
 
23
#include <UnityCore/GLibWrapper.h>
 
24
#include <glib/gi18n-lib.h>
 
25
#include "unity-shared/StaticCairoText.h"
 
26
 
 
27
namespace unity
 
28
{
 
29
namespace session
 
30
{
 
31
NUX_IMPLEMENT_OBJECT_TYPE(View);
 
32
 
 
33
View::View(Manager::Ptr const& manager)
 
34
  : manager_(manager)
 
35
{
 
36
  closable = true;
 
37
  auto main_layout = new nux::VLayout();
 
38
  int offset = style()->GetInternalOffset();
 
39
  main_layout->SetPadding(offset + 20, offset + 28);
 
40
  SetLayout(main_layout);
 
41
 
 
42
  auto header = glib::String(g_strdup_printf(_("Goodbye %s! Would you like to…"), manager->RealName().c_str())).Str();
 
43
  auto* header_view = new StaticCairoText(header);
 
44
  header_view->SetFont("Ubuntu Light 12");
 
45
  main_layout->AddView(header_view, 1 , nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
 
46
}
 
47
 
 
48
nux::Geometry View::GetBackgroundGeometry()
 
49
{
 
50
  return GetGeometry();
 
51
}
 
52
 
 
53
void View::DrawOverlay(nux::GraphicsEngine& GfxContext, bool force_draw, nux::Geometry clip)
 
54
{
 
55
  view_layout_->ProcessDraw(GfxContext, force_draw);
 
56
}
 
57
 
 
58
//
 
59
// Introspectable methods
 
60
//
 
61
std::string View::GetName() const
 
62
{
 
63
  return "SessionView";
 
64
}
 
65
 
 
66
} // namespace session
 
67
} // namespace unity