VR-Forces 4.1 Class Documentation
uiElement.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2007 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: uiElement.h,v $ $Revision: 1.17 $ $State: Exp $
7 *********************************************************************/
8 
11 
12 #ifndef DTUIELEMENT_H_
13 #define DTUIELEMENT_H_
14 
15 #include "vrfutil/rdrWritr.h"
17 #include "vrfutil/rwString.h"
19 #include "vrfutil/rwBoolean.h"
20 #include "vrfutil/rwInt.h"
22 #include "vrfutil/callbackList.h"
24 
25 #include <QtCore/QObject>
26 #include <QtCore/QVariant>
27 
28 class QWidget;
29 class DtUiForParameter;
33 class DtModelSetEntry;
34 class DtUiElement;
35 class QWidget;
36 
38 
94 
97 {
98 public:
100  {
101  DtUiElementTypeUnknown = 0,
102  DtUiElementItemExpand = 1,
103  DtUiElementItemCollapse = 2,
104  DtUiElementHierarchySelectionChanged = 3,
105  DtUiElementSaveStateChanged = 4,
106  DtUiElementAddedToHierarchy = 5,
107  DtUiElementRemovedFromHierarchy = 6,
108  DtUiElementMovedInHierarchy = 7,
109  DtUiElementReplacedInHierarchy = 8,
110  DtUiElementForceChanged = 9,
111  DtUiElementConfigureDiGuyOn = 10,
112  DtUiElementConfigureDiGuyOff = 11,
113  DtUiElementPositionModified = 12,
114  DtUiElementPositionDestroyed = 13,
115  DtUiBoundingVolumeModified = 14,
116  DtUiCanvasInitialized = 15,
117  DtUiDiGuyDataChanged = 16,
118  DtUiRequestDiGuyData = 17,
119  DtUiDiGuyDataResponse = 18,
120  DtUiCreateController = 19,
121  DtUiCleanup = 20,
122  DtUiElementHierarchyChanged = 21
123  };
124 
125 public:
126  DtUiElementEvent(DtUiElement* owner= 0, DtUiElementEventTypes type = DtUiElementTypeUnknown) : myOwner(owner), myType(type) {};
127  DtUiElementEvent(const DtUiElementEvent& orig) : myOwner(orig.myOwner), myType(orig.myType), myValue(orig.myValue) {};
128 
129  DtUiElementEvent& operator=(const DtUiElementEvent& rhs) { myOwner = rhs.myOwner; myValue = rhs.myValue; myType = rhs.myType; return *this; };
130 
131  DtUiElement* owner() const { return myOwner; };
132  DtUiElementEventTypes type() const { return myType; };
133  void setType(DtUiElementEventTypes t) { myType = t; };
134  void setValue(const QVariant& val) { myValue = val; };
135  const QVariant& value() const { return myValue; };
136 
137 protected:
138  DtUiElement* myOwner;
139  QVariant myValue;
141 };
142 
144 {
145  Q_OBJECT
146 
147 public:
148  DtUiElementSignalHandler() : myParent(NULL) {};
149 
150  void setUiElement(DtUiElement* parent) { myParent = parent; };
151 
152 public slots:
153  virtual void elementChanged();
154 
156  virtual void sendEvent(const DtUiElementEvent&);
157 
158 signals:
159  void uiEvent(const DtUiElementEvent&);
160 
161 protected:
163 };
164 
166 {
167 public:
168 
171  (
172  const DtString& name,
173  DtReaderWriterRegistry* const parentRegistry = NULL
174  );
175 
177  virtual ~DtUiElement();
178 
180  DtUiElement(const DtUiElement& orig);
181 
183  DtUiElement& operator=(const DtUiElement& orig);
184 
185  virtual const DtString& objectName() const;
186 
187  virtual void setTitle(const DtString& s);
188  virtual void setObjectName(const DtString& s);
189 
190  virtual void mergeInto(DtUiForParameter*);
191  virtual DtUiElement* elementNamed(const DtString&);
192 
193  virtual bool mergeInto(const DtString& readerWriterName, bool after, DtUiElement* element);
194 
195  virtual void init();
196 
197  virtual DtString sourceReaderWriterName() const;
198  virtual void setSourceReaderWriterName(const DtString& name);
199 
200  virtual DtString displayUnits() const;
201  virtual void setDisplayUnits(const DtString& units);
202 
203  virtual DtString sourceUnits() const;
204  virtual void setSourceUnits(const DtString& units);
205 
206  virtual DtString tooltip() const;
207  virtual void setTooltip(const DtString& text);
208 
211  virtual void setFromSystemParameterData(const DtSystemParameterData* data);
212 
217  virtual void objectParametersModified() {};
218 
220  virtual void processUiEvent(const DtUiElementEvent&) {};
221 
222  DtReaderWriterRegistryData* value() const;
223  DtReaderWriterRegistryData* backupValue() const;
224 
226  virtual void initForControls();
227 
229  virtual void setModelModified(DtModelSetEntry*);
230 
231  DtUiElementSignalHandler* signalHandler() { return &mySignalHandler; };
232 
234  virtual void uiState(QMap<QString, QVariant>& state) const;
235  virtual void setUiState(const QMap<QString, QVariant>&);
236 
238  virtual void sendUpdatedUiState();
239 
240 public:
242  static void registerUiTypes();
243  static DtUiElement* createUiElement(const DtString& type, const DtString& name,
244  DtReaderWriterRegistry* parentRegistry = NULL);
245 
246 public:
247  virtual DtUiElement* clone() = 0;
248  virtual bool isModified() const;
249 
252  virtual void decorateElement();
253 
256  virtual QWidget* createLabelWidget(QWidget* parent);
258  virtual QWidget* createControls(QWidget* parent);
259  virtual void setFromParameters(DtReaderWriter* parentRw);
260  virtual void elementChanged();
261 
262  virtual void addElementChangedCallback(DtElementChangedCallbackFcn f, void* usr);
263  virtual void removeElementChangedCallback(DtElementChangedCallbackFcn f, void* usr);
264  virtual void removeAllCallbacks();
265 
269  virtual DtReaderWriterRegistryData* createBackup(const DtString& backupName);
273  virtual bool restoreFromBackup(const DtString& backupName, bool deleteBackup = false);
276  virtual void deleteBackup(const DtString& backupName);
277 
278  const DtCallbackList<DtUiElement*>& elementChangedCallbackList() const;
279  void setElementChangedCallbackList(const DtCallbackList<DtUiElement*>&);
280 
283  virtual DtReaderWriterRegistryData* value(DtReaderWriter* parentRw);
284  virtual DtReaderWriterRegistryData* value(DtReaderWriter* parentRw, const DtString& rw,
285  DtReaderWriterRegistryData** backupValue) const;
286 
287  static DtReaderWriterFactory* elementFactory();
288 
290  virtual bool centerElement() const;
291 
293  virtual void finalizeSize(QWidget*);
294 
295 protected:
297  virtual QWidget* createDataEntryElement(QWidget*);
298 
299  virtual double sourceToDestination(double) const;
300  virtual double destinationToSource(double) const;
301 
302  virtual QString units() const;
303 
304 protected:
320  bool myIsNew;
322  //DtElementChangedCallbackFcn myElementChangedCallback;
324  //void* myUserVariable;
327 
329 };
330 
332 {
334 }
335 
337 {
339 }
340 
342 {
343  return myValue;
344 }
345 
347 {
348  return myBackupValue;
349 }
350 
351 #endif

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)