source: trunk/FACT++/src/Shell.h@ 18052

Last change on this file since 18052 was 14085, checked in by tbretz, 12 years ago
Added Lock/Unlock template
File size: 2.3 KB
Line 
1#ifndef FACT_Shell
2#define FACT_Shell
3
4#include "ReadlineWindow.h"
5#include "ReadlineColor.h"
6#include "WindowLog.h"
7
8class WindowLog;
9
10typedef struct panel PANEL;
11
12class Shell : public ReadlineWindow
13{
14protected:
15 static Shell *This; /// pointer to our glocal object to get the static member functions into scope
16
17 WindowLog win;//(&fPanelIn); // FIXME: Ref
18 WindowLog wout;//(&fPanelOut); // FIXME: Ref
19
20private:
21 PANEL *fPanelIn; /// Pointer to the panel for the input stream
22 PANEL *fPanelFrame; /// Pointer to the panel for the frame around the output
23 PANEL *fPanelOut; /// Pointer to the panel for the output stream
24
25 int fPanelHeight; /// Space between the bottom of the screen and the output panel
26 int fIsVisible; /// Flag whether the output panel is visible or not (for toggle operations)
27
28 int fLine;
29
30 // Callback function for key presses
31 static int rl_proc_F1(int cnt, int key);
32 static int rl_scroll_top(int cnt, int key);
33 static int rl_scroll_bot(int cnt, int key);
34 static int rl_top_inc(int cnt, int key);
35 static int rl_top_dec(int cnt, int key);
36 static int rl_top_resize(int cnt, int key);
37
38 /// Static member function used as callback for a signal which is
39 /// emitted by the system if the size of the console window has changed
40 static void HandleResizeImp(int dummy);
41
42 /// Non static member function called by HandleResize
43 void HandleResize();
44
45 /// Helper for the constructor and window resizing to create the windows and panels
46 void CreateWindows(WINDOW *w[3], int all=true);
47
48 // Action after readline finished
49 void Shutdown(const char *);
50
51public:
52 Shell(const char *prgname);
53 ~Shell();
54
55 bool Resize(int h);
56 void ShowHide(int v);
57 void Refresh() { ShowHide(-2); }
58
59 bool PrintCommands() { return ReadlineColor::PrintCommands(win); }
60 bool PrintGeneralHelp();
61 bool PrintKeyBindings();
62
63 bool Process(const std::string &str);
64
65 void Lock() { }
66 void Run(const char * = "")
67 {
68 ReadlineColor::PrintBootMsg(win, GetName());
69 ReadlineWindow::Run();
70 }
71 void Unlock() { }
72
73 WindowLog &GetStreamOut() { return wout; }
74 WindowLog &GetStreamIn() { return win; }
75 const WindowLog &GetStreamOut() const { return wout; }
76 const WindowLog &GetStreamIn() const { return win; }
77};
78
79#endif
Note: See TracBrowser for help on using the repository browser.