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 #ifndef _STDUI_H 00021 #define _STDUI_H 00022 00023 // ncurses data types and routines 00024 #include <ncurses.h> 00025 00026 // sigc++ base 00027 #include <sigc++/sigc++.h> 00028 00029 // std::string class is used almost every where in stdui... 00030 #include <string> 00031 00032 namespace stdui{ 00033 typedef unsigned long stdflags; 00034 typedef chtype cell; 00035 typedef chtype* pcell; 00036 00037 00038 // I am not a fan of using the pre-processor to define constant values as macros. 00039 // I prefer declaring constants as static variables emebed into structs... 00040 00045 class stdflag{ 00046 public: 00051 stdflag() { } 00052 00056 stdui::stdflags operator !() { return !_priv_f; } 00057 00061 stdui::stdflags operator |(stdui::stdflags f) { return _priv_f | f; } 00062 00066 stdui::stdflags operator ~() { return ~_priv_f; } 00067 00071 stdui::stdflags operator &(stdui::stdflags f) { return _priv_f & f; } 00072 00076 bool operator ==(stdui::stdflags f) { return _priv_f == f; } 00077 00078 00082 stdui::stdflags operator &=(stdui::stdflags f) { _priv_f &= f; return _priv_f; } 00083 00087 stdui::stdflags operator |=( stdui::stdflags f ) { _priv_f |= f; return _priv_f; } 00088 00092 void operator =(stdflags f) { _priv_f = f; } 00093 00094 // Generic object states: 00095 static const stdflags empty=1; 00096 static const stdflags locked=2; 00097 static const stdflags active=4; 00098 static const stdflags enable=8; 00099 // UI styles: 00100 static const stdflags toplayout = 0x10; 00101 static const stdflags sublayout = 0x20; 00102 static const stdflags obstrued = 0x40; 00103 static const stdflags clipped = 0x80; 00104 static const stdflags toplevel = 0x100; 00105 static const stdflags frame = 0x200; 00106 static const stdflags caption = 0x400; 00107 static const stdflags shadow = 0x800; 00108 static const stdflags visible = 0x1000; 00109 00110 private: 00111 stdflags _priv_f; 00112 00113 }; // end of class stdflag 00114 00115 namespace evt{ 00116 enum result { accept=0,reject }; 00117 } 00118 00119 00120 } // end of namespace stdui 00121 00122 00123 #endif