Envision
A visual programming IDE for object-oriented languages
List of all members | Public Types | Static Public Member Functions | Private Types | Static Private Member Functions | Static Private Attributes
Interaction::Prompt Class Reference

Public Types

enum  PromptOption { None = 0 , CenterViewOnPrompt = 0x00000001 , InputHasHint = 0x00000002 , AutoHint = 0x00000004 }
 
using PromptOptions = QFlags< PromptOption >
 
using PromptShowCall = std::function< void(Visualization::Item *)>
 

Static Public Member Functions

static Visualization::ItemcommandReceiver ()
 
static const std::unique_ptr< Visualization::Cursor > & commandReceiverCursor ()
 
static QPoint commandReceiverCursorPosition ()
 
static const QString & defaultModeName ()
 
static void hide ()
 
static bool isVisible ()
 
static PromptModemode ()
 
template<typename ModeType >
static void registerMode (const QString &modeName)
 
static void registerPromptShowShortcut (Qt::Key key, PromptShowCall showFunction)
 
static qreal scale ()
 
static PromptShellshell ()
 
static void show (const QString &modeName, Visualization::Item *commandReceiver, QString initialCommandText={}, PromptOptions options=AutoHint)
 
static void show (Visualization::Item *commandReceiver, QString initialCommandText={}, PromptOptions options=AutoHint)
 
static PromptShowCall showShortcut (Qt::Key key)
 
static bool toggleScale (Visualization::Item *target, QKeySequence keySequence, ActionRegistry::InputState inputState)
 

Private Types

using ModeConstructor = std::function< PromptMode *()>
 

Static Private Member Functions

static QMap< QString, ModeConstructor > & modeRegistry ()
 
static QMap< Qt::Key, PromptShowCall > & promptShowShortcuts ()
 

Static Private Attributes

static Visualization::ItemcommandReceiver_ {}
 
static std::unique_ptr< Visualization::CursorcommandReceiverCursor_ {}
 
static PromptModemode_ {}
 
static qreal scale_ {1.0}
 
static PromptShellshell_ {}
 

Member Typedef Documentation

◆ ModeConstructor

using Interaction::Prompt::ModeConstructor = std::function<PromptMode* ()>
private

◆ PromptOptions

◆ PromptShowCall

Member Enumeration Documentation

◆ PromptOption

Enumerator
None 
CenterViewOnPrompt 

If set, the view will be scrolled so that the prompt is in the center.

InputHasHint 

If set, the entire input will be selected, allowing the user to replace it with a single keypress.

This is useful if the input is a hint message.

AutoHint 

If set, the hint option is automatically assumed if the initial text is not empty.

Member Function Documentation

◆ commandReceiver()

Visualization::Item * Interaction::Prompt::commandReceiver ( )
inlinestatic

◆ commandReceiverCursor()

const std::unique_ptr< Visualization::Cursor > & Interaction::Prompt::commandReceiverCursor ( )
inlinestatic

◆ commandReceiverCursorPosition()

QPoint Interaction::Prompt::commandReceiverCursorPosition ( )
inlinestatic

◆ defaultModeName()

const QString & Interaction::Prompt::defaultModeName ( )
static

◆ hide()

void Interaction::Prompt::hide ( )
static

◆ isVisible()

bool Interaction::Prompt::isVisible ( )
inlinestatic

◆ mode()

PromptMode * Interaction::Prompt::mode ( )
inlinestatic

◆ modeRegistry()

QMap< QString, Prompt::ModeConstructor > & Interaction::Prompt::modeRegistry ( )
staticprivate

◆ promptShowShortcuts()

QMap< Qt::Key, Prompt::PromptShowCall > & Interaction::Prompt::promptShowShortcuts ( )
staticprivate

◆ registerMode()

template<typename ModeType >
void Interaction::Prompt::registerMode ( const QString &  modeName)
inlinestatic

◆ registerPromptShowShortcut()

void Interaction::Prompt::registerPromptShowShortcut ( Qt::Key  key,
PromptShowCall  showFunction 
)
static

◆ scale()

qreal Interaction::Prompt::scale ( )
inlinestatic

◆ shell()

PromptShell * Interaction::Prompt::shell ( )
inlinestatic

◆ show() [1/2]

void Interaction::Prompt::show ( const QString &  modeName,
Visualization::Item commandReceiver,
QString  initialCommandText = {},
PromptOptions  options = AutoHint 
)
static

◆ show() [2/2]

void Interaction::Prompt::show ( Visualization::Item commandReceiver,
QString  initialCommandText = {},
PromptOptions  options = AutoHint 
)
static

◆ showShortcut()

Prompt::PromptShowCall Interaction::Prompt::showShortcut ( Qt::Key  key)
static

◆ toggleScale()

bool Interaction::Prompt::toggleScale ( Visualization::Item target,
QKeySequence  keySequence,
ActionRegistry::InputState  inputState 
)
static

Member Data Documentation

◆ commandReceiver_

Visualization::Item * Interaction::Prompt::commandReceiver_ {}
staticprivate

◆ commandReceiverCursor_

std::unique_ptr< Visualization::Cursor > Interaction::Prompt::commandReceiverCursor_ {}
staticprivate

◆ mode_

PromptMode * Interaction::Prompt::mode_ {}
staticprivate

◆ scale_

qreal Interaction::Prompt::scale_ {1.0}
staticprivate

◆ shell_

PromptShell * Interaction::Prompt::shell_ {}
staticprivate