SUMO - Simulation of Urban MObility
FXBaseObject.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2004-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 //
20 /****************************************************************************/
21 
22 #ifndef FXBASEOBJECT_H
23 #define FXBASEOBJECT_H
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <FXHash.h>
36 using namespace FX;
37 #ifndef FXOBJECT_H
38 #include <FXObject.h>
39 using namespace FX;
40 #endif
41 namespace FXEX {
42 
50 #define FXMAPALL(func) {MKUINT(MINKEY,MINTYPE),MKUINT(MAXKEY,MAXTYPE),&func}
51 
55 #define FXMAPKEY(key,func) {MKUINT(key,MINTYPE),MKUINT(key,MAXTYPE),&func}
56 
57 
61 class /* FXAPI // patch by Daniel Krajzewicz 24.02.2004 */
62  FXBaseObject : public FXObject {
63  FXDECLARE(FXBaseObject)
64 
65 protected:
67  enum {
68  FLAG_ENABLED = 0x00000002, // enabled
69  FLAG_UPDATE = 0x00000004, // needs update
70  FLAG_FOCUSED = 0x00000010, // has focus
71  FLAG_DIRTY = 0x00000020, // dirty
72  FLAG_RECALC = 0x00000040, // needs recalculation
73  FLAG_DEFAULT = 0x00000200, // set to default
74  FLAG_INITIAL = 0x00000400, // set to initial value
75  FLAG_ACTIVE = 0x00001000, // active
76  FLAG_CHANGED = 0x00010000, // changed
77  FLAG_READONLY = 0x10000000 // read only
78  };
79 
80 private:
81  FXApp* app; // application pointer
82 
83 protected:
84  FXObject* target; // application target
85  FXSelector message; // application message
86  void* data; // user data
87  FXuint datalen; // length of user data
88  FXuint flags; // state flags
89  FXuint options; // option flags
90 
91 public:
92  enum {
93  ID_NONE = 0,
94  ID_DELETE = 6,
97  ID_SETVALUE = 17,
112  ID_LAST
113  };
114 
115 public:
116  long onCmdEnable(FXObject*, FXSelector, void*);
117  long onCmdDisable(FXObject*, FXSelector, void*);
118  long onUpdate(FXObject*, FXSelector, void*);
119 
120 public:
122  FXBaseObject(FXObject* tgt = NULL, FXSelector sel = 0);
123 
125  FXBaseObject(FXApp* a, FXObject* tgt = NULL, FXSelector sel = 0);
126 
128  FXApp* getApp();
129 
131  FXObject* getTarget() {
132  return target;
133  }
134 
136  void setTarget(FXObject* tgt) {
137  target = tgt;
138  }
139 
141  FXSelector getSelector() {
142  return message;
143  }
144 
146  void setSelector(FXSelector sel) {
147  message = sel;
148  }
149 
151  void* getUserData() {
152  return data;
153  }
154 
156  void setUserData(void* d) {
157  data = d;
158  }
159 
161  FXuint getUserDataLen() {
162  return datalen;
163  }
164 
166  void setUserDataLen(FXuint len) {
167  datalen = len;
168  }
169 
171  FXbool isEnabled() {
172  return (flags & FLAG_ENABLED) != 0;
173  }
174 
176  virtual void enable() {
177  flags |= FLAG_ENABLED;
178  }
179 
181  virtual void disable() {
182  flags &= ~FLAG_ENABLED;
183  }
184 
186  virtual FXbool isReadonly() {
187  return (flags & FLAG_READONLY) != 0;
188  }
189 
191  virtual void setReadonly(FXbool mode = TRUE);
192 
194  virtual void create() {}
195 
197  virtual void detach() {}
198 
200  virtual void destroy() {}
201 
203  virtual void save(FXStream& store) const;
204 
206  virtual void load(FXStream& store);
207 
209  virtual ~FXBaseObject();
210 };
211 
212 } // namespace FXEX
213 #endif // FXBASEOBJECT_H
214 
void * getUserData()
get user data
Definition: FXBaseObject.h:151
virtual void create()
create resource
Definition: FXBaseObject.h:194
virtual void disable()
disable us
Definition: FXBaseObject.h:181
virtual void enable()
enable us
Definition: FXBaseObject.h:176
FXbool isEnabled()
are we enabled?
Definition: FXBaseObject.h:171
FXObject * getTarget()
get the target
Definition: FXBaseObject.h:131
void setUserDataLen(FXuint len)
set the user data length
Definition: FXBaseObject.h:166
void setUserData(void *d)
set user data
Definition: FXBaseObject.h:156
FXSelector getSelector()
get the message
Definition: FXBaseObject.h:141
void setTarget(FXObject *tgt)
set the target
Definition: FXBaseObject.h:136
FXSelector message
Definition: FXBaseObject.h:85
virtual void destroy()
destroy resource
Definition: FXBaseObject.h:200
void setSelector(FXSelector sel)
set the selector
Definition: FXBaseObject.h:146
FXObject * target
Definition: FXBaseObject.h:84
virtual FXbool isReadonly()
are we modifiable
Definition: FXBaseObject.h:186
FXuint getUserDataLen()
get user daat length
Definition: FXBaseObject.h:161
virtual void detach()
detach resource
Definition: FXBaseObject.h:197