Project stdui: "Simple Type Dialog User-Interface"

|
Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

stdwindow.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Serge Lussier,,,   *
00003  *   serge.lussier@videotron.ca   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #include <stdwindow.h>
00021 
00022 namespace stdui {
00023 
00024 
00025 stdwindow::stdwindow():stdobject(){
00026    _mem_block = 0l;
00027 }
00028 
00029 stdwindow::stdwindow(stdobject* __parentobj, const std::string& _nameid, stdflags __flags): stdobject(__parentobj, _nameid, __flags)
00030 {
00031    _mem_block = 0l;
00032 }
00033 
00034 
00035 stdwindow::stdwindow(stdwindow* _parentwin,const std::string& _nameid, stdflags __flags):stdobject(_parentwin, _nameid, __flags)
00036 {
00037    _mem_block = 0l;
00038 }
00039 
00040 
00041 stdwindow::~stdwindow()
00042 {
00043    if( _mem_block ) delete [] _mem_block;
00044 }
00045 
00046 
00047 
00048 
00049 
00056 cell* stdwindow::cellat(int x, int y)
00057 {
00058    if ( ( x < 0 ) || ( y < 0 ) || ( x >= width() ) || ( y >= height() )  ) return 0l;
00059       // Prevent memory leak. return the beggining of the buffer.
00060       //return _mem_block;
00061    return _mem_block + ( y*width() + x );
00062 }
00063 
00064 
00068 int stdwindow::write( const cxstring& cxs )
00069 {
00070    cell* pc;
00071    return write(_xy.x(), _xy.y(), cxs.data());
00072 }
00073 
00074 
00078 int stdwindow::write(const std::string& str)
00079 {
00080     return write(_xy.x(), _xy.y(), str);
00081 }
00082 
00083 
00087 int stdwindow::write(int xx, int yy, const std::string& str)
00088 {
00089     int n = 0;
00090     cell* p = cellat( xx,yy);
00091     const char* c = str.c_str();
00092     while(*c){
00093       *p++ = _color.code()|*c++;
00094     }
00095     return c-str.c_str();
00096 }
00097 
00098 
00102 int stdwindow::write(int,int, const cxstring& )
00103 {
00105     return 0;
00106 }
00107 
00108 
00112 bool stdwindow::gotoxy( const cxy& xy )
00113 {
00114     return gotoxy(xy.x(), xy.y());
00115 }
00116 
00117 
00121 bool stdwindow::gotoxy(int xx, int yy)
00122 {
00123     if(!cellat(xx,yy)) return false;
00124     _xy(xx,yy);
00125 }
00126 
00127 
00128 
00129 
00133 const cxy& stdwindow::xy()
00134 {
00135     return _xy;
00136 }
00137 
00138 
00142 cxy stdwindow::movewindowat(int, int )
00143 {
00144    cxy pxy = _topleft;
00145    return pxy;
00146 }
00147 
00148 
00152 cxy stdwindow::movewindow( const cxy& )
00153 {
00155    cxy pxy = _topleft;
00156    return pxy;
00157     
00158 }
00159 
00160 
00164 cxy stdwindow::movewindow( int xx, int yy)
00165 {
00167    cxy pxy = _topleft;
00168    
00169    return pxy;
00170     
00171 }
00172 
00173 
00177 cxy stdwindow::movewindowat( const cxy& )
00178 {
00180    cxy pxy = _topleft;
00181    return pxy;
00182     
00183 }
00184 
00185 
00186 
00187 
00191 int stdwindow::rx()
00192 {
00193    return _geometry.topleft().x();
00194 }
00195 
00196 
00200 int stdwindow::ry()
00201 {
00202     return _geometry.topleft().y();
00203 }
00204 
00205 
00209 int stdwindow::tx()
00210 {
00211     return _topleft.x();
00212 }
00213 
00214 
00218 int stdwindow::ty()
00219 {
00220     return _topleft.y();
00221 }
00222 
00223 }
00224 

API Documentation Generated by:  doxygen 1.4.0
About the author | Site started with trial version of DreamWeaver MX 2004 | Finalizing with  | Contact | ©2005, Serge Lussier ( Bretzel )