Scroom 0.14-49-gb7ae7a6d
Loading...
Searching...
No Matches
presentationinterface.hh
Go to the documentation of this file.
1/*
2 * Scroom - Generic viewer for 2D data
3 * Copyright (C) 2009-2026 Kees-Jan Dijkzeul
4 *
5 * SPDX-License-Identifier: LGPL-2.1
6 */
7
8#pragma once
9
10#include <memory>
11#include <set>
12
13#include <gdk/gdk.h>
14
15#include <cairo.h>
16
17#include <scroom/context.hh>
18#include <scroom/interface.hh>
19#include <scroom/observable.hh>
20#include <scroom/rectangle.hh>
22
31class Viewable : private Interface
32{
33public:
34 using Ptr = std::shared_ptr<Viewable>;
35 using WeakPtr = std::weak_ptr<Viewable>;
36
37public:
45 virtual void open(ViewInterface::WeakPtr vi) = 0;
46
54 virtual void close(ViewInterface::WeakPtr vi) = 0;
55};
56
58
69 : public Viewable
70 , public ViewObservable
71{
72public:
73 using Ptr = std::shared_ptr<PresentationInterface>;
74 using WeakPtr = std::weak_ptr<PresentationInterface>;
75
78
91 virtual void redraw(ViewInterface::Ptr const& vi, cairo_t* cr, Scroom::Utils::Rectangle<double> presentationArea, int zoom) = 0;
92
101 virtual bool getProperty(const std::string& name, std::string& value) = 0;
102
104 virtual bool isPropertyDefined(const std::string& name) = 0;
105
107 virtual std::string getTitle() = 0;
108
110};
111
113{
114public:
115 // Viewable
116 void open(ViewInterface::WeakPtr vi) override;
117 void close(ViewInterface::WeakPtr vi) override;
118
119protected:
120 // ViewObservable
121 void observerAdded(Viewable::Ptr const& viewable, Scroom::Bookkeeping::Token const& t) override;
122
123protected:
127};
128
139
143class Aggregate : private Interface
144{
145public:
146 using Ptr = std::shared_ptr<Aggregate>;
147
148public:
149 virtual void addPresentation(PresentationInterface::Ptr const& presentation) = 0;
150};
const uint8_t value
Definition blob-tests.cc:114
Definition presentationinterface.hh:144
std::shared_ptr< Aggregate > Ptr
Definition presentationinterface.hh:146
virtual void addPresentation(PresentationInterface::Ptr const &presentation)=0
Definition interface.hh:11
Definition presentationinterface.hh:130
Scroom::Utils::WeakKeySet< ViewInterface::WeakPtr > getViews() final
Definition presentationinterface.hh:137
Scroom::Utils::WeakKeySet< ViewInterface::WeakPtr > views
Definition presentationinterface.hh:132
void viewAdded(ViewInterface::WeakPtr vi) final
Definition presentationinterface.hh:135
void viewRemoved(ViewInterface::WeakPtr vi) final
Definition presentationinterface.hh:136
Definition presentationinterface.hh:113
virtual void viewRemoved(ViewInterface::WeakPtr vi)=0
virtual void viewAdded(ViewInterface::WeakPtr vi)=0
void close(ViewInterface::WeakPtr vi) override
Definition presentationinterface.cc:23
virtual Scroom::Utils::WeakKeySet< ViewInterface::WeakPtr > getViews()=0
void open(ViewInterface::WeakPtr vi) override
Definition presentationinterface.cc:11
void observerAdded(Viewable::Ptr const &viewable, Scroom::Bookkeeping::Token const &t) override
Definition presentationinterface.cc:35
Definition presentationinterface.hh:71
virtual Scroom::Utils::Rectangle< double > getRect()=0
virtual Scroom::Utils::Context::ConstPtr getContext() const =0
virtual void redraw(ViewInterface::Ptr const &vi, cairo_t *cr, Scroom::Utils::Rectangle< double > presentationArea, int zoom)=0
std::shared_ptr< PresentationInterface > Ptr
Definition presentationinterface.hh:73
virtual std::string getTitle()=0
std::weak_ptr< PresentationInterface > WeakPtr
Definition presentationinterface.hh:74
virtual bool getProperty(const std::string &name, std::string &value)=0
virtual bool isPropertyDefined(const std::string &name)=0
Definition bookkeeping.hh:50
std::shared_ptr< const Context > ConstPtr
Definition context.hh:27
Definition observable.hh:71
Definition rectangle.hh:29
std::weak_ptr< ViewInterface > WeakPtr
Definition viewinterface.hh:194
std::shared_ptr< ViewInterface > Ptr
Definition viewinterface.hh:193
Definition presentationinterface.hh:32
virtual void open(ViewInterface::WeakPtr vi)=0
std::shared_ptr< Viewable > Ptr
Definition presentationinterface.hh:34
virtual void close(ViewInterface::WeakPtr vi)=0
std::weak_ptr< Viewable > WeakPtr
Definition presentationinterface.hh:35
std::set< K, std::owner_less< K > > WeakKeySet
Definition utilities.hh:121
ViewInterface::Ptr const vi
Definition pipette-tests.cc:186
ThreadPool t(0)
cairo_t * cr
Definition transformpresentation_test.cc:72