Eclipse SUMO - Simulation of Urban MObility
MFXBaseObject.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-2022 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>
28using namespace FX;
29#ifndef FXOBJECT_H
30#include <FXObject.h>
31using namespace FX;
32#endif
33namespace 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
53class /* FXAPI // patch by Daniel Krajzewicz 24.02.2004 */
54 MFXBaseObject : public FXObject {
55 FXDECLARE(MFXBaseObject)
56
57protected:
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
72private:
73 FXApp* app; // application pointer
74
75protected:
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
83public:
84 enum {
104 ID_LAST
105 };
106
107public:
108 long onCmdEnable(FXObject*, FXSelector, void*);
109 long onCmdDisable(FXObject*, FXSelector, void*);
110 long onUpdate(FXObject*, FXSelector, void*);
111
112public:
114 MFXBaseObject(FXObject* tgt = NULL, FXSelector sel = 0);
115
117 MFXBaseObject(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() {
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 ~MFXBaseObject();
202};
203
204} // namespace FXEX
205#endif // FXBASEOBJECT_H
206
void setSelector(FXSelector sel)
set the selector
virtual ~MFXBaseObject()
dtor
virtual void save(FXStream &store) const
save object to stream
virtual void enable()
enable us
virtual void detach()
detach resource
FXuint getUserDataLen()
get user daat length
FXbool isEnabled()
are we enabled?
MFXBaseObject(FXObject *tgt=NULL, FXSelector sel=0)
Just supply the target and selector (de-serialisation too)
FXObject * getTarget()
get the target
virtual void create()
create resource
virtual void setReadonly(FXbool mode=TRUE)
set modifiable mode
virtual void destroy()
destroy resource
void * getUserData()
get user data
long onCmdEnable(FXObject *, FXSelector, void *)
void setUserDataLen(FXuint len)
set the user data length
virtual void disable()
disable us
void setTarget(FXObject *tgt)
set the target
FXApp * getApp()
application pointer
long onUpdate(FXObject *, FXSelector, void *)
long onCmdDisable(FXObject *, FXSelector, void *)
virtual FXbool isReadonly()
are we modifiable
void setUserData(void *d)
set user data
FXSelector getSelector()
get the message
virtual void load(FXStream &store)
load object from stream
Definition: fxexdefs.h:57
Definition: GUI.h:31