Scroom  0.14
DummyView Class Reference
Inheritance diagram for DummyView:
Inheritance graph
Collaboration diagram for DummyView:
Collaboration graph

Public Types

using Ptr = boost::shared_ptr< DummyView >
 
- Public Types inherited from ViewInterface
using Ptr = boost::shared_ptr< ViewInterface >
 
using WeakPtr = boost::weak_ptr< ViewInterface >
 

Public Member Functions

 DummyView (PresentationInterface::Ptr presentation_)
 
void invalidate () override
 
ProgressInterface::Ptr getProgressInterface () override
 
void addSideWidget (std::string, GtkWidget *) override
 
void removeSideWidget (GtkWidget *) override
 
void addToToolbar (GtkToolItem *) override
 
void removeFromToolbar (GtkToolItem *) override
 
void registerSelectionListener (SelectionListener::Ptr) override
 
void registerPostRenderer (PostRenderer::Ptr) override
 
void setStatusMessage (const std::string &msg) override
 
PresentationInterface::Ptr getCurrentPresentation () override
 
void addToolButton (GtkToggleButton *, ToolStateListener::Ptr) override
 
std::string nextStatusMessage ()
 

Static Public Member Functions

static Ptr createWithPresentation ()
 
static Ptr createWithoutPresentation ()
 
static Ptr create (PresentationInterface::Ptr presentation_)
 

Public Attributes

int reg_sel = 0
 
int reg_post = 0
 
int tool_btn = 0
 
PresentationInterface::Ptr presentation
 
boost::mutex mut
 
boost::condition_variable cond
 
std::list< std::string > statusMessages
 

Member Typedef Documentation

◆ Ptr

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

Constructor & Destructor Documentation

◆ DummyView()

DummyView::DummyView ( PresentationInterface::Ptr  presentation_)
inlineexplicit
55  : presentation(std::move(presentation_))
56  {
57  }

Referenced by create().

Here is the caller graph for this function:

Member Function Documentation

◆ addSideWidget()

void DummyView::addSideWidget ( std::string  title,
GtkWidget *  w 
)
inlineoverridevirtual

Request that the given widget be added to the sidebar.

Precondition
Should be called from within a Gdk critical section (i.e. between gdk_threads_enter() and gdk_threads_leave() calls)

Implements ViewInterface.

61 {}

◆ addToolButton()

void DummyView::addToolButton ( GtkToggleButton *  ,
ToolStateListener::Ptr   
)
inlineoverridevirtual

Adds a new tool button to the toolbar. The given ToolStateListener will be informed when the tool is turned on or off. Only one tool will be active at the same time.

See also
ToolStateListener

Implements ViewInterface.

74 { tool_btn++; }

◆ addToToolbar()

void DummyView::addToToolbar ( GtkToolItem *  ti)
inlineoverridevirtual

Request that the given tool item be added to the toolbar.

Precondition
Should be called from within a Gdk critical section (i.e. between gdk_threads_enter() and gdk_threads_leave() calls)

Implements ViewInterface.

63 {}

◆ create()

static Ptr DummyView::create ( PresentationInterface::Ptr  presentation_)
inlinestatic
52 { return Ptr(new DummyView(std::move(presentation_))); }

Referenced by createWithoutPresentation(), and createWithPresentation().

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

◆ createWithoutPresentation()

static Ptr DummyView::createWithoutPresentation ( )
inlinestatic
51 { return create(nullptr); }

Referenced by BOOST_AUTO_TEST_CASE().

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

◆ createWithPresentation()

static Ptr DummyView::createWithPresentation ( )
inlinestatic
50 { return create(DummyPresentation::create()); }

Referenced by BOOST_AUTO_TEST_CASE().

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

◆ getCurrentPresentation()

PresentationInterface::Ptr DummyView::getCurrentPresentation ( )
inlineoverridevirtual

Returns a shared pointer to the current presentation.

See also
PresentationInterface

Implements ViewInterface.

73 { return presentation; }

◆ getProgressInterface()

ProgressInterface::Ptr DummyView::getProgressInterface ( )
inlineoverridevirtual

Return a pointer to the progess interface associated with the View

Note
The progress bar should only be manipulated from within a Gdk critical section (i.e. between gdk_threads_enter() and gdk_threads_leave() calls)

Implements ViewInterface.

60 { return nullptr; }

◆ invalidate()

void DummyView::invalidate ( )
inlineoverridevirtual

Request that the window content is redrawn.

Precondition
Should be called from within a Gdk critical section (i.e. between gdk_threads_enter() and gdk_threads_leave() calls)

Implements ViewInterface.

59 {}

◆ nextStatusMessage()

std::string DummyView::nextStatusMessage ( )
inline
77  {
78  boost::mutex::scoped_lock l(mut);
79 
80  BOOST_REQUIRE(cond.wait_for(l, boost::chrono::milliseconds(500), [&] { return !statusMessages.empty(); }));
81 
82  auto result = statusMessages.front();
83  statusMessages.pop_front();
84  return result;
85  }
Here is the call graph for this function:

◆ registerPostRenderer()

void DummyView::registerPostRenderer ( PostRenderer::Ptr  )
inlineoverridevirtual

Register a postrenderer to be updated whenever a redraw occurs. When this happens, the 'render' function gets called on the instance that is passed to the given instance.

Note that the order in which different registered instances get updated is the order in which they register to the view. This order remains constant throughout the view's lifetime.

See also
PostRenderer

Implements ViewInterface.

66 { reg_post++; }

◆ registerSelectionListener()

void DummyView::registerSelectionListener ( SelectionListener::Ptr  )
inlineoverridevirtual

Register a SelectionListener to be updated whenever the user selects a region . When the user changes the selection, various functions on the given instance are called.

See also
SelectionListener

Implements ViewInterface.

65 { reg_sel++; }

◆ removeFromToolbar()

void DummyView::removeFromToolbar ( GtkToolItem *  ti)
inlineoverridevirtual

Request that the given tool item be removed from the toolbar.

Precondition
Should be called from within a Gdk critical section (i.e. between gdk_threads_enter() and gdk_threads_leave() calls)

Implements ViewInterface.

64 {}

◆ removeSideWidget()

void DummyView::removeSideWidget ( GtkWidget *  w)
inlineoverridevirtual

Request that the given widget be removed from the sidebar.

Precondition
Should be called from within a Gdk critical section (i.e. between gdk_threads_enter() and gdk_threads_leave() calls)

Implements ViewInterface.

62 {}

◆ setStatusMessage()

void DummyView::setStatusMessage ( const std::string &  )
inlineoverridevirtual

Sets the status message in the status bar of the application.

Implements ViewInterface.

68  {
69  boost::mutex::scoped_lock const l(mut);
70  statusMessages.push_back(msg);
71  cond.notify_all();
72  }

Member Data Documentation

◆ cond

boost::condition_variable DummyView::cond

◆ mut

boost::mutex DummyView::mut

◆ presentation

PresentationInterface::Ptr DummyView::presentation

Referenced by getCurrentPresentation().

◆ reg_post

int DummyView::reg_post = 0

Referenced by registerPostRenderer().

◆ reg_sel

int DummyView::reg_sel = 0

◆ statusMessages

std::list<std::string> DummyView::statusMessages

◆ tool_btn

int DummyView::tool_btn = 0

Referenced by addToolButton().


The documentation for this class was generated from the following file:
DummyView::reg_sel
int reg_sel
Definition: pipette-tests.cc:87
DummyView::presentation
PresentationInterface::Ptr presentation
Definition: pipette-tests.cc:90
DummyView::DummyView
DummyView(PresentationInterface::Ptr presentation_)
Definition: pipette-tests.cc:54
DummyPresentation::create
static PresentationInterface::Ptr create()
Definition: pipette-tests.cc:25
DummyView::cond
boost::condition_variable cond
Definition: pipette-tests.cc:93
DummyView::tool_btn
int tool_btn
Definition: pipette-tests.cc:89
DummyView::reg_post
int reg_post
Definition: pipette-tests.cc:88
DummyView::statusMessages
std::list< std::string > statusMessages
Definition: pipette-tests.cc:94
BOOST_REQUIRE
BOOST_REQUIRE(originalColormap)
DummyView::mut
boost::mutex mut
Definition: pipette-tests.cc:92
DummyView::Ptr
boost::shared_ptr< DummyView > Ptr
Definition: pipette-tests.cc:48
DummyView::create
static Ptr create(PresentationInterface::Ptr presentation_)
Definition: pipette-tests.cc:52