00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef CEYLAN_CONSOLE_H_
00028 #define CEYLAN_CONSOLE_H_
00029
00030
00031
00032 #include "CeylanTextDisplayable.h"
00033 #include "CeylanTypes.h"
00034 #include "CeylanSystem.h"
00035 #include "CeylanTextBuffer.h"
00036
00037
00038
00039
00040 namespace Ceylan
00041 {
00042
00043
00044
00045 namespace System
00046 {
00047
00048
00049
00050
00058 class CEYLAN_DLL Console : public Ceylan::TextDisplayable
00059 {
00060
00061
00062 public:
00063
00064
00065
00071 static const TextBuffer::CharAbscissa UnlimitedWidth = 0 ;
00072
00073
00074
00080 static const TextBuffer::CharOrdinate UnlimitedHeight = 0 ;
00081
00082
00083
00084
00089 class CEYLAN_DLL ConsoleException : public SystemException
00090 {
00091
00092 public:
00093
00094 explicit ConsoleException(
00095 const std::string & reason ) :
00096 SystemException( reason )
00097 {
00098
00099 }
00100
00101 } ;
00102
00103
00104
00105
00135 explicit Console( bool startInForeground = true ) ;
00136
00137
00138
00169 Console( TextBuffer::CharAbscissa startingX,
00170 TextBuffer::CharOrdinate startingY,
00171 TextBuffer::CharAbscissa width,
00172 TextBuffer::CharOrdinate height,
00173 TextBuffer::TextLayout layout,
00174 bool useBottomScreen = true,
00175 bool useSubCore = true,
00176 bool startInForeground = true ) ;
00177
00178
00179
00181 virtual ~Console() throw() ;
00182
00183
00184
00201 virtual void goInteractive() ;
00202
00203
00204
00206 virtual TextBuffer::TextLayout getTextLayout() const ;
00207
00208
00209
00219 virtual void setTextLayout( TextBuffer::TextLayout newLayout ) ;
00220
00221
00222
00223
00224
00225
00226
00235 virtual bool jumpNextText() ;
00236
00237
00238
00247 virtual bool jumpPreviousText() ;
00248
00249
00250
00259 virtual bool jumpNextLine() ;
00260
00261
00262
00271 virtual bool jumpPreviousLine() ;
00272
00273
00274
00285 virtual void addInBuffer( const std::string & text ) ;
00286
00287
00288
00295 virtual void blankBuffer() ;
00296
00297
00298
00299
00300
00301
00302
00303
00304
00318 virtual void setToForeground( bool toForeground = true ) ;
00319
00320
00321
00329 virtual void render() ;
00330
00331
00332
00345 virtual const std::string toString(
00346 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00347
00348
00349
00363 static void SetKeyRepeat(
00364 Millisecond durationBeforeFirstRepeat = 300,
00365 Millisecond durationBetweenRepeats = 100 ) ;
00366
00367
00368
00393 static void Initialize( bool useBottomScreen = true,
00394 bool useSubCore = true, bool force = false ) ;
00395
00396
00397
00408 struct BackgroundColor
00409 {
00410
00411 static const char * const Red ;
00412 static const char * const Green ;
00413 static const char * const Blue ;
00414 static const char * const Cyan ;
00415 static const char * const White ;
00416 static const char * const Yellow ;
00417 static const char * const Magenta ;
00418 static const char * const Grey ;
00419 static const char * const Black ;
00420 static const char * const Default ;
00421
00422 } ;
00423
00424
00425
00436 struct ForegroundColor
00437 {
00438
00439 static const char * const Red ;
00440 static const char * const Green ;
00441 static const char * const Blue ;
00442 static const char * const Cyan ;
00443 static const char * const White ;
00444 static const char * const Yellow ;
00445 static const char * const Magenta ;
00446 static const char * const Grey ;
00447 static const char * const Black ;
00448 static const char * const Default ;
00449
00450 } ;
00451
00452
00453
00454
00455
00456 static const char * const DefaultColors ;
00457
00458 static const char * const Bold ;
00459 static const char * const Faint ;
00460 static const char * const BoldAndFaintOff ;
00461
00462 static const char * const Underline ;
00463 static const char * const UnderlineOff;
00464
00465 static const char * const Blinking ;
00466 static const char * const BlinkingOff ;
00467
00468 static const char * const NegativeImage ;
00469 static const char * const NegativeImageOff ;
00470
00471 static const char * const InvisibleImage ;
00472 static const char * const InvisibleImageOff ;
00473
00474
00475
00476 protected:
00477
00478
00494 virtual void initConsole(
00495 TextBuffer::CharAbscissa startingX,
00496 TextBuffer::CharOrdinate startingY,
00497 TextBuffer::CharAbscissa width,
00498 TextBuffer::CharOrdinate height,
00499 TextBuffer::TextLayout layout,
00500 bool useBottomScreen = true,
00501 bool useSubCore = true ) ;
00502
00503
00504
00505 TextBuffer::CharAbscissa _xstart ;
00506
00507 TextBuffer::CharOrdinate _ystart ;
00508
00509
00510
00512 TextBuffer * _buffer ;
00513
00514
00515
00521 bool _inForeground ;
00522
00523
00525 bool _useBottomScreen ;
00526
00527
00529 bool _useSubCore ;
00530
00531
00532
00533
00534 private:
00535
00536
00545 Console( const Console & source ) ;
00546
00547
00556 Console & operator = ( const Console & source ) ;
00557
00558
00559 } ;
00560
00561
00562 }
00563
00564 }
00565
00566
00567
00568 #endif // CEYLAN_CONSOLE_H_
00569