Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
panel-locator.hpp
Go to the documentation of this file.
1/*
2 PANEL-LOCATOR.hpp - manage all top level windows
3
4 Copyright (C)
5 2017, 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
40#ifndef STAGE_CTRL_PANEL_LOCATOR_H
41#define STAGE_CTRL_PANEL_LOCATOR_H
42
43#include "stage/gtk-base.hpp"
45#include "lib/format-string.hpp"
46#include "lib/meta/util.hpp"
47#include "lib/nocopy.hpp"
48
49#include <type_traits>
50#include <memory>
51#include <list>
52
53
54namespace stage {
55namespace workspace {
56 class WorkspaceWindow;
57}
58namespace panel {
59 class Panel;
60}
61namespace ctrl {
62
63 namespace error = lumiera::error;
64
65 using panel::Panel;
66 using util::_Fmt;
67 using std::list;
68
69
70
78 {
79 using PWindow = std::shared_ptr<workspace::WorkspaceWindow>;
80 using WindowList = list<PWindow>;
81
83
84
85 public:
87
99 template<class PAN>
100 PAN& find_or_create();
101
102
103 private:
105 };
106
107
108
110 template<class PAN>
111 inline PAN&
113 {
114 static_assert (std::is_base_of<panel::Panel, PAN>(), "Lumiera Panel subclass expected");
115
116 int typeID = workspace::PanelManager::findPanelID<PAN>();
117 if (-1 == typeID)
118 throw error::Invalid (_Fmt{"Requested type «%s» not usable as docking panel."}
119 % util::typeStr<PAN>()
120 ,LERR_(WRONG_TYPE));
121
122 return dynamic_cast<PAN&> (preliminary_impl_PanelLookup (typeID));
123 }
124
125
126
127}}// namespace stage::ctrl
128#endif /*STAGE_CTRL_PANEL_LOCATOR_H*/
Service to access, locate or place panels within top-level windows Access- and query front-end to the...
panel::Panel & preliminary_impl_PanelLookup(int typeID)
PAN & find_or_create()
lookup or allocate "the" instance of the indicated Panel(subtype).
std::shared_ptr< workspace::WorkspaceWindow > PWindow
The base class for all dockable panels.
Definition panel.hpp:42
The main Lumiera workspace window.
Any copy and copy construction prohibited.
Definition nocopy.hpp:38
A front-end for using printf-style formatting.
#define LERR_(_NAME_)
Definition error.hpp:45
Front-end for printf-style string template interpolation.
A set of basic GTK includes for the UI.
Simple and lightweight helpers for metaprogramming and type detection.
LumieraError< LERR_(INVALID)> Invalid
Definition error.hpp:211
Lumiera GTK UI implementation root.
Definition guifacade.cpp:37
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Management of dockable panels.