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

Input.C

00001 /* $Id: Input.C,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  * Input.C
00024  *
00025  * Input class implementation, Key properties
00026  *
00027  */ 
00028 
00029 #include <SFW/Curses/Curses.H>
00030 #include <ncurses.h>
00031 #include <SFW/Curses/CursesUndefs.H>
00032 
00033 TYPE_INIT(SFW::Curses::Input);
00034 
00035 using namespace SFW;
00036 using namespace SFW::Curses;
00037 
00038 /****
00039  **** Input
00040  ****
00041  ***/
00042 
00043 bool Input::cbreak(bool _b) {
00044     if(_b)
00045         return (::cbreak()   == OK);
00046     else
00047         return (nocbreak() == OK);
00048 }
00049 
00050 bool Input::echo(bool _b) {
00051     if(_b)
00052         return (::echo()   == OK);
00053     else
00054         return (noecho() == OK);
00055 }
00056 
00057 bool Input::raw(bool _b) {
00058     if(_b)
00059         return (::raw()   == OK);
00060     else
00061         return (noraw() == OK);
00062 }
00063 
00064 void Input::qiflush(bool _b) {
00065     if(_b)
00066         ::qiflush();
00067     else
00068         noqiflush();
00069 }
00070 
00071 bool Input::intrflush(bool _b) {
00072     return (::intrflush(stdscr, _b ? TRUE : FALSE) == OK);
00073 }
00074 
00075 bool Input::keypad(bool _b) {
00076     return (::keypad(stdscr, _b ? TRUE : FALSE) == OK);
00077 }
00078 
00079 bool Input::meta(bool _b) {
00080     return (::meta(stdscr, _b ? TRUE : FALSE) == OK);
00081 }
00082 
00083 bool Input::nodelay(bool _b) {
00084     return (::nodelay(stdscr, _b ? TRUE : FALSE) == OK);
00085 }
00086 
00087 void Input::timeout(int _delay) {
00088     wtimeout(stdscr, _delay);
00089 }
00090 
00091 bool Input::halfdelay(int _delay) {
00092     return (halfdelay(_delay) == OK);
00093 }
00094 
00095 int Input::getch() {
00096     return wgetch(stdscr);
00097 }
00098 
00099 bool Input::ungetch(int _ch) {
00100     return (::ungetch(_ch) == OK);
00101 }
00102 
00103 bool Input::hasKey(int _ch) {
00104     return (has_key(_ch) == TRUE);
00105 }
00106 
00107 /****
00108  **** Key
00109  ****
00110  ***/
00111 
00112 int Key::F(int n) {
00113     return KEY_F(n);
00114 }
00115 
00116 const int
00117     Key::Break     = KEY_BREAK,
00118     Key::Down      = KEY_DOWN,
00119     Key::Up        = KEY_UP,
00120     Key::Left      = KEY_LEFT,
00121     Key::Right     = KEY_RIGHT,
00122     Key::Home      = KEY_HOME,
00123     Key::Backspace = KEY_BACKSPACE,
00124     Key::F0        = KEY_F0,
00125     Key::DL        = KEY_DL,
00126     Key::IL        = KEY_IL,
00127     Key::DC        = KEY_DC,
00128     Key::IC        = KEY_IC,
00129     Key::EIC       = KEY_EIC,
00130     Key::Clear     = KEY_CLEAR,
00131     Key::EOS       = KEY_EOS,
00132     Key::EOL       = KEY_EOL,
00133     Key::SF        = KEY_SF,
00134     Key::SR        = KEY_SR,
00135     Key::NPage     = KEY_NPAGE,
00136     Key::PPage     = KEY_PPAGE,
00137     Key::STab      = KEY_STAB,
00138     Key::CTab      = KEY_CTAB,
00139     Key::CATab     = KEY_CATAB,
00140     Key::Enter     = KEY_ENTER,
00141     Key::SReset    = KEY_SRESET,
00142     Key::Reset     = KEY_RESET;
00143 
00144 const int
00145     Key::LL        = KEY_LL,
00146     Key::A1        = KEY_A1,
00147     Key::A3        = KEY_A3,
00148     Key::B2        = KEY_B2,
00149     Key::C1        = KEY_C1,
00150     Key::C3        = KEY_C3,
00151     Key::BTab      = KEY_BTAB,
00152     Key::Beg       = KEY_BEG,
00153     Key::Cancel    = KEY_CANCEL,
00154     Key::Close     = KEY_CLOSE,
00155     Key::Command   = KEY_COMMAND,
00156     Key::Copy      = KEY_COPY,
00157     Key::Create    = KEY_CREATE,
00158     Key::End       = KEY_END,
00159     Key::Exit      = KEY_EXIT,
00160     Key::Find      = KEY_FIND,
00161     Key::Help      = KEY_HELP,
00162     Key::Mark      = KEY_MARK,
00163     Key::Message   = KEY_MESSAGE,
00164     Key::Mouse     = KEY_MOUSE,
00165     Key::Move      = KEY_MOVE,
00166     Key::Next      = KEY_NEXT,
00167     Key::Open      = KEY_OPEN,
00168     Key::Options   = KEY_OPTIONS,
00169     Key::Previous  = KEY_PREVIOUS,
00170     Key::Redo      = KEY_REDO,
00171     Key::Reference = KEY_REFERENCE,
00172     Key::Refresh   = KEY_REFRESH,
00173     Key::Replace   = KEY_REPLACE,
00174     Key::Resize    = KEY_RESIZE,
00175     Key::Restart   = KEY_RESTART,
00176     Key::Resume    = KEY_RESUME,
00177     Key::Save      = KEY_SAVE;
00178 
00179 const int
00180     Key::SBeg      = KEY_SBEG,
00181     Key::SCancel   = KEY_SCANCEL,
00182     Key::SCommand  = KEY_SCOMMAND,
00183     Key::SCopy     = KEY_SCOPY,
00184     Key::SCreate   = KEY_SCREATE,
00185     Key::SDC       = KEY_SDC,
00186     Key::SDL       = KEY_SDL,
00187     Key::Select    = KEY_SELECT,
00188     Key::SEnd      = KEY_SEND,
00189     Key::SEOL      = KEY_SEOL,
00190     Key::SExit     = KEY_SEXIT,
00191     Key::SFind     = KEY_SFIND,
00192     Key::SHelp     = KEY_SHELP,
00193     Key::SHome     = KEY_SHOME,
00194     Key::SIC       = KEY_SIC,
00195     Key::SLeft     = KEY_SLEFT,
00196     Key::SMessage  = KEY_SMESSAGE,
00197     Key::SMove     = KEY_SMOVE,
00198     Key::SNext     = KEY_SNEXT,
00199     Key::SOptions  = KEY_SOPTIONS,
00200     Key::SPrevious = KEY_SPREVIOUS,
00201     Key::SPrint    = KEY_SPRINT,
00202     Key::SRedo     = KEY_SREPLACE,
00203     Key::SRight    = KEY_SRIGHT,
00204     Key::SResume   = KEY_SRSUME,
00205     Key::SSave     = KEY_SSAVE,
00206     Key::SSuspend  = KEY_SSUSPEND,
00207     Key::SUndo     = KEY_SUNDO,
00208     Key::Suspend   = KEY_SUSPEND,
00209     Key::Undo      = KEY_UNDO;

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