cursesinterface.h

Go to the documentation of this file.
00001 #ifndef cursesinterface_h_included
00002 #define cursesinterface_h_included
00003 
00004 //
00005 // Copyright 2002, Lowell Boggs Jr.
00006 //
00007 // This file or directory, containing source code for a computer program,
00008 // is Copyrighted by Lowell Boggs, Jr.  987 Regency Drive, Lewisville
00009 // TX (USA), 75067.  You may use, copy, modify, and distribute this
00010 // source file without charge or obligation so long as you agree to
00011 // the following:
00012 //
00013 //  1.  You must indemnify Lowell Boggs against any and all financial
00014 //      obligations caused by its use, misuse, function, or malfunction.
00015 //      Further, you acknowledge that there is no warranty of any kind,
00016 //      whatsoever.
00017 //
00018 //  2.  You agree not to attempt to patent any portion of this original
00019 //      work -- though you may attempt to patent your own extensions to
00020 //      it if you so choose.
00021 //
00022 //  3.  You keep this copyright notice with the file and all copies
00023 //      of the file and do not change it anyway except language translation.
00024 //
00025 // You are responsible for enforcing your own compliance with these
00026 // conditions and may not use this source file if you cannot agree to the
00027 // above terms and conditions.
00028 
00029 
00033 
00034 #include <cxxtls/file.h>
00035 
00036 namespace cxxtls
00039 {
00040 
00041 class CursorWindow;
00042 
00043 namespace CursesInterface
00048 {
00049   void make_xterm_terminfo_file(FileName const &dir);
00050   void openCursesTerminal();
00051   void closeCursesTerminal();
00052   void getCursesCursor(int *row, int *col);
00053   void getCursesScreenSize(int *row, int *col);
00054   void setCursesAttributes( int a );
00055   void paintCharString(char const *r, int count, int a, int row, int col);
00056   void paintCharString(long c, int count, int a, int row, int col);
00057   void refreshCursesWindow();
00058   void beepCursesTerminal();
00059   void moveCursesCursor(int row, int col);
00060   void make_xterm_terminfo_file(FileName const &dir);
00061 
00062   extern bool winch_occurred;
00063   extern bool resize_requested;
00064 
00065   int read_mapped_key(CursorWindow&);  
00066 
00067   enum special_keys            
00068   {
00069     MouseEvent = 0x8000000,    
00070     ResizeEvent= -1            
00071   };
00072 
00073   enum mouse_down_bits                 // names for the buttons 
00074   {
00075     left =1,
00076     right=2,
00077     middle=4
00078   };
00079 
00080   struct mouse_info
00083   {
00084     // upper left corner is 0,0
00085 
00086     mouse_info(int row, int col, int mouseDownBitMask)
00087     :  row_(row),
00088        col_(col),
00089        state_(mouseDownBitMask)
00090     {
00091     }
00092 
00093     int row_;    //<  0 based row where mouse event occurred
00094     int col_;    //<  0 based column where mouse event occurred
00095     int state_;  //<  an or'ing of left, middle, and right -- implying those buttons are down
00096   };
00097 
00098   mouse_info read_mouse_info(); // only valid after read_mapped_key returns MouseUp
00099 
00100   enum line_drawing_characters   
00102   {
00103     UL_CORNER,   
00104     LL_CORNER,   
00105     UR_CORNER,   
00106     LR_CORNER,   
00107     HL_MIDDLE,   
00108     VL_MIDDLE,   
00109     PL_BOX   ,   
00110     TE_LEFT  ,   
00111     TE_RIGHT ,   
00112     TE_BOTTOM,   
00113     TE_TOP   ,   
00114 
00115     lcCOUNT // must be LAST!
00116   };
00117 
00118   extern long line_chars[lcCOUNT]; 
00119 
00120 };
00121 
00122 } // namespace cxxtls
00123 #endif
Generated on Wed Feb 29 22:50:03 2012 for CXXUtilities by  doxygen 1.6.3