~azzar1/unity/fix-1028810

« back to all changes in this revision

Viewing changes to dash/previews/Tracks.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 TRACKS_H
 
24
#define TRACKS_H
 
25
 
 
26
#include <Nux/Nux.h>
 
27
#include <Nux/ScrollView.h>
 
28
#include <UnityCore/Tracks.h>
 
29
#include "unity-shared/Introspectable.h"
 
30
#include "Track.h"
 
31
 
 
32
namespace nux
 
33
{
 
34
class VLayout;
 
35
}
 
36
 
 
37
namespace unity
 
38
{
 
39
namespace dash
 
40
{
 
41
class Track;
 
42
 
 
43
namespace previews
 
44
{
 
45
 
 
46
class Tracks : public debug::Introspectable, public nux::ScrollView
 
47
{
 
48
public:
 
49
  typedef nux::ObjectPtr<Tracks> Ptr;
 
50
  NUX_DECLARE_OBJECT_TYPE(Tracks, nux::View);
 
51
 
 
52
  Tracks(dash::Tracks::Ptr tracks, NUX_FILE_LINE_PROTO);
 
53
  virtual ~Tracks();
 
54
 
 
55
  // From debug::Introspectable
 
56
  std::string GetName() const;
 
57
  void AddProperties(GVariantBuilder* builder);  
 
58
 
 
59
  sigc::signal<void, std::string const&> play;
 
60
  sigc::signal<void, std::string const&> pause;
 
61
 
 
62
protected:
 
63
  virtual void Draw(nux::GraphicsEngine& gfx_engine, bool force_draw);
 
64
  virtual void DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw);
 
65
 
 
66
  virtual bool AcceptKeyNavFocus() { return false; }
 
67
 
 
68
  void SetupViews();
 
69
 
 
70
  void OnTrackUpdated(dash::Track const& track);
 
71
  void OnTrackAdded(dash::Track const& track);
 
72
  void OnTrackRemoved(dash::Track const&track);
 
73
 
 
74
  void onPlayTrack(std::string const& uri);
 
75
  void onPauseTrack(std::string const& uri);
 
76
 
 
77
protected:
 
78
  dash::Tracks::Ptr tracks_;
 
79
 
 
80
  nux::VLayout* layout_;
 
81
  std::map<std::string, previews::Track::Ptr> m_tracks;
 
82
  int track_count_;
 
83
};
 
84
 
 
85
}
 
86
}
 
87
}
 
88
 
 
89
#endif // TRACKS_H