Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXDataTarget.h
1 /********************************************************************************
2 * *
3 * D a t a T a r g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2018 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXDATATARGET_H
22 #define FXDATATARGET_H
23 
24 #ifndef FXOBJECT_H
25 #include "FXObject.h"
26 #endif
27 
28 namespace FX {
29 
30 
63 class FXAPI FXDataTarget : public FXObject {
64  FXDECLARE(FXDataTarget)
65 protected:
66  void *data; // Associated data
67  FXObject *target; // Target object
68  FXSelector message; // Message ID
69  FXuint type; // Type of data
70 private:
71  FXDataTarget(const FXDataTarget&);
72  FXDataTarget& operator=(const FXDataTarget&);
73 public:
74  long onCmdValue(FXObject*,FXSelector,void*);
75  long onUpdValue(FXObject*,FXSelector,void*);
76  long onCmdOption(FXObject*,FXSelector,void*);
77  long onUpdOption(FXObject*,FXSelector,void*);
78 public:
79  enum {
80  DT_VOID=0,
81  DT_BOOL,
82  DT_CHAR,
83  DT_UCHAR,
84  DT_SHORT,
85  DT_USHORT,
86  DT_INT,
87  DT_UINT,
88  DT_LONG,
89  DT_ULONG,
90  DT_FLOAT,
91  DT_DOUBLE,
92  DT_STRING,
93  DT_LAST
94  };
95 public:
96  enum {
97  ID_VALUE=1,
98  ID_OPTION=ID_VALUE+10001,
99  ID_LAST=ID_OPTION+10000
100  };
101 public:
102 
104  FXDataTarget():data(NULL),target(NULL),message(0),type(DT_VOID){}
105 
107  FXDataTarget(FXObject* tgt,FXSelector sel):data(NULL),target(tgt),message(sel),type(DT_VOID){}
108 
110  FXDataTarget(FXbool& value,FXObject* tgt=NULL,FXSelector sel=0):data(&value),target(tgt),message(sel),type(DT_BOOL){}
111 
113  FXDataTarget(FXchar& value,FXObject* tgt=NULL,FXSelector sel=0):data(&value),target(tgt),message(sel),type(DT_CHAR){}
114 
116  FXDataTarget(FXuchar& value,FXObject* tgt=NULL,FXSelector sel=0):data(&value),target(tgt),message(sel),type(DT_UCHAR){}
117 
119  FXDataTarget(FXshort& value,FXObject* tgt=NULL,FXSelector sel=0):data(&value),target(tgt),message(sel),type(DT_SHORT){}
120 
122  FXDataTarget(FXushort& value,FXObject* tgt=NULL,FXSelector sel=0):data(&value),target(tgt),message(sel),type(DT_USHORT){}
123 
125  FXDataTarget(FXint& value,FXObject* tgt=NULL,FXSelector sel=0):data(&value),target(tgt),message(sel),type(DT_INT){}
126 
128  FXDataTarget(FXuint& value,FXObject* tgt=NULL,FXSelector sel=0):data(&value),target(tgt),message(sel),type(DT_UINT){}
129 
131  FXDataTarget(FXlong& value,FXObject* tgt=NULL,FXSelector sel=0):data(&value),target(tgt),message(sel),type(DT_LONG){}
132 
134  FXDataTarget(FXulong& value,FXObject* tgt=NULL,FXSelector sel=0):data(&value),target(tgt),message(sel),type(DT_ULONG){}
135 
137  FXDataTarget(FXfloat& value,FXObject* tgt=NULL,FXSelector sel=0):data(&value),target(tgt),message(sel),type(DT_FLOAT){}
138 
140  FXDataTarget(FXdouble& value,FXObject* tgt=NULL,FXSelector sel=0):data(&value),target(tgt),message(sel),type(DT_DOUBLE){}
141 
143  FXDataTarget(FXString& value,FXObject* tgt=NULL,FXSelector sel=0):data(&value),target(tgt),message(sel),type(DT_STRING){}
144 
145 
147  void setTarget(FXObject *t){ target=t; }
148 
150  FXObject* getTarget() const { return target; }
151 
152 
154  void setSelector(FXSelector sel){ message=sel; }
155 
157  FXSelector getSelector() const { return message; }
158 
159 
161  FXuint getType() const { return type; }
162 
164  void* getData() const { return data; }
165 
166 
168  void connect(){ data=NULL; type=DT_VOID; }
169 
171  void connect(FXbool& value){ data=&value; type=DT_BOOL; }
172 
174  void connect(FXchar& value){ data=&value; type=DT_CHAR; }
175 
177  void connect(FXuchar& value){ data=&value; type=DT_UCHAR; }
178 
180  void connect(FXshort& value){ data=&value; type=DT_SHORT; }
181 
183  void connect(FXushort& value){ data=&value; type=DT_USHORT; }
184 
186  void connect(FXint& value){ data=&value; type=DT_INT; }
187 
189  void connect(FXuint& value){ data=&value; type=DT_UINT; }
190 
192  void connect(FXlong& value){ data=&value; type=DT_LONG; }
193 
195  void connect(FXulong& value){ data=&value; type=DT_ULONG; }
196 
198  void connect(FXfloat& value){ data=&value; type=DT_FLOAT; }
199 
201  void connect(FXdouble& value){ data=&value; type=DT_DOUBLE; }
202 
204  void connect(FXString& value){ data=&value; type=DT_STRING; }
205 
206 
208  void connect(FXObject* tgt,FXSelector sel){ data=NULL; target=tgt; message=sel; type=DT_VOID; }
209 
211  void connect(FXbool& value,FXObject* tgt,FXSelector sel){ data=&value; target=tgt; message=sel; type=DT_BOOL; }
212 
214  void connect(FXchar& value,FXObject* tgt,FXSelector sel){ data=&value; target=tgt; message=sel; type=DT_CHAR; }
215 
217  void connect(FXuchar& value,FXObject* tgt,FXSelector sel){ data=&value; target=tgt; message=sel; type=DT_UCHAR; }
218 
220  void connect(FXshort& value,FXObject* tgt,FXSelector sel){ data=&value; target=tgt; message=sel; type=DT_SHORT; }
221 
223  void connect(FXushort& value,FXObject* tgt,FXSelector sel){ data=&value; target=tgt; message=sel; type=DT_USHORT; }
224 
226  void connect(FXint& value,FXObject* tgt,FXSelector sel){ data=&value; target=tgt; message=sel; type=DT_INT; }
227 
229  void connect(FXuint& value,FXObject* tgt,FXSelector sel){ data=&value; target=tgt; message=sel; type=DT_UINT; }
230 
232  void connect(FXlong& value,FXObject* tgt,FXSelector sel){ data=&value; target=tgt; message=sel; type=DT_LONG; }
233 
235  void connect(FXulong& value,FXObject* tgt,FXSelector sel){ data=&value; target=tgt; message=sel; type=DT_ULONG; }
236 
238  void connect(FXfloat& value,FXObject* tgt,FXSelector sel){ data=&value; target=tgt; message=sel; type=DT_FLOAT; }
239 
241  void connect(FXdouble& value,FXObject* tgt,FXSelector sel){ data=&value; target=tgt; message=sel; type=DT_DOUBLE; }
242 
244  void connect(FXString& value,FXObject* tgt,FXSelector sel){ data=&value; target=tgt; message=sel; type=DT_STRING; }
245 
246 
248  virtual ~FXDataTarget();
249  };
250 
251 }
252 
253 #endif
FXDataTarget(FXfloat &value, FXObject *tgt=NULL, FXSelector sel=0)
Associate with float variable.
Definition: FXDataTarget.h:137
FXDataTarget(FXulong &value, FXObject *tgt=NULL, FXSelector sel=0)
Associate with unsigned long variable.
Definition: FXDataTarget.h:134
void connect(FXfloat &value, FXObject *tgt, FXSelector sel)
Associate with float variable; also set target and message.
Definition: FXDataTarget.h:238
void connect(FXuchar &value)
Associate with unsigned character variable.
Definition: FXDataTarget.h:177
void setSelector(FXSelector sel)
Set the message identifier for this data target.
Definition: FXDataTarget.h:154
FXDataTarget(FXString &value, FXObject *tgt=NULL, FXSelector sel=0)
Associate with string variable.
Definition: FXDataTarget.h:143
void connect(FXString &value, FXObject *tgt, FXSelector sel)
Associate with string variable; also set target and message.
Definition: FXDataTarget.h:244
A Data Target allows a widget to be directly connected with a associated variable, without any additional "glue code".
Definition: FXDataTarget.h:63
void connect(FXdouble &value)
Associate with double variable.
Definition: FXDataTarget.h:201
FXDataTarget(FXObject *tgt, FXSelector sel)
Associate with nothing.
Definition: FXDataTarget.h:107
FXDataTarget(FXushort &value, FXObject *tgt=NULL, FXSelector sel=0)
Associate with unsigned short variable.
Definition: FXDataTarget.h:122
FXDataTarget(FXdouble &value, FXObject *tgt=NULL, FXSelector sel=0)
Associate with double variable.
Definition: FXDataTarget.h:140
void connect(FXuint &value, FXObject *tgt, FXSelector sel)
Associate with unsigned int variable; also set target and message.
Definition: FXDataTarget.h:229
FXDataTarget(FXchar &value, FXObject *tgt=NULL, FXSelector sel=0)
Associate with character variable.
Definition: FXDataTarget.h:113
void connect(FXuint &value)
Associate with unsigned int variable.
Definition: FXDataTarget.h:189
void connect(FXObject *tgt, FXSelector sel)
Associate with nothing; also set target and message.
Definition: FXDataTarget.h:208
void connect(FXlong &value, FXObject *tgt, FXSelector sel)
Associate with long variable; also set target and message.
Definition: FXDataTarget.h:232
FXuint getType() const
Return type of data its connected to.
Definition: FXDataTarget.h:161
void connect(FXushort &value)
Associate with unsigned short variable.
Definition: FXDataTarget.h:183
void connect(FXshort &value)
Associate with signed short variable.
Definition: FXDataTarget.h:180
void connect(FXint &value, FXObject *tgt, FXSelector sel)
Associate with int variable; also set target and message.
Definition: FXDataTarget.h:226
void connect(FXlong &value)
Associate with long variable.
Definition: FXDataTarget.h:192
FXDataTarget(FXuchar &value, FXObject *tgt=NULL, FXSelector sel=0)
Associate with unsigned character variable.
Definition: FXDataTarget.h:116
void connect()
Associate with nothing.
Definition: FXDataTarget.h:168
void connect(FXdouble &value, FXObject *tgt, FXSelector sel)
Associate with double variable; also set target and message.
Definition: FXDataTarget.h:241
FXSelector getSelector() const
Get the message identifier for this data target.
Definition: FXDataTarget.h:157
void setTarget(FXObject *t)
Set the message target object for this data target.
Definition: FXDataTarget.h:147
FXDataTarget(FXshort &value, FXObject *tgt=NULL, FXSelector sel=0)
Associate with signed short variable.
Definition: FXDataTarget.h:119
void connect(FXuchar &value, FXObject *tgt, FXSelector sel)
Associate with unsigned character variable; also set target and message.
Definition: FXDataTarget.h:217
void connect(FXString &value)
Associate with string variable.
Definition: FXDataTarget.h:204
FXObject * getTarget() const
Get the message target object for this data target, if any.
Definition: FXDataTarget.h:150
FXDataTarget(FXbool &value, FXObject *tgt=NULL, FXSelector sel=0)
Associate with character variable.
Definition: FXDataTarget.h:110
void connect(FXulong &value, FXObject *tgt, FXSelector sel)
Associate with unsigned long variable; also set target and message.
Definition: FXDataTarget.h:235
void connect(FXshort &value, FXObject *tgt, FXSelector sel)
Associate with signed short variable; also set target and message.
Definition: FXDataTarget.h:220
FXDataTarget()
Associate with nothing.
Definition: FXDataTarget.h:104
Definition: FX4Splitter.h:28
void connect(FXulong &value)
Associate with unsigned long variable.
Definition: FXDataTarget.h:195
void connect(FXchar &value)
Associate with character variable.
Definition: FXDataTarget.h:174
void connect(FXfloat &value)
Associate with float variable.
Definition: FXDataTarget.h:198
void connect(FXushort &value, FXObject *tgt, FXSelector sel)
Associate with unsigned short variable; also set target and message.
Definition: FXDataTarget.h:223
FXDataTarget(FXlong &value, FXObject *tgt=NULL, FXSelector sel=0)
Associate with long variable.
Definition: FXDataTarget.h:131
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:104
void connect(FXint &value)
Associate with int variable.
Definition: FXDataTarget.h:186
FXDataTarget(FXuint &value, FXObject *tgt=NULL, FXSelector sel=0)
Associate with unsigned int variable.
Definition: FXDataTarget.h:128
void * getData() const
Return pointer to data its connected to.
Definition: FXDataTarget.h:164
void connect(FXbool &value, FXObject *tgt, FXSelector sel)
Associate with character variable; also set target and message.
Definition: FXDataTarget.h:211
FXDataTarget(FXint &value, FXObject *tgt=NULL, FXSelector sel=0)
Associate with int variable.
Definition: FXDataTarget.h:125
void connect(FXchar &value, FXObject *tgt, FXSelector sel)
Associate with character variable; also set target and message.
Definition: FXDataTarget.h:214
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42
void connect(FXbool &value)
Associate with FXbool variable.
Definition: FXDataTarget.h:171

Copyright © 1997-2018 Jeroen van der Zijp