Engauge Digitizer 2
Loading...
Searching...
No Matches
GuidelineViewStateContext Class Reference

Context class for state machine that tracks the View / Guidelines mode. More...

#include <GuidelineViewStateContext.h>

Collaboration diagram for GuidelineViewStateContext:
Collaboration graph

Public Member Functions

 GuidelineViewStateContext ()
 Single constructor.
virtual ~GuidelineViewStateContext ()
void handleStateChange (GuidelineViewState state)
 Handle user or code generated change in selected guideline view mode.
void requestStateTransition (GuidelineViewState guidelineState)
 Request a state transition.
GuidelineViewState state () const
 Current state for serializing.

Detailed Description

Context class for state machine that tracks the View / Guidelines mode.

This is needed to track before and after states for generating CmdGuidelineViewState

Definition at line 16 of file GuidelineViewStateContext.h.

Constructor & Destructor Documentation

◆ GuidelineViewStateContext()

GuidelineViewStateContext::GuidelineViewStateContext ( )

Single constructor.

Definition at line 14 of file GuidelineViewStateContext.cpp.

15{
16 m_states.insert (GUIDELINE_VIEW_STATE_EDIT, new GuidelineViewStateEdit (*this));
17 m_states.insert (GUIDELINE_VIEW_STATE_HIDE, new GuidelineViewStateHide (*this));
18 m_states.insert (GUIDELINE_VIEW_STATE_LOCK, new GuidelineViewStateLock (*this));
19 ENGAUGE_ASSERT (m_states.size () == NUM_GUIDELINE_VIEW_STATES);
20
21 m_currentState = NUM_GUIDELINE_VIEW_STATES; // Value that forces a transition right away
22 m_nextState = GUIDELINE_VIEW_STATE_HIDE;
23
24 transitionIfRequested ();
25}
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT.
@ GUIDELINE_VIEW_STATE_HIDE
@ GUIDELINE_VIEW_STATE_EDIT
@ NUM_GUIDELINE_VIEW_STATES
@ GUIDELINE_VIEW_STATE_LOCK

◆ ~GuidelineViewStateContext()

GuidelineViewStateContext::~GuidelineViewStateContext ( )
virtual

Definition at line 27 of file GuidelineViewStateContext.cpp.

28{
29}

Member Function Documentation

◆ handleStateChange()

void GuidelineViewStateContext::handleStateChange ( GuidelineViewState state)

Handle user or code generated change in selected guideline view mode.

Definition at line 31 of file GuidelineViewStateContext.cpp.

32{
33 ENGAUGE_ASSERT (m_currentState != NUM_GUIDELINE_VIEW_STATES);
34
35 m_states[m_currentState]->handleStateChange (state);
36 transitionIfRequested ();
37}
GuidelineViewState state() const
Current state for serializing.

◆ requestStateTransition()

void GuidelineViewStateContext::requestStateTransition ( GuidelineViewState guidelineState)

Request a state transition.

Definition at line 39 of file GuidelineViewStateContext.cpp.

40{
42
43 m_nextState = state;
44}

◆ state()

GuidelineViewState GuidelineViewStateContext::state ( ) const

Current state for serializing.

Definition at line 46 of file GuidelineViewStateContext.cpp.

47{
48 return m_currentState;
49}

The documentation for this class was generated from the following files: