SUMO - Simulation of Urban MObility
|
00001 /******************************************************************************** 00002 * * 00003 * Base of lots of non-widgets * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 2003 by Mathew Robertson. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 *********************************************************************************/ 00022 #ifndef FXBASEOBJECT_H 00023 #define FXBASEOBJECT_H 00024 00025 00026 // =========================================================================== 00027 // included modules 00028 // =========================================================================== 00029 #ifdef _MSC_VER 00030 #include <windows_config.h> 00031 #else 00032 #include <config.h> 00033 #endif 00034 00035 #include <FXHash.h> 00036 using namespace FX; 00037 #ifndef FXOBJECT_H 00038 #include <FXObject.h> 00039 using namespace FX; 00040 #endif 00041 namespace FXEX { 00042 00050 #define FXMAPALL(func) {MKUINT(MINKEY,MINTYPE),MKUINT(MAXKEY,MAXTYPE),&func} 00051 00055 #define FXMAPKEY(key,func) {MKUINT(key,MINTYPE),MKUINT(key,MAXTYPE),&func} 00056 00057 00061 class /* FXAPI // patch by Daniel Krajzewicz 24.02.2004 */ 00062 FXBaseObject : public FXObject { 00063 FXDECLARE(FXBaseObject) 00064 00065 protected: 00067 enum { 00068 FLAG_ENABLED = 0x00000002, // enabled 00069 FLAG_UPDATE = 0x00000004, // needs update 00070 FLAG_FOCUSED = 0x00000010, // has focus 00071 FLAG_DIRTY = 0x00000020, // dirty 00072 FLAG_RECALC = 0x00000040, // needs recalculation 00073 FLAG_DEFAULT = 0x00000200, // set to default 00074 FLAG_INITIAL = 0x00000400, // set to initial value 00075 FLAG_ACTIVE = 0x00001000, // active 00076 FLAG_CHANGED = 0x00010000, // changed 00077 FLAG_READONLY = 0x10000000 // read only 00078 }; 00079 00080 private: 00081 FXApp* app; // application pointer 00082 00083 protected: 00084 FXObject* target; // application target 00085 FXSelector message; // application message 00086 void* data; // user data 00087 FXuint datalen; // length of user data 00088 FXuint flags; // state flags 00089 FXuint options; // option flags 00090 00091 public: 00092 enum { 00093 ID_NONE = 0, 00094 ID_DELETE = 6, 00095 ID_DISABLE, 00096 ID_ENABLE, 00097 ID_SETVALUE = 17, 00098 ID_SETINTVALUE, 00099 ID_SETREALVALUE, 00100 ID_SETSTRINGVALUE, 00101 ID_SETINTRANGE, 00102 ID_SETREALRANGE, 00103 ID_GETINTVALUE, 00104 ID_GETREALVALUE, 00105 ID_GETSTRINGVALUE, 00106 ID_XML, 00107 ID_META, 00108 ID_COMMENT, 00109 ID_DOCUMENT, 00110 ID_TAG, 00111 ID_CONTENT, 00112 ID_LAST 00113 }; 00114 00115 public: 00116 long onCmdEnable(FXObject*, FXSelector, void*); 00117 long onCmdDisable(FXObject*, FXSelector, void*); 00118 long onUpdate(FXObject*, FXSelector, void*); 00119 00120 public: 00122 FXBaseObject(FXObject* tgt = NULL, FXSelector sel = 0); 00123 00125 FXBaseObject(FXApp* a, FXObject* tgt = NULL, FXSelector sel = 0); 00126 00128 FXApp* getApp(); 00129 00131 FXObject* getTarget() { 00132 return target; 00133 } 00134 00136 void setTarget(FXObject* tgt) { 00137 target = tgt; 00138 } 00139 00141 FXSelector getSelector() { 00142 return message; 00143 } 00144 00146 void setSelector(FXSelector sel) { 00147 message = sel; 00148 } 00149 00151 void* getUserData() { 00152 return data; 00153 } 00154 00156 void setUserData(void* d) { 00157 data = d; 00158 } 00159 00161 FXuint getUserDataLen() { 00162 return datalen; 00163 } 00164 00166 void setUserDataLen(FXuint len) { 00167 datalen = len; 00168 } 00169 00171 FXbool isEnabled() { 00172 return (flags & FLAG_ENABLED) != 0; 00173 } 00174 00176 virtual void enable() { 00177 flags |= FLAG_ENABLED; 00178 } 00179 00181 virtual void disable() { 00182 flags &= ~FLAG_ENABLED; 00183 } 00184 00186 virtual FXbool isReadonly() { 00187 return (flags & FLAG_READONLY) != 0; 00188 } 00189 00191 virtual void setReadonly(FXbool mode = TRUE); 00192 00194 virtual void create() {} 00195 00197 virtual void detach() {} 00198 00200 virtual void destroy() {} 00201 00203 virtual void save(FXStream& store) const; 00204 00206 virtual void load(FXStream& store); 00207 00209 virtual ~FXBaseObject(); 00210 }; 00211 00212 } // namespace FXEX 00213 #endif // FXBASEOBJECT_H 00214