Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MFXBaseObject.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2004-2024 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#pragma once
23#include <config.h>
24
25#include <FXHash.h>
26using namespace FX;
27
28namespace FXEX {
29
37#define FXMAPALL(func) {MKUINT(MINKEY,MINTYPE),MKUINT(MAXKEY,MAXTYPE),&func}
38
42#define FXMAPKEY(key,func) {MKUINT(key,MINTYPE),MKUINT(key,MAXTYPE),&func}
43
44
48class /* FXAPI // patch by Daniel Krajzewicz 24.02.2004 */
49 MFXBaseObject : public FXObject {
50 FXDECLARE(MFXBaseObject)
51
52protected:
54 enum {
55 FLAG_ENABLED = 0x00000002, // enabled
56 FLAG_UPDATE = 0x00000004, // needs update
57 FLAG_FOCUSED = 0x00000010, // has focus
58 FLAG_DIRTY = 0x00000020, // dirty
59 FLAG_RECALC = 0x00000040, // needs recalculation
60 FLAG_DEFAULT = 0x00000200, // set to default
61 FLAG_INITIAL = 0x00000400, // set to initial value
62 FLAG_ACTIVE = 0x00001000, // active
63 FLAG_CHANGED = 0x00010000, // changed
64 FLAG_READONLY = 0x10000000 // read only
65 };
66
67private:
68 FXApp* app; // application pointer
69
70protected:
71 FXObject* target; // application target
72 FXSelector message; // application message
73 void* data; // user data
74 FXuint datalen; // length of user data
75 FXuint flags; // state flags
76 FXuint options; // option flags
77
78public:
79 enum {
100 };
101
102public:
103 long onCmdEnable(FXObject*, FXSelector, void*);
104 long onCmdDisable(FXObject*, FXSelector, void*);
105 long onUpdate(FXObject*, FXSelector, void*);
106
107public:
109 MFXBaseObject(FXObject* tgt = NULL, FXSelector sel = 0);
110
112 MFXBaseObject(FXApp* a, FXObject* tgt = NULL, FXSelector sel = 0);
113
115 FXApp* getApp();
116
118 FXObject* getTarget() {
119 return target;
120 }
121
123 void setTarget(FXObject* tgt) {
124 target = tgt;
125 }
126
128 FXSelector getSelector() {
129 return message;
130 }
131
133 void setSelector(FXSelector sel) {
134 message = sel;
135 }
136
138 void* getUserData() {
139 return data;
140 }
141
143 void setUserData(void* d) {
144 data = d;
145 }
146
148 FXuint getUserDataLen() {
149 return datalen;
150 }
151
153 void setUserDataLen(FXuint len) {
154 datalen = len;
155 }
156
158 FXbool isEnabled() {
159 return (flags & FLAG_ENABLED) != 0;
160 }
161
163 virtual void enable() {
165 }
166
168 virtual void disable() {
169 flags &= ~FLAG_ENABLED;
170 }
171
173 virtual FXbool isReadonly() {
174 return (flags & FLAG_READONLY) != 0;
175 }
176
178 virtual void setReadonly(FXbool mode = TRUE);
179
181 virtual void create() {}
182
184 virtual void detach() {}
185
187 virtual void destroy() {}
188
190 virtual void save(FXStream& store) const;
191
193 virtual void load(FXStream& store);
194
196 virtual ~MFXBaseObject();
197};
198
199} // namespace FXEX
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?
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 GUI.h:31