consoleInput.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 1992-2011 VT MAK
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 
00008 
00009 #pragma once
00010 #include <vlutil/vlString.h>
00011 #include <deque>
00012 
00013 // Process command line input into a command.
00014 class DtCommandInput
00015 {
00016 public:
00017    DtCommandInput();
00018    ~DtCommandInput();
00019 
00023    virtual bool keyboardTick(char* command);
00024 
00026    virtual void forceInput();
00027 
00029    virtual void restoreCommand(int index);
00030 
00032    virtual void eraseLastCommand();
00033 
00035    virtual void printHistory(unsigned int start=0, unsigned int end=65535) const;
00036 
00037 protected:
00038 
00040    virtual bool processInput(unsigned int x, char* command);
00041 
00043    virtual int isEndOfLine(unsigned int x);
00044 
00046    virtual void append(char x);
00047 
00049    virtual void unAppend(void);
00050    
00052    virtual bool isEmpty() const;
00053 
00055    virtual void saveCommand();
00056 
00058    virtual void restorePreviousCommand();
00059 
00061    virtual void restoreNextCommand();
00062 
00064    virtual void clearCommand();
00065 
00066 protected:
00067 
00068    char myCommandLine[1024];
00069    std::deque<DtString>myPreviousCommands;
00070    int myMaxCommands;
00071    int myLastCommandIndex;
00072    char myClearLine[1024];
00073    bool myForceInput;
00074    bool myPromptOnScreen;
00075    bool mySurpressPrompt;
00076 };
00077 
00078 
00079 /* Keyboard values                                                      */
00080 /* These are the scan codes for the keyboard                            */
00081 
00082 #define NUM_OF_FKEYS 12
00083 
00084 /* Direction Keys, Insert, Delete, Backspace, and Control Return.  */
00085 #define HOME        0x4700
00086 #define END         0x4F00
00087 #define PGUP        0x4900
00088 #define PGDN        0x5100
00089 #define LEFT        0x4B00
00090 #define RIGHT       0x4D00
00091 #define UP          0x4800
00092 #define DOWN        0x5000
00093 #define INS         0x5200
00094 #define DEL         0x5300
00095 #define BACKSPACE   0x08
00096 #define NEW_LINE    0x0A
00097 #define C_RET       0x0D
00098 
00099 
00100 /* Escape Key  */
00101 #define ESCAPE      0x001B
00102 #define ESC         ESCAPE
00103 
00104 /* Control + Direction Key  */
00105 #define CTRL_LEFT   0x7300
00106 #define CTRL_RIGHT  0x7400
00107 #define CTRL_UP     0x8D00
00108 #define CTRL_DOWN   0x9100
00109 #define CTRL_HOME   0x7700
00110 #define CTRL_END    0x7500
00111 #define CTRL_PGUP   0x8400
00112 #define CTRL_PGDN   0x7600
00113 #define CTRL_INS    0x9200
00114 #define CTRL_DEL    0x9300
00115 
00116 /* Number Pad Numeric Operation Keys  */
00117 #define GRAYDIV   0x352F
00118 #define GRAYSTAR  0x3720
00119 #define GRAYMINUS 0x4A2D
00120 #define GRAYPLUS  0x4E2B
00121 
00122 /* Function Keys  */
00123 #define F1    0x3B00
00124 #define F2    0x3C00
00125 #define F3    0x3D00
00126 #define F4    0x3E00
00127 #define F5    0x3F00
00128 #define F6    0x4000
00129 #define F7    0x4100
00130 #define F8    0x4200
00131 #define F9    0x4300
00132 #define F10   0x4400
00133 #define F11   0x8500
00134 #define F12   0x8600
00135 
00136 /* Shift + Function Key  */
00137 #define SHIFTF1  0x5400
00138 #define SHIFTF2  0x5500
00139 #define SHIFTF3  0x5600
00140 #define SHIFTF4  0x5700
00141 #define SHIFTF5  0x5800
00142 #define SHIFTF6  0x5900
00143 #define SHIFTF7  0x5A00
00144 #define SHIFTF8  0x5B00
00145 #define SHIFTF9  0x5C00
00146 #define SHIFTF10 0x5D00
00147 
00148 /* Alt + Function Key  */
00149 #define ALTF1  0x6800
00150 #define ALTF2  0x6900
00151 #define ALTF3  0x6A00
00152 #define ALTF4  0x6B00
00153 #define ALTF5  0x6C00
00154 #define ALTF6  0x6D00
00155 #define ALTF7  0x6E00
00156 #define ALTF8  0x6F00
00157 #define ALTF9  0x7000
00158 #define ALTF10 0x7100
00159 
00160 /* Control + Function Key  */
00161 #define CTRLF1  0x5E00
00162 #define CTRLF2  0x5F00
00163 #define CTRLF3  0x6000
00164 #define CTRLF4  0x6100
00165 #define CTRLF5  0x6200
00166 #define CTRLF6  0x6300
00167 #define CTRLF7  0x6400
00168 #define CTRLF8  0x6500
00169 #define CTRLF9  0x6600
00170 #define CTRLF10 0x6700
00171 
00172 /* Alt + Numeric Key, "-", or "="  */
00173 #define ALT1 0x7800
00174 #define ALT2 0x7900
00175 #define ALT3 0x7A00
00176 #define ALT4 0x7B00
00177 #define ALT5 0x7C00
00178 #define ALT6 0x7D00
00179 #define ALT7 0x7E00
00180 #define ALT8 0x7F00
00181 #define ALT9 0x8000
00182 #define ALT0 0x8100
00183 #define ALT_MINUS 0x8200
00184 #define ALT_EQUALS 0x8300
00185 
00186 /* Alt + Alphabetic Key  */
00187 #define ALTQ 0x1000
00188 #define ALTW 0x1100
00189 #define ALTE 0x1200
00190 #define ALTR 0x1300
00191 #define ALTT 0x1400
00192 #define ALTY 0x1500
00193 #define ALTU 0x1600
00194 #define ALTI 0x1700
00195 #define ALTO 0x1800
00196 #define ALTP 0x1900
00197 
00198 #define ALTA 0x1E00
00199 #define ALTS 0x1F00
00200 #define ALTD 0x2000
00201 #define ALTF 0x2100
00202 #define ALTG 0x2200
00203 #define ALTH 0x2300
00204 #define ALTJ 0x2400
00205 #define ALTK 0x2500
00206 #define ALTL 0x2600
00207 
00208 #define ALTZ 0x2C00
00209 #define ALTX 0x2D00
00210 #define ALTC 0x2E00
00211 #define ALTV 0x2F00
00212 #define ALTB 0x3000
00213 #define ALTN 0x3100
00214 #define ALTM 0x3200
00215 
00216 /* Special Keys  */
00217 #define BACKTAB 0x0F00
00218 #define SYSRQ   0x7200
00219 #define BREAK   0x0000
00220 #define CTRLBACKSLASH 0x2B1C
00221 #define ENTER   0x1C0D
00222 #define CTRLENTER 0x1C0A
00223 
00224 /* Immediate Action Keys  */
00225 #define CTRL_D  0x0004
00226 #define CTRL_F  0x0006
00227 #define CTRL_R  0x0012
00228 #define CTRL_S  0x0013
00229 #define CTRL_U  0x0015
00230 #define CTRL_ENTER 0x000A

Document ID: Generated on Tue Oct 11 19:41:03 EDT 2011 from SVN revision 107422
Copyright © 2005-2011 VT MÄK Inc. All Rights Reserved (www.mak.com)