Itasca C++ Interface
Loading...
Searching...
No Matches
ikernelinput.h
1#pragma once
2
3#include "shared/interface/signal.h"
4
5namespace itasca {
6 class IGUIInput;
7 class ITextInput;
8
18 public:
19 enum class Key { None=0, Escape = 0x01000000, Tab, Backtab, Backspace, Return, Enter, Insert, Delete,
20 Pause, Print, SysReq, Clear, Home=0x01000010, End, Left, Up, Right, Down,
21 PageUp, PageDown, Shift=0x01000020, Control, Meta, Alt, F1=0x01000030,
22 F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, Z=0x5a, Space=0x20 };
23 enum class KeyModifier { None=0x0, Shift=0x2000000, Control=0x4000000, Alt=0x8000000,
24 Meta=0x10000000 };
25 struct KeyInfo {
26 Key key_ = Key::None;
27 KeyModifier mod_ = KeyModifier::None;
28 char char_ = '\0';
29 };
30 using UndoConnect = std::tuple<shared::Signal<bool> *, shared::Signal<bool, double> *>;
31
34
35 // Kernel specific more detailed input
37 virtual KeyInfo getKey()=0;
44 virtual uint32 prompt(const string &message,const string &options,const string &keys,uint32 ok,uint32 cancel)=0;
46 virtual string getUIName() const=0;
48 virtual bool autoTestMode() const=0;
50 virtual string getHelpFileFrontPage() const=0;
52 virtual string getDocDirectory() const=0;
53
54 // Interrupt functions
56 virtual void poll(bool suppressException=false,bool skipTimingTest=false)=0;
59 virtual bool hasBeenInterrupted()=0;
62 virtual bool hasBeenSafeInterrupted()=0;
63
66 virtual IGUIInput *getIGUIInput()=0;
67
68 // Undo support
71 virtual UndoConnect getUndoConnect() = 0;
73 //virtual bool getUndoStartMark()=0;
74
76 virtual string getProjectPath() const = 0;
77
78 //virtual bool acceptRedirect() const=0;
79 //virtual void setRedirectInput(IKernelInput * ki)=0;
80 };
81
82 inline IKernelInput::KeyModifier operator&(IKernelInput::KeyModifier m1,IKernelInput::KeyModifier m2) {
83 return to<IKernelInput::KeyModifier>(to<uint32>(m1) & to<uint32>(m2));
84 }
85} // /namespace itasca
86// EOF
The interface to graphics user interface input functionality.
Definition iguiinput.h:8
Interface describing ALL input support the kernel needs to receive from whatever interface is driving...
Definition ikernelinput.h:17
virtual uint32 prompt(const string &message, const string &options, const string &keys, uint32 ok, uint32 cancel)=0
virtual KeyInfo getKey()=0
Returns a key. This function blocks, and it may throw a 'quit' exception.
virtual bool hasBeenSafeInterrupted()=0
virtual string getUIName() const =0
Returns the name of the UI input device, e.g. "FLAC3D Console". This functions does not throw excepti...
virtual bool autoTestMode() const =0
Returns true if system is in test mode. This functions does not throw exceptions.
virtual ITextInput * getITextInput()=0
Returns a pointer to ITextInput, the standard default text input.
virtual string getProjectPath() const =0
Returns TRUE if the last string input from ITextInput::getInput() was marked as the start of an undo ...
virtual UndoConnect getUndoConnect()=0
virtual void poll(bool suppressException=false, bool skipTimingTest=false)=0
Allows GUI to interrupt if necessary. Quit exception if suppressExeption is false.
virtual string getHelpFileFrontPage() const =0
Returns the name of the front page of the help file.
virtual IGUIInput * getIGUIInput()=0
virtual bool hasBeenInterrupted()=0
virtual string getDocDirectory() const =0
Returns the name of the directory of the doc files which could be code dependent.
Definition itextinput.h:41
namespace Itasca
Definition basememory.cpp:14
Definition ikernelinput.h:25