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

Last change on this file since 10305 was 10305, checked in by tbretz, 13 years ago
Use ReadlineColor for unified look and feel.
File size: 2.4 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 PrintGeneralHelp() { return ReadlineColor::PrintGeneralHelp(win, GetName()); }
60 bool PrintCommands() { return ReadlineColor::PrintCommands(win); }
61 bool PrintKeyBindings() { return ReadlineColor::PrintKeyBindings(win); }
62
63 bool Process(const std::string &str);
64
65 void Run(const char * = "")
66 {
67 ReadlineColor::PrintBootMsg(win, GetName());
68 Readline::Run();
69 }
70
71 WindowLog &GetStreamOut() { return wout; }
72 WindowLog &GetStreamIn() { return win; }
73 const WindowLog &GetStreamOut() const { return wout; }
74 const WindowLog &GetStreamIn() const { return win; }
75};
76
77#endif
Note: See TracBrowser for help on using the repository browser.