HoverRace  2.0
Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
HoverRace::Client::TextEditScene Class Reference

Edit a line of text. More...

#include <TextEditScene.h>

+ Inheritance diagram for HoverRace::Client::TextEditScene:

Public Types

using confirmSignal_t = boost::signals2::signal< void(const std::string &)>
 
- Public Types inherited from HoverRace::Client::Scene
enum  Phase {
  Phase::INITIALIZING, Phase::STARTING, Phase::RUNNING, Phase::STOPPING,
  Phase::STOPPED
}
 
enum  State {
  State::INITIALIZING, State::BACKGROUND, State::RAISING, State::FOREGROUND,
  State::LOWERING
}
 

Public Member Functions

 TextEditScene (Display::Display &display, GameDirector &director, const std::string &parentTitle, const std::string &title, size_t maxLength, const std::string &text={})
 Constructor. More...
 
virtual ~TextEditScene ()
 
void Advance (Util::OS::timestamp_t tick) override
 
void AttachController (Control::InputEventController &controller, ConnList &conns) override
 Configure the controller mappings. More...
 
void DetachController (Control::InputEventController &controller, ConnList &conns) override
 Remove the controller mappings. More...
 
confirmSignal_tGetConfirmSignal ()
 
size_t GetMaxLength () const
 
const std::string & GetText () const
 
void PrepareRender () override
 
void SetHint (const std::string &text)
 Set instructions to display to the user. More...
 
- Public Member Functions inherited from HoverRace::Client::DialogScene
 DialogScene (Display::Display &display, GameDirector &director, const std::string &parentTitle, const std::string &title, const std::string &name)
 Constructor. More...
 
 DialogScene (Display::Display &display, GameDirector &director, const std::string &title="", const std::string &name="")
 
virtual ~DialogScene ()
 
void OnPhaseTransition (double progress) override
 Fired during the starting and stopping phases, if SetPhaseTransitionDuration() was set. More...
 
void Render () override
 
- Public Member Functions inherited from HoverRace::Client::FormScene
 FormScene (Display::Display &display, const std::string &name="")
 
virtual ~FormScene ()
 
void Render () override
 
- Public Member Functions inherited from HoverRace::Client::UiScene
 UiScene (const std::string &name="")
 
virtual ~UiScene ()
 
void AttachController (Control::InputEventController &controller, ConnList &conns) override
 Configure the controller mappings. More...
 
void DetachController (Control::InputEventController &, ConnList &) override
 Remove the controller mappings. More...
 
bool IsMouseCursorEnabled () const override
 Determine if the mouse cursor is enabled for this scene. More...
 
void PrepareRender () override
 
void Render () override
 
- Public Member Functions inherited from HoverRace::Client::Scene
 Scene (const std::string &name="Unnamed Scene")
 Constructor. More...
 
virtual ~Scene ()
 
void AdvanceScene (Util::OS::timestamp_t tick)
 
void AttachInput (Control::InputEventController &controller)
 Attach the user input to the scene. More...
 
void DetachInput (Control::InputEventController &controller)
 Detach the user input from the scene. More...
 
const std::string & GetName () const
 Retrieve the name of the scene. More...
 
Phase GetPhase () const
 
State GetState () const
 
bool MoveToBackground ()
 Signal that the scene is moving into the background. More...
 
bool MoveToForeground ()
 Signal that the scene is moving into the foreground. More...
 
virtual void OnScenePushed ()
 Called when the scene is actually pushed to the stage. More...
 
Sceneoperator= (const Scene &)=delete
 
virtual std::ostream & OutputDebugText (std::ostream &oss) const
 Output a stream of debug information describing this scene. More...
 
void PrepareScene ()
 
void RenderScene ()
 
bool SetPhase (Phase phase)
 Switch to another phase. More...
 

Protected Member Functions

void OnOk () override
 Called when the "OK" action is fired. More...
 
- Protected Member Functions inherited from HoverRace::Client::DialogScene
Display::ContainerGetContentRoot () const
 
const std::string & GetFullTitle () const
 Retrieve the full combined title (including parent title). More...
 
Display::ContainerGetStatusRoot () const
 
const std::string & GetTitle () const
 
virtual void OnCancel ()
 Called when the "Cancel" action is fired. More...
 
virtual void OnExtra ()
 Called when the scene-specific extra action is fired. More...
 
void SetBackground (Display::Background *fader)
 Set the background, replacing the currently set background. More...
 
void SetStoppingTransitionEnabled (bool enabled)
 Enable or disable content visibility while scene is stopping. More...
 
void SupportCancelAction (const std::string &label="")
 Enable the "Cancel" action for this scene. More...
 
void SupportExtraAction (const std::string &label)
 Enable the "extra" action for this scene. More...
 
void SupportOkAction (const std::string &label="")
 Enable the "OK" action for this scene. More...
 
- Protected Member Functions inherited from HoverRace::Client::FormScene
Display::ContainerGetRoot () const
 
- Protected Member Functions inherited from HoverRace::Client::UiScene
virtual void Layout ()
 Adjust the size and position of any child elements. More...
 
void RequestLayout ()
 Indicate that the current layout is out-of-date and needs to be adjusted. More...
 
void SetFocusRoot (std::shared_ptr< Display::UiViewModel > root)
 Set the widget used as the root for all focus management. More...
 
- Protected Member Functions inherited from HoverRace::Client::Scene
Util::OS::timestamp_t GetPhaseDuration (Util::OS::timestamp_t curTime=Util::OS::Time())
 Calculate how much time we've spent in the current phase. More...
 
Util::OS::timestamp_t GetStartingPhaseTime ()
 Return how long the starting phase lasted. More...
 
Util::OS::timestamp_t GetStateDuration (Util::OS::timestamp_t curTime=Util::OS::Time())
 Calculate how much time we've spent in the current state. More...
 
virtual void OnPhaseChanged (Phase oldPhase)
 Fired immediately after entering a new phase. More...
 
virtual void OnStateChanged (State oldState)
 Fired immediately after entering a new state. More...
 
virtual void OnStateTransition (double progress)
 Fired during the raising and lowering states, if SetStateTransitionDuration() was set. More...
 
void SetPhaseTransitionDuration (Util::OS::timestamp_t ms)
 Set the maximum duration of the starting or stopping phases. More...
 
void SetStateTransitionDuration (Util::OS::timestamp_t ms)
 Set the maximum duration of the raising or lowering state. More...
 

Private Types

using SUPER = DialogScene
 

Private Member Functions

void OnTextControl (Control::TextControl::key_t key)
 
void OnTextInput (const std::string &s)
 

Private Attributes

confirmSignal_t confirmSignal
 
bool cursorOn
 
Util::OS::timestamp_t cursorTick
 
std::shared_ptr< Display::LabelhintLbl
 
std::shared_ptr< Display::ActiveTextinputLbl
 
size_t maxLength
 
std::string text
 

Additional Inherited Members

- Static Public Attributes inherited from HoverRace::Client::DialogScene
static constexpr double MARGIN_WIDTH = 40
 
- Static Protected Member Functions inherited from HoverRace::Client::DialogScene
static std::string JoinTitles (const std::string &parent, const std::string &title)
 Combine a parent dialog title to the child dialog title. More...
 
- Protected Attributes inherited from HoverRace::Client::DialogScene
GameDirectordirector
 
- Protected Attributes inherited from HoverRace::Client::FormScene
Display::Displaydisplay
 
- Protected Attributes inherited from HoverRace::Client::Scene
std::shared_ptr< Util::ProfileradvanceProfiler
 
std::shared_ptr< Util::ProfilerprepareProfiler
 
std::shared_ptr< Util::ProfilerrenderProfiler
 
std::shared_ptr< Util::ProfilerrootProfiler
 

Detailed Description

Edit a line of text.

Author
Michael Imamura

Member Typedef Documentation

using HoverRace::Client::TextEditScene::confirmSignal_t = boost::signals2::signal<void(const std::string&)>

Constructor & Destructor Documentation

HoverRace::Client::TextEditScene::TextEditScene ( Display::Display display,
GameDirector director,
const std::string &  parentTitle,
const std::string &  title,
size_t  maxLength,
const std::string &  text = {} 
)

Constructor.

Parameters
displayThe target display.
directorThe current director.
parentTitleThe title of the parent dialog (may be blank).
titleDialog title.
maxLengthMaximum text length, in code points.
textOptional initial text.
virtual HoverRace::Client::TextEditScene::~TextEditScene ( )
inlinevirtual

Member Function Documentation

void HoverRace::Client::TextEditScene::Advance ( Util::OS::timestamp_t  tick)
overridevirtual

Reimplemented from HoverRace::Client::Scene.

void HoverRace::Client::TextEditScene::AttachController ( Control::InputEventController controller,
ConnList conns 
)
overridevirtual

Configure the controller mappings.

This is called whenever the scene becomes the foreground scene or the controller config needs to be rebuilt.

Parameters
controllerThe current controller being used. It can be assumed that the controller's action mappings have been cleared.
connsThe list to manage connections while the input is attached. Any connections added to this list will be automatically disconnected when then the input is detached.

Reimplemented from HoverRace::Client::DialogScene.

void HoverRace::Client::TextEditScene::DetachController ( Control::InputEventController controller,
ConnList conns 
)
overridevirtual

Remove the controller mappings.

Parameters
controllerThe current controller being used. It can be assumed that the controller's action mappings have been cleared.
connsThe same connection list passed to AttachController.

Reimplemented from HoverRace::Client::DialogScene.

confirmSignal_t& HoverRace::Client::TextEditScene::GetConfirmSignal ( )
inline
size_t HoverRace::Client::TextEditScene::GetMaxLength ( ) const
inline
const std::string& HoverRace::Client::TextEditScene::GetText ( ) const
inline
void HoverRace::Client::TextEditScene::OnOk ( )
overrideprotectedvirtual

Called when the "OK" action is fired.

Reimplemented from HoverRace::Client::DialogScene.

void HoverRace::Client::TextEditScene::OnTextControl ( Control::TextControl::key_t  key)
private
void HoverRace::Client::TextEditScene::OnTextInput ( const std::string &  s)
private
void HoverRace::Client::TextEditScene::PrepareRender ( )
overridevirtual

Reimplemented from HoverRace::Client::DialogScene.

void HoverRace::Client::TextEditScene::SetHint ( const std::string &  text)

Set instructions to display to the user.

Parameters
textThe instruction text to accompany the input box.

Member Data Documentation

confirmSignal_t HoverRace::Client::TextEditScene::confirmSignal
private
bool HoverRace::Client::TextEditScene::cursorOn
private
Util::OS::timestamp_t HoverRace::Client::TextEditScene::cursorTick
private
std::shared_ptr<Display::Label> HoverRace::Client::TextEditScene::hintLbl
private
std::shared_ptr<Display::ActiveText> HoverRace::Client::TextEditScene::inputLbl
private
size_t HoverRace::Client::TextEditScene::maxLength
private
std::string HoverRace::Client::TextEditScene::text
private

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