Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

NCursesFrontEnd Class Reference

Frontend using NCurses. More...

#include <ncursesFrontEnd.h>

Inherits FrontEnd.

List of all members.

Public Methods

 NCursesFrontEnd ()
 NCursesFrontEnd (int argc, char** argv)
 ~NCursesFrontEnd ()
void update ()
 Update function. More...

void displayUsers (int users)
 Display logged in Users. More...

void displayMatrices (int matrices)
 Display open matrices (OBSOLETE!!). More...

void displayDebugMessage (const char* msg)
 Display a debug message. More...


Private Attributes

WINDOW* debugMsg
char* clean
char* oldMsg [16]


Detailed Description

Frontend using NCurses.

Definition at line 9 of file ncursesFrontEnd.h.

00009 {
00010     public:
00011     NCursesFrontEnd ();
00012     NCursesFrontEnd (int argc, char** argv);
00013     ~NCursesFrontEnd ();
00014 
00015     void    update ();
00016 
00017     void    displayUsers (int users);   // amount of users logged in
00018     void    displayMatrices (int matrices); // amount of active matrices
00019 
00020     void    displayDebugMessage (const char* msg);
00021 
00022     private:
00023     WINDOW* debugMsg;
00024     char*   clean;
00025     char*   oldMsg[16];
00026 }

Constructor & Destructor Documentation

NCursesFrontEnd::NCursesFrontEnd ()

Definition at line 6 of file ncursesFrontEnd.cpp.

00006 {
00007 }

NCursesFrontEnd::NCursesFrontEnd ( int argc,
char ** argv)

Definition at line 9 of file ncursesFrontEnd.cpp.

00009 {
00010     initscr ();
00011     start_color ();
00012     cbreak ();
00013     noecho ();
00014     nonl ();
00015     intrflush (stdscr, FALSE);
00016     keypad (stdscr, TRUE);
00017     curs_set (0);
00018     
00019     init_pair (1, COLOR_WHITE, COLOR_BLUE);
00020     init_pair (2, COLOR_YELLOW, COLOR_BLUE);
00021     init_pair (3, COLOR_BLACK, COLOR_CYAN);
00022     
00023     attron (COLOR_PAIR(1));
00024     attron (A_BOLD);
00025     
00026     border (0,0,0,0,0,0,0,0);
00027     
00028     bkgd (COLOR_PAIR(1));
00029     
00030     attron (COLOR_PAIR(1));
00031     attron (A_BOLD);
00032     
00033     mvaddstr (2,2, "Users connected: ");
00034     mvaddstr (3,2, "Matrices open  : ");
00035     mvaddstr (4,2, "Debug message  : ");
00036 
00037     
00038     for (int i = 0; i < 16; i++) {
00039     oldMsg[i] = (char*) malloc (100);
00040     strcpy (oldMsg[i], " ");
00041     };
00042     
00043     refresh ();
00044 }

NCursesFrontEnd::~NCursesFrontEnd ()

Definition at line 46 of file ncursesFrontEnd.cpp.

00046 {
00047     curs_set (1);
00048     execl ("/usr/bin/reset","");
00049 }

Member Function Documentation

void NCursesFrontEnd::displayDebugMessage ( const char * msg) [virtual]

Display a debug message.

Parameters:
msg   the debug message

Reimplemented from FrontEnd.

Definition at line 81 of file ncursesFrontEnd.cpp.

00081 {
00082     attron (COLOR_PAIR (1));
00083     attron (A_BOLD);
00084     
00085     mvaddstr (4,2, "Debug message  : ");
00086     
00087     for (int i = 15; i > 0; i--) {
00088     strcpy (oldMsg[i], oldMsg[i - 1]);
00089     };
00090 
00091     strcpy (oldMsg[0], msg);
00092         
00093     attron (COLOR_PAIR (3));
00094     
00095     for (int i = 0; i < 16; i++) {
00096     mvaddstr (4 + i,19, clean);
00097     
00098     mvaddstr (4 + i,19, oldMsg[i]);
00099     };
00100     
00101     refresh ();
00102 }

void NCursesFrontEnd::displayMatrices ( int matrices) [virtual]

Display open matrices (OBSOLETE!!).

Parameters:
matrices   number of open matrices

Reimplemented from FrontEnd.

Definition at line 68 of file ncursesFrontEnd.cpp.

00068 {
00069     attron (COLOR_PAIR(1));
00070     attron (A_BOLD);
00071     
00072     mvaddstr (3,2, "Matrices open  :           ");
00073     
00074     attron (COLOR_PAIR(2));
00075     
00076     mvaddch (3,19, (char)(48 + matrices));
00077 
00078     refresh ();
00079 }

void NCursesFrontEnd::displayUsers ( int users) [virtual]

Display logged in Users.

Parameters:
users   number of users to be displayed

Reimplemented from FrontEnd.

Definition at line 55 of file ncursesFrontEnd.cpp.

00055 {
00056     attron (COLOR_PAIR(1));
00057     attron (A_BOLD);
00058     
00059     mvaddstr (2,2, "Users connected:           ");
00060     
00061     attron (COLOR_PAIR(2));
00062     
00063     mvaddch (2,19, (char)(48 + users));
00064     
00065     refresh ();
00066 }

void NCursesFrontEnd::update () [virtual]

Update function.

Reimplemented from FrontEnd.

Definition at line 51 of file ncursesFrontEnd.cpp.

00051 {
00052     refresh ();
00053 }

Member Data Documentation

char * NCursesFrontEnd::clean [private]

Definition at line 24 of file ncursesFrontEnd.h.

WINDOW * NCursesFrontEnd::debugMsg [private]

Definition at line 23 of file ncursesFrontEnd.h.

char * NCursesFrontEnd::oldMsg[16] [private]

Definition at line 25 of file ncursesFrontEnd.h.


The documentation for this class was generated from the following files:
Generated at Sat May 13 13:50:25 2000 for 3Dsia by doxygen 1.1.2 written by Dimitri van Heesch, © 1997-2000