Lumiera  0.pre.03
»edit your freedom«
track-body.hpp
Go to the documentation of this file.
1 /*
2  TRACK-BODY.hpp - track body area within the timeline display canvas
3 
4  Copyright (C) Lumiera.org
5  2016, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
40 #ifndef STAGE_TIMELINE_TRACK_BODY_H
41 #define STAGE_TIMELINE_TRACK_BODY_H
42 
43 #include "stage/gtk-base.hpp"
47 
48 
49 #include <memory>
50 #include <vector>
51 #include <array>
52 
53 
54 
55 namespace stage {
56 namespace timeline {
57 
58  class TrackPresenter;
59  class TrackProfile;
60 
61 
70  struct Decoration
71  {
72  uint content = 0;
73  uint ruler = 0;
74  uint topMar = 0;
75  uint botMar = 0;
76  uint trackPad = 0;
77 
78  using Borders = std::array<uint, 6>;
79  Borders borders{0,0,0,0,0,0};
80  };
81 
82 
95  class TrackBody
96  : public model::ViewHook<TrackBody>
97  {
98  uint contentHeight_;
99  uint contentOffset_;
100  uint startLine_;
101 
102  using PRuler = std::unique_ptr<RulerTrack>;
103  using Rulers = std::vector<PRuler>;
104 
105  using SubTracks = std::vector<TrackBody*>;
106 
107  SubTracks subTracks_;
108  Rulers rulers_;
109 
110  public:
112 
113  TrackBody();
114  ~TrackBody();
115 
116  void setTrackName (cuString&);
117  uint establishTrackSpace (TrackProfile&);
118  void accommodateContentHeight(uint contentExtension);
119 
121  uint getContentOffsetY() const { return startLine_ + contentOffset_; }
122 
123  uint calcHeight() const;
124  uint calcRulerHeight() const;
125  uint calcContentHeight() const;
126  uint calcSubtrackHeight() const;
127 
128  DisplayManager::SignalStructureChange signalStructureChange_;
129 
130 
131  /* ==== Interface: ViewHook ===== */
132 
133  void hook (TrackBody&) override;
134  void remove (TrackBody&) override;
135  void rehook (TrackBody&) noexcept override;
136 
137  /* ===== Internals ===== */
148  Rulers&
150  {
151  return rulers_;
152  }
153 
154  };
155 
156 
157 }}// namespace stage::timeline
158 #endif /*STAGE_TIMELINE_TRACK_BODY_H*/
static Decoration decoration
storage for common style/padding settings
Definition: track-body.hpp:111
Interface to represent _"some presentation layout entity",_ with the ability to attach widgets (manag...
Definition: view-hook.hpp:84
Allow widgets to connect to a common shared presentation context.
Borders borders
width of up to 6 levels of combined upward slope borders (defined in CSS)
Definition: track-body.hpp:79
Abstraction: service for the widgets to translate themselves into screen layout.
Description of the structure and arrangement of tracks for display in the UI.
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:46
Helper to organise and draw the space allocated for a fork of sub-tracks.
Definition: track-body.hpp:95
Configure additional vertical padding for the decorations added through CSS.
Definition: track-body.hpp:70
uint getContentOffsetY() const
Definition: track-body.hpp:121
Timeline presentation helper to organise drawing of the overview rulers.
A set of basic GTK includes for the UI.