SUMO - Simulation of Urban MObility
FXBaseObject.h
Go to the documentation of this file.
1 /****************************************************************************/
9 //
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12 // Copyright (C) 2004-2014 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 
23 #ifndef FXBASEOBJECT_H
24 #define FXBASEOBJECT_H
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <FXHash.h>
37 using namespace FX;
38 #ifndef FXOBJECT_H
39 #include <FXObject.h>
40 using namespace FX;
41 #endif
42 namespace FXEX {
43 
51 #define FXMAPALL(func) {MKUINT(MINKEY,MINTYPE),MKUINT(MAXKEY,MAXTYPE),&func}
52 
56 #define FXMAPKEY(key,func) {MKUINT(key,MINTYPE),MKUINT(key,MAXTYPE),&func}
57 
58 
62 class /* FXAPI // patch by Daniel Krajzewicz 24.02.2004 */
63  FXBaseObject : public FXObject {
64  FXDECLARE(FXBaseObject)
65 
66 protected:
68  enum {
69  FLAG_ENABLED = 0x00000002, // enabled
70  FLAG_UPDATE = 0x00000004, // needs update
71  FLAG_FOCUSED = 0x00000010, // has focus
72  FLAG_DIRTY = 0x00000020, // dirty
73  FLAG_RECALC = 0x00000040, // needs recalculation
74  FLAG_DEFAULT = 0x00000200, // set to default
75  FLAG_INITIAL = 0x00000400, // set to initial value
76  FLAG_ACTIVE = 0x00001000, // active
77  FLAG_CHANGED = 0x00010000, // changed
78  FLAG_READONLY = 0x10000000 // read only
79  };
80 
81 private:
82  FXApp* app; // application pointer
83 
84 protected:
85  FXObject* target; // application target
86  FXSelector message; // application message
87  void* data; // user data
88  FXuint datalen; // length of user data
89  FXuint flags; // state flags
90  FXuint options; // option flags
91 
92 public:
93  enum {
94  ID_NONE = 0,
95  ID_DELETE = 6,
98  ID_SETVALUE = 17,
113  ID_LAST
114  };
115 
116 public:
117  long onCmdEnable(FXObject*, FXSelector, void*);
118  long onCmdDisable(FXObject*, FXSelector, void*);
119  long onUpdate(FXObject*, FXSelector, void*);
120 
121 public:
123  FXBaseObject(FXObject* tgt = NULL, FXSelector sel = 0);
124 
126  FXBaseObject(FXApp* a, FXObject* tgt = NULL, FXSelector sel = 0);
127 
129  FXApp* getApp();
130 
133  return target;
134  }
135 
137  void setTarget(FXObject* tgt) {
138  target = tgt;
139  }
140 
142  FXSelector getSelector() {
143  return message;
144  }
145 
147  void setSelector(FXSelector sel) {
148  message = sel;
149  }
150 
152  void* getUserData() {
153  return data;
154  }
155 
157  void setUserData(void* d) {
158  data = d;
159  }
160 
162  FXuint getUserDataLen() {
163  return datalen;
164  }
165 
167  void setUserDataLen(FXuint len) {
168  datalen = len;
169  }
170 
172  FXbool isEnabled() {
173  return (flags & FLAG_ENABLED) != 0;
174  }
175 
177  virtual void enable() {
178  flags |= FLAG_ENABLED;
179  }
180 
182  virtual void disable() {
183  flags &= ~FLAG_ENABLED;
184  }
185 
187  virtual FXbool isReadonly() {
188  return (flags & FLAG_READONLY) != 0;
189  }
190 
192  virtual void setReadonly(FXbool mode = TRUE);
193 
195  virtual void create() {}
196 
198  virtual void detach() {}
199 
201  virtual void destroy() {}
202 
204  virtual void save(FXStream& store) const;
205 
207  virtual void load(FXStream& store);
208 
210  virtual ~FXBaseObject();
211 };
212 
213 } // namespace FXEX
214 #endif // FXBASEOBJECT_H
215 
void * getUserData()
get user data
Definition: FXBaseObject.h:152
virtual void create()
create resource
Definition: FXBaseObject.h:195
virtual void disable()
disable us
Definition: FXBaseObject.h:182
virtual void enable()
enable us
Definition: FXBaseObject.h:177
FXbool isEnabled()
are we enabled?
Definition: FXBaseObject.h:172
FXObject * getTarget()
get the target
Definition: FXBaseObject.h:132
void setUserDataLen(FXuint len)
set the user data length
Definition: FXBaseObject.h:167
void setUserData(void *d)
set user data
Definition: FXBaseObject.h:157
FXSelector getSelector()
get the message
Definition: FXBaseObject.h:142
void setTarget(FXObject *tgt)
set the target
Definition: FXBaseObject.h:137
FXSelector message
Definition: FXBaseObject.h:86
virtual void destroy()
destroy resource
Definition: FXBaseObject.h:201
void setSelector(FXSelector sel)
set the selector
Definition: FXBaseObject.h:147
FXObject * target
Definition: FXBaseObject.h:85
virtual FXbool isReadonly()
are we modifiable
Definition: FXBaseObject.h:187
MSNet * load(OptionsCont &oc)
Definition: sumo_main.cpp:87
FXuint getUserDataLen()
get user daat length
Definition: FXBaseObject.h:162
virtual void detach()
detach resource
Definition: FXBaseObject.h:198