Scroom 0.14-48-ga0fee447
Loading...
Searching...
No Matches
DummyView Class Reference
Inheritance diagram for DummyView:
Inheritance graph
Collaboration diagram for DummyView:
Collaboration graph

Public Types

using Ptr = std::shared_ptr< DummyView >
 
- Public Types inherited from ViewInterface
using Ptr = std::shared_ptr< ViewInterface >
 
using WeakPtr = std::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
 
std::mutex mut
 
std::condition_variable cond
 
std::list< std::string > statusMessages
 

Member Typedef Documentation

◆ Ptr

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

Constructor & Destructor Documentation

◆ DummyView()

DummyView::DummyView ( PresentationInterface::Ptr  presentation_)
inlineexplicit
72 : presentation(std::move(presentation_))
73 {
74 }
PresentationInterface::Ptr presentation
Definition pipette-tests.cc:109

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.

78{}

◆ 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.

91{ tool_btn++; }
int tool_btn
Definition pipette-tests.cc:108

◆ 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.

80{}

◆ create()

static Ptr DummyView::create ( PresentationInterface::Ptr  presentation_)
inlinestatic
69{ return std::make_shared<DummyView>(std::move(presentation_)); }

Referenced by createWithoutPresentation(), and createWithPresentation().

Here is the caller graph for this function:

◆ createWithoutPresentation()

static Ptr DummyView::createWithoutPresentation ( )
inlinestatic
68{ return create(nullptr); }
static Ptr create(PresentationInterface::Ptr presentation_)
Definition pipette-tests.cc:69
Here is the call graph for this function:

◆ createWithPresentation()

static Ptr DummyView::createWithPresentation ( )
inlinestatic
static PresentationInterface::Ptr create()
Definition pipette-tests.cc:35
Here is the call graph for this function:

◆ getCurrentPresentation()

PresentationInterface::Ptr DummyView::getCurrentPresentation ( )
inlineoverridevirtual

Returns a shared pointer to the current presentation.

See also
PresentationInterface

Implements ViewInterface.

90{ 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.

77{ 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.

76{}

◆ nextStatusMessage()

std::string DummyView::nextStatusMessage ( )
inline
94 {
95 std::unique_lock<std::mutex> l(mut);
96 if(!cond.wait_for(l, std::chrono::milliseconds(500), [&] { return !statusMessages.empty(); }))
97 {
98 ADD_FAILURE() << "Timeout waiting for status message";
99 return {};
100 }
101 auto result = statusMessages.front();
102 statusMessages.pop_front();
103 return result;
104 }
std::mutex mut
Definition pipette-tests.cc:111
std::condition_variable cond
Definition pipette-tests.cc:112
std::list< std::string > statusMessages
Definition pipette-tests.cc:113
PageList const l
Definition compression-tests.cc:33
SampleIterator< const uint8_t > result
Definition sampleiterator-tests.cc:94

◆ 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.

83{ reg_post++; }
int reg_post
Definition pipette-tests.cc:107

◆ 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.

82{ reg_sel++; }
int reg_sel
Definition pipette-tests.cc:106

◆ 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.

81{}

◆ 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.

79{}

◆ setStatusMessage()

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

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

Implements ViewInterface.

85 {
86 std::unique_lock<std::mutex> const l(mut);
87 statusMessages.push_back(msg);
88 cond.notify_all();
89 }

Member Data Documentation

◆ cond

std::condition_variable DummyView::cond

◆ mut

std::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: