VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
uiElement.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2013 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 
8 
9 #pragma once
10 
11 #if !defined(Q_MOC_RUN)
15 #include <readerWriter/rwString.h>
17 #include <readerWriter/rwBoolean.h>
18 #include <readerWriter/rwInt.h>
21 #endif
22 
23 #include <QtCore/QObject>
24 #include <QtCore/QVariant>
25 #include <boost/function.hpp>
26 #include <boost/bind.hpp>
27 
28 class QWidget;
29 class DtUiForParameter;
33 class DtModelSetEntry;
34 class DtUiElement;
35 class QWidget;
36 class QCheckBox;
37 class QLabel;
39 
40 typedef boost::function<void (DtUiElement*)> DtElementChangedCallbackFcn;
41 
90 
93 {
94 public:
96  {
97  DtUiElementTypeUnknown = 0,
98  DtUiElementItemExpand = 1,
99  DtUiElementItemCollapse = 2,
100  DtUiElementHierarchySelectionChanged = 3,
101  DtUiElementAddedToHierarchy = 5,
102  DtUiElementRemovedFromHierarchy = 6,
103  DtUiElementMovedInHierarchy = 7,
104  DtUiElementReplacedInHierarchy = 8,
105  DtUiElementForceChanged = 9,
106  DtUiElementPositionModified = 12,
107  DtUiElementPositionDestroyed = 13,
108  DtUiBoundingVolumeModified = 14,
109  DtUiCanvasInitialized = 15,
110  DtUiCreateController = 19,
111  DtUiCleanup = 20,
112  DtUiElementHierarchyChanged = 21,
113  DtUiEnterEditMode = 22,
114  DtUiLeaveEditMode = 23,
115  DtUiSupportPointsModified = 24,
116  DtUiPreSaveEvent = 25,
117  DtSystemsRemoved = 26,
118  DtUiSuportPointsCalculated = 27,
119  DtUiBoundingVolumeCalculated = 28,
120  DtUiCalculateBoundingVolume = 29,
121  DtUiCalculateSupportPoints = 30,
122  DtUiMarkingChanged = 31,
123  DtUiChangeTrailEffect = 32,
124  DtUiStartSimulation = 33,
125  DtUiSetSpeedPercentage = 34,
126  DtUiSystemParameterDataChanged = 35,
127  DtUiAffectGui = 36,
128  DtUiDetonationPowerChanged = 37,
129  DtUiDamageTableChanged = 38,
130  DtUiHitTableChanged = 39,
131  DtUiElementDataChanged = 40,
132  DtUiAmmunitionChanged = 41,
133  DtUiHealthFix = 42,
134  DtUiIconListsChanged = 43,
135  DtUiSystemEvent = 44,
136  DtArtPartUpdated = 45,
137  DtArtPartAssociated = 46,
138  DtUiAccept = 47
139  };
140 
141 public:
142  DtUiElementEvent(DtUiElement* owner= 0, DtUiElementEventTypes type = DtUiElementTypeUnknown) : myOwner(owner), myType(type) {};
143  DtUiElementEvent(const DtUiElementEvent& orig) : myOwner(orig.myOwner), myType(orig.myType), myValue(orig.myValue) {};
144 
145  DtUiElementEvent& operator=(const DtUiElementEvent& rhs) { myOwner = rhs.myOwner; myValue = rhs.myValue; myType = rhs.myType; return *this; };
146 
147  DtUiElement* owner() const { return myOwner; };
148  DtUiElementEventTypes type() const { return myType; };
149  void setType(DtUiElementEventTypes t) { myType = t; };
150  void setValue(const QVariant& val) { myValue = val; };
151  const QVariant& value() const { return myValue; };
152 
153 protected:
154  DtUiElement* myOwner;
155  QVariant myValue;
157 };
158 
168 
170 {
171  Q_OBJECT
172 
173 public:
174  typedef boost::function<DtUiElement* (makVrv::DtDe&)> CreatorFunction;
175  typedef std::map<std::string, CreatorFunction> UiElementFactoryMap;
176 
179  (
180  makVrv::DtDe&
181  );
182 
184  virtual ~DtUiElement();
185 
186  virtual bool blockSignals(bool);
187 
188  virtual void init(QWidget* widget, QWidget* label, DtReaderWriter* originalData, DtReaderWriter* backupData,
190 
191  virtual void init(QWidget* widget, QWidget* label, const std::vector<DtReaderWriter*>& originalData,
192  const std::vector<DtReaderWriter*>& backupData,
194 
195  virtual void init(QWidget* widget, QWidget* label, const DtObjectType&, const DtString& platformType,
197 
198  virtual DtString displayUnits() const;
199  virtual void setDisplayUnits(const DtString& units);
200 
201  virtual void setLabelText(const QString&);
202 
203  virtual DtString sourceUnits() const;
204  virtual void setSourceUnits(const DtString& units);
205 
208  virtual void setFromSystemParameterData(const DtSystemParameterData* data, const DtComponentSystemDefinition*);
209 
214  virtual void objectParametersModified() {};
215 
217  virtual void connectedTo(QObject*);
218 
220  virtual void processUiEvent(const DtUiElementEvent&) {};
221 
223  virtual void setModelModified(DtModelSetEntry*);
224 
227  virtual DtString uniqueName() const;
228 
230  virtual bool supportsSystems() const;
231 
233  virtual const DtString& platformType() const;
234 
236  virtual void setPlatformType(const DtString&);
237 
239  virtual void setObjectTypes(const std::vector<DtObjectType>&);
240 
242  virtual void aboutToShow();
243 
244  const std::vector<DtReaderWriter*>& values() const { return myValues; };
245  const std::vector<DtReaderWriter*>& backupValues() const { return myBackupValues; };
246 
247 public:
249  static void registerUiTypes();
250  static DtUiElement* createUiElement(makVrv::DtDe&, const DtString& type);
251  static bool hasCreator(const DtString&);
252 
253  static void theNullFunction(DtUiElement*);
254 
255 public:
256  virtual bool isModified() const;
257 
260  virtual bool isValid() const;
261 
264  virtual void decorateElement();
265 
267  virtual void setFromParameters(DtReaderWriter* parentRw);
268 
271  virtual void setFromParameters(const std::vector<DtComponentSystemDefinition*>&);
272 
273  virtual void setFromParameters(const std::vector<DtReaderWriter*>& parentRw);
274 
278  virtual bool restoreFromBackup();
279 
281  {
282  return theFactory;
283  }
284 
285  const std::vector<DtObjectType>& objectTypes() const
286  {
287  return myObjectTypes;
288  }
289 
290  const std::vector<DtComponentSystemDefinition*>& systems() const
291  {
292  return mySystems;
293  }
294 
295  virtual void sendEvent(const DtUiElementEvent&);
296 
297  virtual bool allValuesTheSame() const;
298 
299  static QString mixedText();
300  static void setMixedText(const QString&);
301 
304  virtual bool isMixedValue() const;
305 
307  virtual void setEnabled(bool);
308  virtual bool enabled() const;
309 
310  virtual void setControllingCheckBox(QCheckBox*);
312  {
313  return myControllingCheckBox;
314  }
315 
316 public slots:
317  virtual void toggleDisplayed(bool display);
318 
319 protected slots:
320  virtual void elementChanged();
321 
325  virtual void enableIfChecked();
326 
330  virtual void disableIfChecked();
331 
332 signals:
333  void uiEvent(const DtUiElementEvent&);
334  void changed();
335 
336 protected:
337 
338  virtual double sourceToDisplayUnits(double) const;
339  virtual double displayToSourceUnits(double) const;
340 
341  virtual QString units() const;
342 
344  virtual void updateLabelTitle();
345 
347  virtual QString labelTitle() const;
348 
350  virtual void createControls(QWidget* parent);
351 
352 public:
353  QWidget* myWidget;
354  QWidget* myLabel;
355 
356 protected:
358 
361 
363  std::vector<DtReaderWriter*> myValues;
364  std::vector<DtReaderWriter*> myBackupValues;
365  bool myIsNew;
370 
372  std::vector<DtObjectType> myObjectTypes;
373  std::vector<DtComponentSystemDefinition*> mySystems;
374 
376 
377  bool myEnabled;
378 
379  std::vector<QObject*> myConnectedTo;
382 };
Instances of DtVrfObjectParameters are the readable/writeable objects that contain the information ne...
Definition: vrfObjectParameters.h:59
const std::vector< DtReaderWriter * > & backupValues() const
Definition: uiElement.h:245
QVariant myValue
Definition: uiElement.h:155
QWidget * myLabel
Definition: uiElement.h:354
DtUnit mySource
Definition: uiElement.h:367
const std::vector< DtObjectType > & objectTypes() const
Definition: uiElement.h:285
bool myIsNew
Definition: uiElement.h:365
const QVariant & value() const
Definition: uiElement.h:151
Definition: readerWriterRegistryData.h:25
DtUiElementEventTypes
Definition: uiElement.h:95
DtElementChangedCallbackFcn myElementChangedCallbackFunction
Definition: uiElement.h:366
int myUniqueId
Definition: uiElement.h:380
static UiElementFactoryMap & elementFactory()
Definition: uiElement.h:280
virtual void processUiEvent(const DtUiElementEvent &)
Process ui event. Default does nothing.
Definition: uiElement.h:220
Definition: uiForParameter.h:27
Definition: readerWriter.h:85
DtString mySourceUnits
Definition: uiElement.h:360
QCheckBox * controllingCheckBox()
Definition: uiElement.h:311
boost::function< DtUiElement *(makVrv::DtDe &)> CreatorFunction
Definition: uiElement.h:174
DtUiElementEvent(const DtUiElementEvent &orig)
Definition: uiElement.h:143
Definition: unitConversions.h:314
QCheckBox * myControllingCheckBox
Definition: uiElement.h:381
DtUiElementEventTypes myType
Definition: uiElement.h:156
DtUiElement * myOwner
Definition: uiElement.h:151
Definition: objectType.h:27
DtComponentSystemDefinition.
Definition: componentSystemDefinition.h:25
QWidget * myWidget
Definition: uiElement.h:353
Description: A model is a set of items that defines a model to create in the back-end from the front-...
Definition: modelSetEntry.h:24
std::map< std::string, CreatorFunction > UiElementFactoryMap
Definition: uiElement.h:175
binderNoArgs< _Fn > bind(const _Fn &_Func, const _Ty &_Left)
Definition: DtSTLUtilities.h:76
boost::function< void(DtUiElement *)> DtElementChangedCallbackFcn
Definition: uiElement.h:38
virtual void objectParametersModified()
This method is called any time that any of the parameters for the object are modified.
Definition: uiElement.h:214
const std::vector< DtComponentSystemDefinition * > & systems() const
Definition: uiElement.h:290
const DtComponentSystemDefinition * mySystemDefinition
Definition: uiElement.h:375
std::vector< DtObjectType > myObjectTypes
Definition: uiElement.h:372
DtString myPlatformType
Definition: uiElement.h:371
Base class for RW objects that describe a system parameter.
Definition: systemParameterData.h:30
DtUiElementEvent & operator=(const DtUiElementEvent &rhs)
Definition: uiElement.h:145
DtUiElementEventTypes type() const
Definition: uiElement.h:148
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
DtUnit myDestination
Definition: uiElement.h:368
std::vector< DtReaderWriter * > myValues
Assumes 1 - 1 order that original and backup are same index in lists.
Definition: uiElement.h:363
static void theNullFunction(DtUiElement *)
bool myEnabled
Definition: uiElement.h:377
The DtUiElement class is the base for which all UI elements are defined.
Definition: uiElement.h:92
std::vector< DtComponentSystemDefinition * > mySystems
Definition: uiElement.h:373
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
std::vector< DtReaderWriter * > myBackupValues
Definition: uiElement.h:364
void setType(DtUiElementEventTypes t)
Definition: uiElement.h:149
std::vector< QObject * > myConnectedTo
Definition: uiElement.h:379
static UiElementFactoryMap theFactory
Definition: uiElement.h:357
const std::vector< DtReaderWriter * > & values() const
Definition: uiElement.h:244
void setValue(const QVariant &val)
Definition: uiElement.h:150
DtUiElement * owner() const
Definition: uiElement.h:147
DtUiElementEvent(DtUiElement *owner=0, DtUiElementEventTypes type=DtUiElementTypeUnknown)
Definition: uiElement.h:142
#define DT_DLL_simulationObjectEditorimpl
This file is used to determine how to build.
Definition: simulationObjectEditorImplDefines.h:32
Base class of the ui element class chain.
Definition: uiElement.h:169
DtString myDisplayUnits
Definition: uiElement.h:359
makVrv::DtDe & myDe
Definition: uiElement.h:369

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)