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

Curses.H

00001 /* $Id: Curses.H,v 1.1 2001/01/01 00:25:56 rpav Exp $
00002  *
00003  * SFW - Studio FrameWork
00004  * Copyright (C) 2000  Ryan Pavlik
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019  *
00020  */
00021 
00022 /*
00023  * Curses.H
00024  *
00025  */ 
00026 
00027 #ifndef SFW_CURSES_H
00028 #define SFW_CURSES_H
00029 
00030 #include <SFW/Object.H>
00031 
00032 typedef struct screen  SCREEN;
00033 typedef struct _win_st WINDOW;
00034 typedef struct panel   PANEL;
00035 typedef unsigned long  chtype;
00036 
00037 namespace SFW {
00038     namespace Curses {
00039         class Screen : public Object {
00040         public:
00041             TYPE_INFO(SFW::Curses::Screen, SFW::Object);
00042 
00043             /* From: curs_initscr */
00044             static void init();
00045             static void fini();
00046             static bool isfini();
00047 
00048             /* From: curs_refresh */
00049             static bool doupdate();
00050             static void refresh();
00051 
00052             /* From: curs_outopts */
00053             static void nl(bool = true);
00054 
00055             /* From: curs_kernel */
00056             static bool setCursor(int vis);
00057         };
00058 
00059         class Input : public Object {
00060         public:
00061             TYPE_INFO(SFW::Curses::Input, SFW::Object);
00062 
00063             static bool cbreak (bool = true);
00064             static bool echo   (bool = true);
00065             static bool raw    (bool = true);
00066             static void qiflush(bool = true);
00067 
00068             static bool intrflush(bool = true);
00069             static bool keypad   (bool = true);
00070             static bool meta     (bool = true);
00071             static bool nodelay  (bool = true);
00072 
00073             static void timeout  (int delay);
00074             static bool halfdelay(int delay);
00075 
00076             /* From: curs_getch */
00077             static int  getch  ();
00078             static bool ungetch(int ch);
00079             static bool hasKey (int ch);
00080 
00081             /* Properties */
00082         };
00083 
00084         struct Key {
00085             static const int
00086             Break, Down, Up, Left, Right, Home, Backspace,
00087                 F0, DL, IL, DC, IC, EIC, Clear, EOS, EOL, SF, SR,
00088                 NPage, PPage, STab, CTab, CATab, Enter, SReset, Reset,
00089 
00090                 LL, A1, A3, B2, C1, C3, BTab, Beg, Cancel, Close,
00091                 Command, Copy, Create, End, Exit, Find, Help, Mark,
00092                 Message, Mouse, Move, Next, Open, Options, Previous,
00093                 Redo, Reference, Refresh, Replace, Resize, Restart,
00094                 Resume, Save,
00095 
00096                 SBeg, SCancel, SCommand, SCopy, SCreate, SDC, SDL,
00097                 Select, SEnd, SEOL, SExit, SFind, SHelp, SHome, SIC,
00098                 SLeft, SMessage, SMove, SNext, SOptions, SPrevious,
00099                 SPrint, SRedo, SReplace, SRight, SResume, SSave,
00100                 SSuspend, SUndo, Suspend, Undo;
00101 
00102             static int F(int);
00103         };
00104 
00105         struct Attr {
00106             static const int
00107             Normal,     Standout, Underline,
00108                 Reverse,    Blink,    Dim,
00109                 Bold,       Protect,  Invis,
00110                 AltCharSet, CharText;
00111         };
00112 
00113         struct ColorPair;
00114         struct Color : public Object {
00115             TYPE_INFO(SFW::Curses::Color, SFW::Object);
00116 
00117             short id;
00118             short r, g, b;
00119 
00120             static bool init();
00121             static bool hasColors();
00122             static bool canChangeColor();
00123 
00124             static bool reg(Color c);
00125             static bool reg(ColorPair p);
00126 
00127             static Color get(short id);
00128 
00129             static const int Black,  Red,  Green,
00130                 Yellow, Blue, Magenta,
00131                 Cyan,   White;
00132     
00133         };
00134 
00135         struct ColorPair : public Object {
00136             TYPE_INFO(SFW::Curses::ColorPair, SFW::Object);
00137 
00138             short id;
00139             short fg, bg;
00140 
00141             static ColorPair get(short id);
00142         };
00143 
00144         class Window : public Object {
00145             WINDOW *win;
00146 
00147         public:
00148             TYPE_INFO(SFW::Curses::Window, SFW::Object);
00149 
00150             Window(int y, int x, int lines, int cols);
00151             ~Window();
00152 
00153             /* From: curs_addch */
00154             bool addch (chtype ch);
00155             bool addch (int y, int x, chtype ch);
00156             bool echoch(chtype ch);
00157 
00158             /* From: curs_addstr */
00159             bool addstr(const string &s);
00160             bool addstr(const string &s, int n);
00161             bool addstr(int y, int x, const string &s);
00162             bool addstr(int y, int x, const string &s, int n);
00163 
00164             /* From: curs_attr */
00165             bool attron (int attrs);
00166             bool attroff(int attrs);
00167             bool attrset(int attrs);
00168 
00169             /* From: curs_clear */
00170             bool erase();
00171             bool clear();
00172             bool clrtobot();
00173             bool clrtoeol();
00174 
00175             /* From: curs_refresh */
00176             bool refresh(bool out=true);
00177             bool redraw();
00178             bool redraw(int begLine, int numLines);
00179 
00180             /* From: curs_outopts */
00181             bool clearok  (bool);
00182             bool idlok    (bool);
00183             void idcok    (bool);
00184             void immedok  (bool);
00185             bool leaveok  (bool);
00186             bool setscrreg(int top, int bot);
00187             bool scrollok (bool);
00188 
00189             /* From: curs_window */
00190             bool move(int y, int x); /* mvwin */
00191 
00192             /* From: wresize */
00193             bool resize(int lines, int cols);
00194 
00195             /* From: curs_move */
00196             bool moveto(int y, int x); /* wmove */
00197         };
00198     }
00199 }
00200 
00201 #endif /* SFW_CURSES_H */

Generated at Tue Jan 2 15:38:33 2001 for SFW by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000