Scroom  0.14
SizeDeterminer Class Reference

#include <sizedeterminer.hh>

Collaboration diagram for SizeDeterminer:
Collaboration graph

Classes

class  PresentationData
 

Public Types

using Ptr = boost::shared_ptr< SizeDeterminer >
 

Public Member Functions

void add (PresentationInterface::Ptr const &p)
 
Scroom::Utils::Rectangle< double > getRect () const
 
void open (PresentationInterface::Ptr const &p, ViewInterface::WeakPtr const &vi)
 
void close (PresentationInterface::Ptr const &p, ViewInterface::WeakPtr const &vi)
 

Static Public Member Functions

static Ptr create ()
 

Private Member Functions

 SizeDeterminer ()=default
 
void sendUpdates ()
 

Private Attributes

std::list< PresentationInterface::Ptrpresentations
 
std::map< PresentationInterface::Ptr, PresentationDataresizablePresentationData
 

Member Typedef Documentation

◆ Ptr

using SizeDeterminer::Ptr = boost::shared_ptr<SizeDeterminer>

Constructor & Destructor Documentation

◆ SizeDeterminer()

SizeDeterminer::SizeDeterminer ( )
privatedefault

Referenced by create().

Here is the caller graph for this function:

Member Function Documentation

◆ add()

void SizeDeterminer::add ( PresentationInterface::Ptr const &  p)
69 {
70  ResizablePresentationInterface::Ptr const r = boost::dynamic_pointer_cast<ResizablePresentationInterface>(p);
71  if(r)
72  {
73  resizablePresentationData.insert(std::make_pair(p, PresentationData(r)));
74  }
75  else
76  {
77  presentations.push_back(p);
78  }
79 
80  sendUpdates();
81 }
Here is the call graph for this function:

◆ close()

void SizeDeterminer::close ( PresentationInterface::Ptr const &  p,
ViewInterface::WeakPtr const &  vi 
)
113 {
114  if(resizablePresentationData.count(p))
115  {
116  PresentationData& d = resizablePresentationData[p];
117  require(d.views.count(vi));
118  d.views.erase(vi);
119  }
120  else
121  {
122  require(!boost::dynamic_pointer_cast<ResizablePresentationInterface>(p));
123  }
124 }

◆ create()

SizeDeterminer::Ptr SizeDeterminer::create ( )
static
66 { return Ptr(new SizeDeterminer()); }

Referenced by BOOST_AUTO_TEST_CASE().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRect()

Scroom::Utils::Rectangle< double > SizeDeterminer::getRect ( ) const
84 {
85  if(!presentations.empty())
86  {
88  }
89  if(!resizablePresentationData.empty())
90  {
92  }
93  return {};
94 }

Referenced by open(), and sendUpdates().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ open()

void SizeDeterminer::open ( PresentationInterface::Ptr const &  p,
ViewInterface::WeakPtr const &  vi 
)
97 {
98  if(resizablePresentationData.count(p))
99  {
100  PresentationData& d = resizablePresentationData[p];
101  require(!d.views.count(vi));
102  d.views.insert(vi);
103 
104  d.resizablePresentationInterface->setRect(vi, getRect());
105  }
106  else
107  {
108  require(!boost::dynamic_pointer_cast<ResizablePresentationInterface>(p));
109  }
110 }
Here is the call graph for this function:

◆ sendUpdates()

void SizeDeterminer::sendUpdates ( )
private
127 {
129 
130  for(auto const& data: resizablePresentationData)
131  {
132  for(auto const& view: data.second.views)
133  {
134  data.second.resizablePresentationInterface->setRect(view, rect);
135  }
136  }
137 }

Referenced by add().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ presentations

std::list<PresentationInterface::Ptr> SizeDeterminer::presentations
private

Referenced by add(), and getRect().

◆ resizablePresentationData

std::map<PresentationInterface::Ptr, PresentationData> SizeDeterminer::resizablePresentationData
private

Referenced by add(), close(), getRect(), open(), and sendUpdates().


The documentation for this class was generated from the following files:
SizeDeterminer::SizeDeterminer
SizeDeterminer()=default
SizeDeterminer::sendUpdates
void sendUpdates()
Definition: sizedeterminer.cc:126
anonymous_namespace{sizedeterminer.cc}::DetermineSize
Scroom::Utils::Rectangle< double > DetermineSize(const std::list< PresentationInterface::Ptr > &presentations)
Definition: sizedeterminer.cc:18
SizeDeterminer::presentations
std::list< PresentationInterface::Ptr > presentations
Definition: sizedeterminer.hh:37
ResizablePresentationInterface::Ptr
boost::shared_ptr< ResizablePresentationInterface > Ptr
Definition: resizablepresentationinterface.hh:29
require
#define require(expr)
Definition: assertions.hh:28
SizeDeterminer::getRect
Scroom::Utils::Rectangle< double > getRect() const
Definition: sizedeterminer.cc:83
SizeDeterminer::Ptr
boost::shared_ptr< SizeDeterminer > Ptr
Definition: sizedeterminer.hh:22
SizeDeterminer::resizablePresentationData
std::map< PresentationInterface::Ptr, PresentationData > resizablePresentationData
Definition: sizedeterminer.hh:38
Scroom::Utils::Rectangle< double >
anonymous_namespace{sizedeterminer.cc}::keys
std::list< K > keys(std::map< K, V > const &m)
Definition: sizedeterminer.cc:37