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

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