Lumiera  0.pre.03
»edit your freedom«
timeline-panel.cpp
Go to the documentation of this file.
1 /*
2  TimelinePanel - Dockable panel to hold the main timeline view
3 
4  Copyright (C)
5  2016, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 * *****************************************************************/
13 
14 
25 #include "stage/gtk-base.hpp"
29 
30 using std::make_unique;
31 
32 
33 namespace stage {
34 namespace panel {
35 
36  using timeline::TimelinePage;
37  using timeline::TimelineWidget;
38  using timeline::TimelineWidgetEmpty;
39 
40 
42  Gdl::DockItem& dockItem)
43  : Panel(panelManager, dockItem, getTitle(), getStockID())
44  , tabs_{}
45  , pages_{}
46  {
47  addTimeline (PageHandle{new TimelineWidgetEmpty{}});
48 
49  // show everything....
50  this->add(tabs_);
51  this->show_all();
52  }
53 
54  const char*
55  TimelinePanel::getTitle()
56  {
57  return _("Timeline");
58  }
59 
60  const gchar*
61  TimelinePanel::getStockID()
62  {
63  return "panel_timeline";
64  }
65 
66 
67  namespace {
68  template<class P>
69  inline bool
70  isEmptyTimeline (P const& pages)
71  {
72  return 1 == pages.size()
73  and dynamic_cast<TimelineWidgetEmpty*> (pages[0].get());
74  }
75  }
76 
77  void
78  TimelinePanel::addTimeline (PageHandle&& pTimelineWidget)
79  {
80  if (isEmptyTimeline (pages_))
81  {
82  tabs_.remove_page();
83  pages_.clear();
84  }
85  pages_.push_back (move (pTimelineWidget));
86  TimelinePage& addedPage = *pages_.back();
87  tabs_.append_page (addedPage, addedPage.getLabel());
88  }
89 
90 
91 }} // namespace stage::panel
Interface: GUI page holding a timeline display.
Empty placeholder to be rendered when the UI starts without session.
A class to manage DockItem objects for WorkspaceWindow.
The base class for all dockable panels.
Definition: panel.hpp:40
Placeholder to show when no actual Timeline is present.
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:37
TimelinePanel(workspace::PanelManager &, Gdl::DockItem &)
void addTimeline(PageHandle &&)
take ownership of the widget and place it into a new tab
A set of basic GTK includes for the UI.
This file defines the core component of the Lumiera GUI.
A dockable container to hold a notebook of timeline displays.