~3v1n0/unity/light-shortcuts

« back to all changes in this revision

Viewing changes to dash/previews/SocialPreviewContent.h

  • Committer: Marco Trevisan (Treviño)
  • Date: 2013-04-26 12:41:09 UTC
  • Revision ID: mail@3v1n0.net-20130426124109-t3b2shjah2omiqa2
Unity: Remove all the views, but the Shortcuts

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 2011 Canonical Ltd.
4
 
 *
5
 
 * This program is free software: you can redistribute it and/or modify it
6
 
 * under the terms of the GNU Lesser 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, but
10
 
 * WITHOUT ANY WARRANTY; without even the implied warranties of
11
 
 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
12
 
 * PURPOSE.  See the applicable version of the GNU Lesser General Public
13
 
 * License for more details.
14
 
 *
15
 
 * You should have received a copy of both the GNU Lesser General Public
16
 
 * License version 3 along with this program.  If not, see
17
 
 * <http://www.gnu.org/licenses/>
18
 
 *
19
 
 * Authored by: Nick Dedekind <nick.dedekind@canonical.com>
20
 
 *              Ken VanDine <ken.vandine@canonical.com>
21
 
 *
22
 
 */
23
 
 
24
 
#ifndef SOCIAL_PREVIEW_CONTENT_H
25
 
#define SOCIAL_PREVIEW_CONTENT_H
26
 
 
27
 
#include <Nux/Nux.h>
28
 
#include <Nux/View.h>
29
 
#include <Nux/CairoWrapper.h>
30
 
#include <NuxCore/ObjectPtr.h>
31
 
#include "unity-shared/StaticCairoText.h"
32
 
#include "unity-shared/Introspectable.h"
33
 
 
34
 
namespace unity
35
 
{
36
 
namespace dash
37
 
{
38
 
namespace previews
39
 
{
40
 
 
41
 
class SocialPreviewContent : public nux::View, public unity::debug::Introspectable
42
 
{
43
 
public:
44
 
  typedef nux::ObjectPtr<SocialPreviewContent> Ptr;
45
 
  NUX_DECLARE_OBJECT_TYPE(SocialPreviewContent, nux::View);
46
 
 
47
 
  SocialPreviewContent(std::string const& text, NUX_FILE_LINE_PROTO);
48
 
  virtual ~SocialPreviewContent();
49
 
 
50
 
  void SetText(std::string const& text);
51
 
 
52
 
protected:
53
 
  virtual void Draw(nux::GraphicsEngine& gfx_engine, bool force_draw);
54
 
  virtual void DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw);
55
 
  virtual void PreLayoutManagement();
56
 
  
57
 
  virtual bool AcceptKeyNavFocus() { return false; }
58
 
 
59
 
  void SetupViews();
60
 
  void UpdateBaloonTexture();
61
 
  void RedrawBubble(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state);
62
 
  void DrawBubble(cairo_t* cr,
63
 
                   double line_width,
64
 
                   double   radius,
65
 
                   double   x,
66
 
                   double   y,
67
 
                   double   width,
68
 
                   double   height,
69
 
                   double   tailPosition,
70
 
                   double   tailWidth);
71
 
 
72
 
  virtual std::string GetName() const;
73
 
  virtual void AddProperties(GVariantBuilder* builder);
74
 
 
75
 
private:
76
 
  nux::ObjectPtr<StaticCairoText> text_;
77
 
 
78
 
  typedef std::unique_ptr<nux::CairoWrapper> NuxCairoPtr;
79
 
  NuxCairoPtr cr_bubble_;
80
 
};
81
 
 
82
 
}
83
 
}
84
 
}
85
 
 
86
 
#endif // SOCIAL_PREVIEW_CONTENT_H