1 /* 2 * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef TERMINAL_BUFFER_H 6 #define TERMINAL_BUFFER_H 7 8 #include <Locker.h> 9 #include <Messenger.h> 10 11 #include "BasicTerminalBuffer.h" 12 13 14 class TerminalBuffer : public BasicTerminalBuffer, public BLocker { 15 public: 16 TerminalBuffer(); 17 virtual ~TerminalBuffer(); 18 19 status_t Init(int32 width, int32 height, 20 int32 historySize); 21 22 void SetListener(BMessenger listener); 23 void UnsetListener(); 24 25 int Encoding() const; 26 void SetEncoding(int encoding); 27 28 void SetTitle(const char* title); 29 void NotifyQuit(int32 reason); 30 31 virtual status_t ResizeTo(int32 width, int32 height); 32 virtual status_t ResizeTo(int32 width, int32 height, 33 int32 historyCapacity); 34 35 void UseAlternateScreenBuffer(bool clear); 36 void UseNormalScreenBuffer(); 37 38 void ReportX10MouseEvent(bool report); 39 void ReportNormalMouseEvent(bool report); 40 void ReportButtonMouseEvent(bool report); 41 void ReportAnyMouseEvent(bool report); 42 43 protected: 44 virtual void NotifyListener(); 45 46 private: 47 void _SwitchScreenBuffer(); 48 49 private: 50 int fEncoding; 51 52 TerminalLine** fAlternateScreen; 53 HistoryBuffer* fAlternateHistory; 54 int32 fAlternateScreenOffset; 55 56 // listener/dirty region management 57 BMessenger fListener; 58 bool fListenerValid; 59 }; 60 61 62 #endif // TERMINAL_BUFFER_H 63