Lumiera  0.pre.03
»edit your freedom«
clip-widget.hpp
Go to the documentation of this file.
1 /*
2  CLIP-WIDGET.hpp - display of a clip in timeline or media bin view
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 
119 #ifndef STAGE_TIMELINE_CLIP_WIDGET_H
120 #define STAGE_TIMELINE_CLIP_WIDGET_H
121 
122 #include "stage/gtk-base.hpp"
124 #include "lib/time/timevalue.hpp"
125 
126 //#include "lib/util.hpp"
127 
128 #include <optional>
129 #include <memory>
130 #include <string>
131 //#include <vector>
132 
133 
134 
135 namespace stage {
136 namespace timeline {
137 
138  using std::string;
139  using std::nullopt;
140  using std::optional;
141  using lib::time::Time;
142  using lib::time::TimeVar;
143  using lib::time::Duration;
144  using lib::time::TimeSpan;
145 
146  using WidgetHook = model::CanvasHook<Gtk::Widget>;
147 
148  class ClipDelegate;
149  using PDelegate = std::unique_ptr<ClipDelegate>;
150 
151 
156  {
157  TimeSpan timing_;
158 
159  public:
160  virtual ~ClipDelegate();
161  ClipDelegate();
162 
163 
165  enum Appearance {PENDING, SYMBOLIC, DEGRADED, ABRIDGED, COMPACT, EXPANDED};
166 
167 
169  static const int defaultOffsetY;
170 
172  static const string defaultName;
173 
175  virtual Appearance currentAppearance() const =0;
176 
179  virtual Appearance changeAppearance (Appearance desired) =0;
180 
182  virtual cuString getClipName() const =0;
183  virtual void setClipName (cuString&) =0;
184 
185  virtual TimeVar& accessStartTime() =0;
186  virtual TimeVar& accessDuration() =0;
187 
188  virtual uint getVerticalOffset() const =0;
189 
190  virtual WidgetHook& getCanvas() const =0;
191  virtual void updatePosition() =0;
192 
193  virtual uint calcRequiredHeight() const =0;
194 
195 
201  WidgetHook::Pos establishHookPoint (WidgetHook* newView);
202 
203 
228  static Appearance selectAppearance (PDelegate& existing,
229  Appearance desired =PENDING,
230  WidgetHook* newView =nullptr,
231  optional<TimeSpan> const& timing =nullopt);
232 
240  static Gtk::Widget& expect_and_expose_Widget (PDelegate& manager);
241 
242 
243  private:/* ===== Internals ===== */
244 
245  };
246 
247 
248 }}// namespace stage::timeline
249 #endif /*STAGE_TIMELINE_CLIP_WIDGET_H*/
static Appearance selectAppearance(PDelegate &existing, Appearance desired=PENDING, WidgetHook *newView=nullptr, optional< TimeSpan > const &timing=nullopt)
request to change the clip delegate&#39;s appearance style, if possible.
a mutable time value, behaving like a plain number, allowing copy and re-accessing ...
Definition: timevalue.hpp:241
virtual Appearance changeAppearance(Appearance desired)=0
alter appearance style, to the degree possible for this delegate.
static const string defaultName
placeholder name – typically overridden from the model
virtual cuString getClipName() const =0
human readable rendering of the clip&#39;s name or identity
virtual Appearance currentAppearance() const =0
presentation mode and style currently employed
Appearance
desired appearance style for the clip
Lumiera&#39;s internal time value datatype.
Definition: timevalue.hpp:308
Specialised (abstracted) presentation context with positioning by coordinates.
WidgetHook::Pos establishHookPoint(WidgetHook *newView)
(re)establish current canvas attachment coordinates, thereby possibly switching to a new canvas imple...
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:46
virtual ~ClipDelegate()
this is an interface
Duration is the internal Lumiera time metric.
Definition: timevalue.hpp:477
static Gtk::Widget & expect_and_expose_Widget(PDelegate &manager)
Wrapper to safely expose the actual clip implementation widget.
static const int defaultOffsetY
vertical offset below the track start
A time interval anchored at a specific point in time.
Definition: timevalue.hpp:582
a family of time value like entities and their relationships.
A set of basic GTK includes for the UI.