Eclipse 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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
20 //
21 /****************************************************************************/
22 
23 #ifndef FXBASEOBJECT_H
24 #define FXBASEOBJECT_H
25 #include <config.h>
26 
27 #include <FXHash.h>
28 using namespace FX;
29 #ifndef FXOBJECT_H
30 #include <FXObject.h>
31 using namespace FX;
32 #endif
33 namespace FXEX {
34 
42 #define FXMAPALL(func) {MKUINT(MINKEY,MINTYPE),MKUINT(MAXKEY,MAXTYPE),&func}
43 
47 #define FXMAPKEY(key,func) {MKUINT(key,MINTYPE),MKUINT(key,MAXTYPE),&func}
48 
49 
53 class /* FXAPI // patch by Daniel Krajzewicz 24.02.2004 */
54  FXBaseObject : public FXObject {
55  FXDECLARE(FXBaseObject)
56 
57 protected:
59  enum {
60  FLAG_ENABLED = 0x00000002, // enabled
61  FLAG_UPDATE = 0x00000004, // needs update
62  FLAG_FOCUSED = 0x00000010, // has focus
63  FLAG_DIRTY = 0x00000020, // dirty
64  FLAG_RECALC = 0x00000040, // needs recalculation
65  FLAG_DEFAULT = 0x00000200, // set to default
66  FLAG_INITIAL = 0x00000400, // set to initial value
67  FLAG_ACTIVE = 0x00001000, // active
68  FLAG_CHANGED = 0x00010000, // changed
69  FLAG_READONLY = 0x10000000 // read only
70  };
71 
72 private:
73  FXApp* app; // application pointer
74 
75 protected:
76  FXObject* target; // application target
77  FXSelector message; // application message
78  void* data; // user data
79  FXuint datalen; // length of user data
80  FXuint flags; // state flags
81  FXuint options; // option flags
82 
83 public:
84  enum {
85  ID_NONE = 0,
86  ID_DELETE = 6,
89  ID_SETVALUE = 17,
104  ID_LAST
105  };
106 
107 public:
108  long onCmdEnable(FXObject*, FXSelector, void*);
109  long onCmdDisable(FXObject*, FXSelector, void*);
110  long onUpdate(FXObject*, FXSelector, void*);
111 
112 public:
114  FXBaseObject(FXObject* tgt = NULL, FXSelector sel = 0);
115 
117  FXBaseObject(FXApp* a, FXObject* tgt = NULL, FXSelector sel = 0);
118 
120  FXApp* getApp();
121 
123  FXObject* getTarget() {
124  return target;
125  }
126 
128  void setTarget(FXObject* tgt) {
129  target = tgt;
130  }
131 
133  FXSelector getSelector() {
134  return message;
135  }
136 
138  void setSelector(FXSelector sel) {
139  message = sel;
140  }
141 
143  void* getUserData() {
144  return data;
145  }
146 
148  void setUserData(void* d) {
149  data = d;
150  }
151 
153  FXuint getUserDataLen() {
154  return datalen;
155  }
156 
158  void setUserDataLen(FXuint len) {
159  datalen = len;
160  }
161 
163  FXbool isEnabled() {
164  return (flags & FLAG_ENABLED) != 0;
165  }
166 
168  virtual void enable() {
169  flags |= FLAG_ENABLED;
170  }
171 
173  virtual void disable() {
174  flags &= ~FLAG_ENABLED;
175  }
176 
178  virtual FXbool isReadonly() {
179  return (flags & FLAG_READONLY) != 0;
180  }
181 
183  virtual void setReadonly(FXbool mode = TRUE);
184 
186  virtual void create() {}
187 
189  virtual void detach() {}
190 
192  virtual void destroy() {}
193 
195  virtual void save(FXStream& store) const;
196 
198  virtual void load(FXStream& store);
199 
201  virtual ~FXBaseObject();
202 };
203 
204 } // namespace FXEX
205 #endif // FXBASEOBJECT_H
206 
FXuint getUserDataLen()
get user daat length
Definition: FXBaseObject.h:153
FXSelector message
Definition: FXBaseObject.h:77
void setUserDataLen(FXuint len)
set the user data length
Definition: FXBaseObject.h:158
FXObject * getTarget()
get the target
Definition: FXBaseObject.h:123
virtual void create()
create resource
Definition: FXBaseObject.h:186
FXObject * target
Definition: FXBaseObject.h:76
FXbool isEnabled()
are we enabled?
Definition: FXBaseObject.h:163
void setTarget(FXObject *tgt)
set the target
Definition: FXBaseObject.h:128
void setUserData(void *d)
set user data
Definition: FXBaseObject.h:148
virtual FXbool isReadonly()
are we modifiable
Definition: FXBaseObject.h:178
FXSelector getSelector()
get the message
Definition: FXBaseObject.h:133
void * getUserData()
get user data
Definition: FXBaseObject.h:143
virtual void enable()
enable us
Definition: FXBaseObject.h:168
virtual void destroy()
destroy resource
Definition: FXBaseObject.h:192
virtual void detach()
detach resource
Definition: FXBaseObject.h:189
void setSelector(FXSelector sel)
set the selector
Definition: FXBaseObject.h:138
virtual void disable()
disable us
Definition: FXBaseObject.h:173