Scroom  0.14
colormapprovider.hh
Go to the documentation of this file.
1 /*
2  * Scroom - Generic viewer for 2D data
3  * Copyright (C) 2009-2022 Kees-Jan Dijkzeul
4  *
5  * SPDX-License-Identifier: LGPL-2.1
6  */
7 
8 #pragma once
9 
10 #include <map>
11 
12 #include <boost/enable_shared_from_this.hpp>
13 #include <boost/shared_ptr.hpp>
14 
15 #include <gtk/gtk.h>
16 
17 #include <scroom/colormappable.hh>
18 #include <scroom/observable.hh>
20 
21 namespace Scroom::ColormapImpl
22 {
29  : public Viewable
30  , public boost::enable_shared_from_this<ColormapProvider>
31  {
32  public:
33  using Ptr = boost::shared_ptr<ColormapProvider>;
34 
35  private:
38 
40  std::map<ViewInterface::WeakPtr, GtkTreeView*> views;
41 
43  GtkListStore* colormaps{nullptr};
44 
47 
49  explicit ColormapProvider(const Colormappable::Ptr& c);
50 
51  public:
54 
56  ~ColormapProvider() override;
57 
58  ColormapProvider(const ColormapProvider&) = delete;
62 
63  // Viewable ////////////////////////////////////////////////////////////
64 
66  void open(ViewInterface::WeakPtr vi) override;
67 
69  void close(ViewInterface::WeakPtr vi) override;
70 
71  // Helpers /////////////////////////////////////////////////////////////
72 
74  void on_colormap_selected(GtkTreeView* tv);
75  };
76 
77 } // namespace Scroom::ColormapImpl
Scroom::ColormapImpl::ColormapProvider::open
void open(ViewInterface::WeakPtr vi) override
Definition: colormapprovider.cc:122
Scroom::ColormapImpl
Definition: colormapplugin.cc:21
Scroom::ColormapImpl::ColormapProvider::on_colormap_selected
void on_colormap_selected(GtkTreeView *tv)
Definition: colormapprovider.cc:145
Scroom::ColormapImpl::ColormapProvider::~ColormapProvider
~ColormapProvider() override
Definition: colormapprovider.cc:102
presentationinterface.hh
Scroom::ColormapImpl::COLUMN_NAME
@ COLUMN_NAME
Definition: colormapprovider.cc:40
ViewInterface::Ptr
boost::shared_ptr< ViewInterface > Ptr
Definition: viewinterface.hh:193
colormappable.hh
observable.hh
Scroom::ColormapImpl::ColormapProvider::operator=
ColormapProvider operator=(const ColormapProvider &)=delete
Scroom::ColormapImpl::ColormapProvider::ColormapProvider
ColormapProvider(const Colormappable::Ptr &c)
Definition: colormapprovider.cc:66
PresentationInterface::Ptr
boost::shared_ptr< PresentationInterface > Ptr
Definition: presentationinterface.hh:74
Scroom::ColormapImpl::ColormapProvider::Ptr
boost::shared_ptr< ColormapProvider > Ptr
Definition: colormapprovider.hh:33
ViewInterface::WeakPtr
boost::weak_ptr< ViewInterface > WeakPtr
Definition: viewinterface.hh:194
Colormap::Ptr
boost::shared_ptr< Colormap > Ptr
Definition: colormappable.hh:31
colormap
const Colormap::Ptr colormap
Definition: colormaphelpers_test.cc:54
Scroom::ColormapImpl::ColormapProvider::registration
Scroom::Utils::Stuff registration
Definition: colormapprovider.hh:46
Scroom::ColormapImpl::ColormapProvider::create
static ColormapProvider::Ptr create(const PresentationInterface::Ptr &p)
Definition: colormapprovider.cc:47
anonymous_namespace{colormapprovider.cc}::on_colormap_selected
void on_colormap_selected(GtkTreeView *tv, gpointer user_data)
Definition: colormapprovider.cc:27
Scroom::ColormapImpl::Colormaps::getColormaps
std::list< Colormap::ConstPtr > getColormaps()
Definition: colormaps.cc:97
Scroom::ColormapImpl::ColormapProvider
Definition: colormapprovider.hh:28
Scroom::ColormapImpl::Colormaps::getInstance
static Colormaps & getInstance()
Definition: colormaps.cc:71
Scroom::Utils::Stuff
boost::shared_ptr< void > Stuff
Definition: stuff.hh:18
Colormappable::Ptr
boost::shared_ptr< Colormappable > Ptr
Definition: colormappable.hh:116
colormapprovider.hh
defect_message
#define defect_message(m)
Definition: assertions.hh:43
Viewable
Definition: presentationinterface.hh:32
colormaps.hh
Viewable::Ptr
boost::shared_ptr< Viewable > Ptr
Definition: presentationinterface.hh:35
Scroom::ColormapImpl::N_COLUMNS
@ N_COLUMNS
Definition: colormapprovider.cc:42
Scroom::ColormapImpl::ColormapProvider::views
std::map< ViewInterface::WeakPtr, GtkTreeView * > views
Definition: colormapprovider.hh:40
Scroom::ColormapImpl::COLUMN_POINTER
@ COLUMN_POINTER
Definition: colormapprovider.cc:41
Scroom::ColormapImpl::ColormapProvider::colormappable
Colormappable::WeakPtr colormappable
Definition: colormapprovider.hh:37
Scroom::ColormapImpl::ColormapProvider::close
void close(ViewInterface::WeakPtr vi) override
Definition: colormapprovider.cc:135
Colormappable::WeakPtr
boost::weak_ptr< Colormappable > WeakPtr
Definition: colormappable.hh:117
bookkeeping.hh
Colormap::ConstPtr
boost::shared_ptr< const Colormap > ConstPtr
Definition: colormappable.hh:32
Scroom::ColormapImpl::ColormapProvider::colormaps
GtkListStore * colormaps
Definition: colormapprovider.hh:43