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

Window.C

00001 /* $Id: Window.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  * Window.C
00024  *
00025  * Window class implementation
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::Window);
00034 
00035 using namespace SFW;
00036 using namespace SFW::Curses;
00037 
00038 Window::Window(int y, int x, int lines, int cols) {
00039     win = newwin(lines, cols, y, x);
00040 }
00041 
00042 Window::~Window() {
00043     if(win)
00044         delwin(win);
00045 }
00046 
00047 bool Window::addch(chtype ch) {
00048     return (waddch(win, ch) == OK);
00049 }
00050 
00051 bool Window::addch(int y, int x, chtype ch) {
00052     return (mvwaddch(win, y, x, ch) == OK);
00053 }
00054 
00055 bool Window::echoch(chtype ch) {
00056     return (wechochar(win, ch) == OK);
00057 }
00058 
00059 bool Window::addstr(const string &s) {
00060     return (waddstr(win, s.c_str()) == OK);
00061 }
00062 
00063 bool Window::addstr(const string &s, int n) {
00064     return (waddnstr(win, s.c_str(), n) == OK);
00065 }
00066 
00067 bool Window::addstr(int y, int x, const string &s) {
00068     return (mvwaddstr(win, y, x, s.c_str()) == OK);
00069 }
00070 
00071 bool Window::addstr(int y, int x, const string &s, int n) {
00072     return (mvwaddnstr(win, y, x, s.c_str(), n) == OK);
00073 }
00074 
00075 bool Window::attron(int attrs) {
00076     return (wattron(win, attrs) == OK);
00077 }
00078 
00079 bool Window::attroff(int attrs) {
00080     return (wattroff(win, attrs) == OK);
00081 }
00082 
00083 bool Window::attrset(int attrs) {
00084     return (wattrset(win, attrs) == OK);
00085 }
00086 
00087 bool Window::erase() {
00088     return (werase(win) == OK);
00089 }
00090 
00091 bool Window::clear() {
00092     return (wclear(win) == OK);
00093 }
00094 
00095 bool Window::clrtobot() {
00096     return (wclrtobot(win) == OK);
00097 }
00098 
00099 bool Window::clrtoeol() {
00100     return (wclrtoeol(win) == OK);
00101 }
00102 
00103 bool Window::refresh(bool out) {
00104     if(out)
00105         return (wrefresh(win) == OK);
00106     else
00107         return (wnoutrefresh(win) == OK);
00108 }
00109 
00110 bool Window::redraw() {
00111     return (redrawwin(win) == OK);
00112 }
00113 
00114 bool Window::redraw(int begLine, int numLines) {
00115     return (wredrawln(win, begLine, numLines) == OK);
00116 }
00117 
00118 bool Window::clearok(bool b) {
00119     return ::clearok(win, b ? TRUE : FALSE) == OK;
00120 }
00121 
00122 bool Window::idlok(bool b) {
00123     return ::idlok(win, b ? TRUE : FALSE) == OK;
00124 }
00125 
00126 void Window::idcok(bool b) {
00127     ::idcok(win, b ? TRUE : FALSE);
00128 }
00129 
00130 void Window::immedok(bool b) {
00131     ::immedok(win, b ? TRUE : FALSE);
00132 }
00133 
00134 bool Window::leaveok(bool b) {
00135     return ::leaveok(win, b ? TRUE : FALSE) == OK;
00136 }
00137 
00138 bool Window::setscrreg(int top, int bot) {
00139     return ::wsetscrreg(win, top, bot) == OK;
00140 }
00141 
00142 bool Window::scrollok(bool b) {
00143     return ::scrollok(win, b ? TRUE : FALSE) == OK;
00144 }
00145 
00146 bool Window::move(int y, int x) {
00147     return mvwin(win, y, x) == OK;
00148 }
00149 
00150 bool Window::resize(int lines, int cols) {
00151     return wresize(win, lines, cols) == OK;
00152 }
00153 
00154 bool Window::moveto(int y, int x) {
00155     return wmove(win, y, x) == OK;
00156 }
00157 

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