~azzar1/unity/fix-1028810

« back to all changes in this revision

Viewing changes to dash/previews/PreviewInfoHintWidget.h

  • Committer: Andrea Azzarone
  • Date: 2012-08-22 13:14:18 UTC
  • mfrom: (2516.1.92 unity)
  • Revision ID: azzaronea@gmail.com-20120822131418-mrfwx82k39xnvl9e
Merge trunk.

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 2012 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
 *
 
21
 */
 
22
 
 
23
#ifndef PREVIEWINFOHINTWIDGET_H
 
24
#define PREVIEWINFOHINTWIDGET_H
 
25
 
 
26
#include <Nux/Nux.h>
 
27
#include <Nux/View.h>
 
28
#include <UnityCore/Preview.h>
 
29
#include "unity-shared/Introspectable.h"
 
30
 
 
31
namespace nux
 
32
{
 
33
class StaticCairoText;
 
34
}
 
35
 
 
36
namespace unity
 
37
{
 
38
namespace dash
 
39
{
 
40
namespace previews
 
41
{
 
42
 
 
43
class PreviewInfoHintWidget : public nux::View, public debug::Introspectable
 
44
{
 
45
public:
 
46
  typedef nux::ObjectPtr<PreviewInfoHintWidget> Ptr;
 
47
  NUX_DECLARE_OBJECT_TYPE(PreviewInfoHintWidget, nux::View);
 
48
 
 
49
  PreviewInfoHintWidget(dash::Preview::Ptr preview_model, int icon_size);
 
50
  virtual ~PreviewInfoHintWidget();
 
51
 
 
52
  // From debug::Introspectable
 
53
  std::string GetName() const;
 
54
  void AddProperties(GVariantBuilder* builder);
 
55
  
 
56
  void PreLayoutManagement();
 
57
 
 
58
protected:
 
59
  virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
 
60
  virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
 
61
  
 
62
  virtual bool AcceptKeyNavFocus() { return false; }
 
63
 
 
64
  void SetupBackground();
 
65
  void SetupViews();
 
66
 
 
67
  void IconLoaded(std::string const& texid,
 
68
                                    unsigned size,
 
69
                                    glib::Object<GdkPixbuf> const& pixbuf,
 
70
                                    std::string icon_name);
 
71
 
 
72
protected:
 
73
  int icon_size_;
 
74
 
 
75
  typedef nux::ObjectPtr<nux::StaticCairoText> StaticCairoTextPtr;
 
76
  typedef std::pair<StaticCairoTextPtr, StaticCairoTextPtr> InfoHint; 
 
77
  std::list<InfoHint> info_hints_;
 
78
  
 
79
  dash::Preview::Ptr preview_model_;
 
80
  typedef nux::ObjectPtr<nux::BaseTexture> BaseTexturePtr;
 
81
};
 
82
 
 
83
} // napespace prviews
 
84
} // namespace dash
 
85
} // namespace unity
 
86
 
 
87
#endif //PREVIEWINFOHINTWIDGET_H