HPS::MarkupOperator Class Reference

#include <sprk_ops.h>

Inheritance diagram for HPS::MarkupOperator:
HPS::Operator HPS::Sprocket HPS::Object

Classes

class  MarkupInsertedEvent
 

Public Types

enum  MarkupType { Freehand, Text, Circle, Rectangle }
 
- Public Types inherited from HPS::Operator
enum  Priority { Low, Default, High }
 

Public Member Functions

void DeleteMarkups ()
 
RGBColor GetColor ()
 
LineAttributeKit GetLineAttributes ()
 
MarkupType GetMarkupType ()
 
virtual HPS::UTF8 GetName () const override
 
SegmentKey GetSegmentKey ()
 
TextAttributeKit GetTextAttributes ()
 
bool IsMarkupActive ()
 
 MarkupOperator (MouseButtons in_mouse_trigger=MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger=ModifierKeys())
 
virtual bool OnKeyDown (KeyboardState const &in_state) override
 
virtual bool OnMouseDown (MouseState const &in_state) override
 
virtual bool OnMouseMove (MouseState const &in_state) override
 
virtual bool OnMouseUp (MouseState const &in_state) override
 
virtual bool OnTextInput (HPS::UTF8 const &in_text) override
 
virtual bool OnTouchDown (TouchState const &in_state) override
 
virtual bool OnTouchMove (TouchState const &in_state) override
 
virtual bool OnTouchUp (TouchState const &in_state) override
 
virtual void OnViewAttached (HPS::View const &in_attached_view) override
 
virtual void OnViewDetached (HPS::View const &in_detached_view) override
 
void SetColor (RGBColor const &in_color)
 
void SetLineAttribute (LineAttributeKit const &in_line_attributes)
 
void SetMarkupType (MarkupType in_markup_type)
 
void SetTextAttribute (TextAttributeKit const &in_text_attributes)
 
- Public Member Functions inherited from HPS::Operator
virtual void Assign (Operator const &in_that)
 
void DetachView ()
 
virtual bool Equals (Operator const &in_that) const
 
View GetAttachedView () const
 
ModifierKeys GetModifierTrigger () const
 
MouseButtons GetMouseTrigger () const
 
virtual bool IsMouseTriggered (MouseState const &in_state)
 
HPS::Type ObjectType () const
 
virtual bool OnKeyUp (KeyboardState const &in_state)
 
virtual void OnModelAttached ()
 
virtual void OnModelDetached ()
 
virtual bool OnMouseEnter (MouseState const &in_state)
 
virtual bool OnMouseLeave (MouseState const &in_state)
 
virtual bool OnMouseWheel (MouseState const &in_state)
 
virtual bool OnTimerTick (HPS::TimerTickEvent const &in_event)
 
 Operator (MouseButtons in_mouse_trigger=MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger=ModifierKeys())
 
 Operator (Operator const &in_that)
 
virtual bool operator!= (Operator const &in_that) const
 
virtual Operatoroperator= (Operator const &in_that)
 
virtual bool operator== (Operator const &in_that) const
 
void SetModifierTrigger (ModifierKeys in_modifiers)
 
void SetMouseTrigger (MouseButtons in_buttons)
 
- Public Member Functions inherited from HPS::Sprocket
 Sprocket (Sprocket &&in_that)
 
- Public Member Functions inherited from HPS::Object
virtual bool Empty () const
 
intptr_t GetClassID () const
 
intptr_t GetInstanceID () const
 
bool HasType (HPS::Type in_mask) const
 
 Object (Object const &that)
 
 Object (Object &&in_that)
 
Objectoperator= (Object const &other_object)
 
Objectoperator= (Object &&in_that)
 
virtual void Reset ()
 
virtual HPS::Type Type () const
 

Additional Inherited Members

- Static Public Member Functions inherited from HPS::Object
template<typename T >
static intptr_t ClassID ()
 
- Static Public Attributes inherited from HPS::Operator
static const HPS::Type staticType = HPS::Type::Operator
 
- Static Public Attributes inherited from HPS::Object
static const HPS::Type staticType = HPS::Type::None
 
- Protected Attributes inherited from HPS::Operator
HPS::ModifierKeys modifier_trigger
 
HPS::MouseButtons mouse_trigger
 

Detailed Description

The MarkupOperator class defines an operator which allows the user to insert mark-up text and geometry. This Operator works for both mouse- and touch-driven devices. The markup created through this operator will be deleted when the operator is popped from the View.

The MarkupOperator allows users to add the following markup types:

  • Freehand: For mouse driven devices, click and move the mouse to draw freehand markup. For touch driven devices, touch down and move your finger to draw freehand markup
  • Text: For mouse driven devices, click where you want to place text. Type with the keyboard and click elsewhere when you are done inserting the note. For touch driven devices, tap where you want to place text. Use the software keyboard to type, and hide the keyboard when you are done inserting the note. When inserting text markup on touch devices, the view will shift while inserting text, to allow you to always see the text you are inserting. The view will reset smoothly once you hide the keyboard.
  • Circle: For mouse driven devices, click where you want to place the circle. Move the mouse while holding down the button associated with the operator to change the radius of the circle. For touch driven devices, there are two options available for inserting circle markups: a. tap where you want to place the circle and move your finger to change the circle radius b. tap with two fingers. Move and pinch with the fingers to change the position and radius of the circle
  • Rectangle: For mouse driven devices, click where you want to place the top left corner of the rectangle, Move the mouse while holding down the button associated with the operator to change the position of the bottom right corner of the rectangle. For touch driven devices, there are two options available for inserting rectangle markups: a. tap where you want to place the top left corner of the rectangle and move your finger to change the position of the bottom right corner. b. tap with two fingers. Move and pinch with the fingers to change the position and size of the rectangle.

    On devices with a keyboard, pressing Escape will delete the markup currently being inserted. An event of type MarkupInsertedEvent in injected after a markup is inserted.

Member Function Documentation

◆ DeleteMarkups()

void HPS::MarkupOperator::DeleteMarkups ( )

Deletes all markups

◆ GetColor()

RGBColor HPS::MarkupOperator::GetColor ( )
inline

Returns the color of the markup which will be inserted.

Returns
The color which will be used for the next markup

◆ GetLineAttributes()

LineAttributeKit HPS::MarkupOperator::GetLineAttributes ( )
inline

Returns the line attributes of the markup which will be inserted.

Returns
The LineAttributeKit which will be used for the next markup

◆ GetMarkupType()

MarkupType HPS::MarkupOperator::GetMarkupType ( )
inline

Returns the type of markup the operator will insert.

◆ GetName()

virtual HPS::UTF8 HPS::MarkupOperator::GetName ( ) const
inlineoverridevirtual

Returns the name of the operator.

Reimplemented from HPS::Operator.

◆ GetSegmentKey()

SegmentKey HPS::MarkupOperator::GetSegmentKey ( )
inline

Returns the top markup segment. This segment will not be valid before the operator is attached to the view, and after it is detached from the view.

Returns
The segment containing all the markups inserted by this operator

◆ GetTextAttributes()

TextAttributeKit HPS::MarkupOperator::GetTextAttributes ( )
inline

Changes the color of the markup which will be inserted.

Returns
The TextAttributeKit which will be used for the next markup

◆ IsMarkupActive()

bool HPS::MarkupOperator::IsMarkupActive ( )
inline

Whether a markup is currently being inserted.

Returns
true if a markup is being inserted, false otherwise.

◆ OnKeyDown()

virtual bool HPS::MarkupOperator::OnKeyDown ( KeyboardState const &  in_state)
overridevirtual

This function is called whenever HPS receives a KeyboardState event that signals a button was pressed. This function is used when to type markups of type Text from a desktop. To signal that you are done writing a note, press ESC.

Parameters
in_stateA KeyboardState object describing the current keyboard state.
Returns
true if the input event was handled, false otherwise.

Reimplemented from HPS::Operator.

◆ OnMouseDown()

virtual bool HPS::MarkupOperator::OnMouseDown ( MouseState const &  in_state)
overridevirtual

This function is called whenever HPS receives a MouseEvent that signals a mouse button was pressed. This function starts inserting markup. In the case of text markup, this function determines where the text will be inserted.

Parameters
in_stateA MouseState object describing the current mouse state.
Returns
true if the input event was handled, false otherwise.

Reimplemented from HPS::Operator.

◆ OnMouseMove()

virtual bool HPS::MarkupOperator::OnMouseMove ( MouseState const &  in_state)
overridevirtual

This function is called whenever HPS receives a MouseEvent that signals the mouse moved When the user is inserting freehand markup, this function continues the markup. When the user is inserting a circle, this function changes the circle's radius. When the user is inserting a rectangle, this function changes the rectangle's size.

Parameters
in_stateA MouseState object describing the current mouse state.
Returns
true if the input event was handled, false otherwise.

Reimplemented from HPS::Operator.

◆ OnMouseUp()

virtual bool HPS::MarkupOperator::OnMouseUp ( MouseState const &  in_state)
overridevirtual

This function is called whenever HPS receives a MouseEvent that signals a mouse button was released.

Parameters
in_stateA MouseState object describing the current mouse state.
Returns
true if the input event was handled, false otherwise.

Reimplemented from HPS::Operator.

◆ OnTextInput()

virtual bool HPS::MarkupOperator::OnTextInput ( HPS::UTF8 const &  in_text)
overridevirtual

This function is called whenever HPS receives a TextInput event that signals a text string was received. This function is used when to type markups of type Text from a mobile device. To signal that you are done writing a note, inject a HideKeyboardEvent.

Parameters
in_textThe text string received.
Returns
true if the input event was handled, false otherwise.

Reimplemented from HPS::Operator.

◆ OnTouchDown()

virtual bool HPS::MarkupOperator::OnTouchDown ( TouchState const &  in_state)
overridevirtual

This function is called whenever HPS receives a TouchEvent that signals the device was touched. This function starts inserting markup. In the case of text markup, this function determines where the text will be inserted.

Parameters
in_stateA TouchState object describing the current touch state.
Returns
true if the input event was handled, false otherwise.

Reimplemented from HPS::Operator.

◆ OnTouchMove()

virtual bool HPS::MarkupOperator::OnTouchMove ( TouchState const &  in_state)
overridevirtual

This function is called whenever HPS receives a TouchEvent that signals a point of contact has moved. When the user is inserting freehand markup, this function continues the markup. When the user is inserting a circle, this function changes the circle's radius. When the user is inserting a rectangle, this function changes the rectangle's size.

Parameters
in_stateA TouchState object describing the current touch state.
Returns
true if the input event was handled, false otherwise.

Reimplemented from HPS::Operator.

◆ OnTouchUp()

virtual bool HPS::MarkupOperator::OnTouchUp ( TouchState const &  in_state)
overridevirtual

This function is called whenever HPS receives a TouchEvent that signals a point of contact has been released.

Parameters
in_stateA TouchState object describing the current touch state.
Returns
true if the input event was handled, false otherwise.

Reimplemented from HPS::Operator.

◆ OnViewAttached()

virtual void HPS::MarkupOperator::OnViewAttached ( HPS::View const &  in_attached_view)
overridevirtual

This function is called whenever a view is attached to this operator.

Parameters
in_attached_viewThe view attached to this operator.

Reimplemented from HPS::Operator.

◆ OnViewDetached()

virtual void HPS::MarkupOperator::OnViewDetached ( HPS::View const &  in_detached_view)
overridevirtual

This function is called whenever a view is detached from this operator.

Parameters
in_detached_viewThe view detached from this operator.

Reimplemented from HPS::Operator.

◆ SetColor()

void HPS::MarkupOperator::SetColor ( RGBColor const &  in_color)
inline

Changes the color of the markup which will be inserted.

◆ SetLineAttribute()

void HPS::MarkupOperator::SetLineAttribute ( LineAttributeKit const &  in_line_attributes)
inline

Changes the color of the markup which will be inserted.

◆ SetMarkupType()

void HPS::MarkupOperator::SetMarkupType ( MarkupType  in_markup_type)
inline

Changes the type of markup the operator will insert.

◆ SetTextAttribute()

void HPS::MarkupOperator::SetTextAttribute ( TextAttributeKit const &  in_text_attributes)
inline

Returns the text attributes of the markup which will be inserted.


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