VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtPageConfiguration.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/vrvCore.h>
13 #include <vrvCore/DtPagePath.h>
15 #include <vrvUtil/DtUnicode.h>
16 #include <boost/unordered_map.hpp>
17 #include <list>
18 #include <set>
19 #include <boost/serialization/set.hpp>
20 
21 namespace makVrv
22 {
26  {
27 
28  public:
29 
30  typedef std::list<DtPagePath> PagePathList;
31  typedef std::set<DtPagePath> PagePathSet;
32 
35 
37  virtual ~DtPageConfiguration();
38 
40  DtPageConfiguration& operator=(const DtPageConfiguration& rhs);
41 
43  {
44  DockLeft = 0,
45  DockRight = 1,
46  DockTop = 2,
47  DockBottom = 3,
48  FloatLeft = DockLeft | 4,
49  FloatRight = DockRight | 4,
50  FloatTop = DockTop | 4,
51  FloatBottom = DockBottom | 4,
53  Location_End
54  };
55 
57  {
59  int myTop;
60  int myLeft;
61  int myWidth;
62  int myHeight;
63 
65  {
66  myWindowId = -1;
67  myTop = 10;
68  myLeft = 10;
69  myWidth = 10;
70  myHeight = 10;
71  }
72 
73  template<class Archive>
74  void serialize(Archive & ar, const unsigned int version)
75  {
76  ar & DT_SERIALIZE_MEMBER(myTop);
77  ar & DT_SERIALIZE_MEMBER(myLeft);
78  ar & DT_SERIALIZE_MEMBER(myWidth);
79  ar & DT_SERIALIZE_MEMBER(myHeight);
80  }
81  };
82 
84  {
85  DtUnicode myTitle; // deprecated. Title is NOT state
91  std::string myPageToShow;
92  bool myClosable;
94  bool myMovable;
95 
97  {
98  myLocation = DtPageConfiguration::DockLeft;
99  myVisibleFlag = true;
100  myClosable = true;
101  myFloatable = true;
102  myMovable = true;
103  myTabIndex = -1;
104  myPageToShow.clear();
105  }
106 
107  template<class Archive>
108  void serialize(Archive & ar, const unsigned int version)
109  {
110  // Name of temporary variable is very important here for
111  // serializarion/deserialization. That name is used to define
112  // the xml tag inside the record! Do not change it!
113  if ( version < 1 )
114  {
115  std::string myLocalTitle;
116  myTitle.toUtf8(myLocalTitle);
117  ar & DT_SERIALIZE_MEMBER(myLocalTitle);
118  myTitle = DtUnicode::fromUtf8(myLocalTitle);
119  }
120  ar & DT_SERIALIZE_MEMBER(myLocation);
121  ar & DT_SERIALIZE_MEMBER(myDockedGeometry);
122  ar & DT_SERIALIZE_MEMBER(myFloatingGeometry);
123  ar & DT_SERIALIZE_MEMBER(myVisibleFlag);
124  ar & DT_SERIALIZE_MEMBER(myPageToShow);
125  ar & DT_SERIALIZE_MEMBER(myTabIndex);
126  if ( version > 1 )
127  {
128  ar & DT_SERIALIZE_MEMBER(myClosable);
129  ar & DT_SERIALIZE_MEMBER(myFloatable);
130  ar & DT_SERIALIZE_MEMBER(myMovable);
131  }
132  }
133  };
134 
135  typedef std::map<std::string,PageCollectionState> PageCollectionStatesMap;
136  typedef std::map<std::string,DtUnicode> PageCollectionTitlesMap;
137 
139  void addPageCollection(const std::string& collectionClassName,
140  const DtUnicode& pageTitle, PageCollectionLocation location,
141  bool visible, const std::string& pageClassToShow, bool closable = true,
142  bool floatable = true, bool movable = true);
143 
145  void removePageCollection(const std::string& collectionClassName);
146 
150  const PageCollectionState* findPageCollectionState(const std::string& collectionClassName) const;
151  PageCollectionState* findPageCollectionState(const std::string& collectionClassName);
152 
154  const bool isPageVisible(const std::string& pageName) const;
155 
159  const DtUnicode* findPageCollectionTitle(const std::string& collectionClassName) const;
160  DtUnicode* findPageCollectionTitle(const std::string& collectionClassName);
161 
163  void addPagePath(const DtPagePath&, int weight = -1);
164 
168  void addPagePathAfter(const DtPagePath& newPath, const DtPagePath& relativeTo);
169 
171  void addPagePathBefore(const DtPagePath& newPath, const DtPagePath& relativeTo);
172 
174  void addConfiguration(const DtPageConfiguration& subConfiguration);
175 
177  void removePagePath(const DtPagePath&);
178 
180  void getRootPaths(PagePathList& children) const;
181 
190  void getChildren(const DtPagePath& path, PagePathList& children) const;
191 
193  void sortChildren(PagePathList& children) const;
194 
196  virtual PagePathList filterForAbsoluteChildren( const PagePathList &children ) const;
197 
199  virtual PagePathList filterForRelativeChildren( const PagePathList &children ) const;
200 
202  int getNewWeight();
203 
206  void merge(const DtPageConfiguration& rhs);
207 
210  void copyValuesFrom( const DtPageConfiguration& source );
211 
213  bool hasPagePath(const DtPagePath& p) const;
214 
216  const PageCollectionStatesMap& states() const;
217 
219  const PageCollectionTitlesMap& titles() const;
220 
227  protected:
228 
229  template<class Archive>
230  void _serialize(Archive & ar, const unsigned int version)
231  {
234  ar & DT_SERIALIZE_MEMBER(myCurrentWeight);
235  ar & DT_SERIALIZE_MEMBER(myCollections);
236  ar & DT_SERIALIZE_MEMBER(myPagePaths);
237  ar & DT_SERIALIZE_MEMBER(myPageOrder);
238  }
239 
241  bool comparePagesByPageOrder(const DtPagePath& a, const DtPagePath& b) const;
242 
244  {
246  : orderWeight(0)
247  , relative(DtPagePath::empty())
248  , beforeRelative(false)
249  {
250  }
251 
252  template<class Archive>
253  void serialize(Archive & ar, const unsigned int version)
254  {
255  ar & DT_SERIALIZE_MEMBER(orderWeight);
256  ar & DT_SERIALIZE_MEMBER(relative);
257  ar & DT_SERIALIZE_MEMBER(beforeRelative);
258  }
259 
263  };
264 
269  virtual const OrderParameters& pageOrderFor(const DtPagePath& pagePath) const;
270 
271  protected:
272 
273  typedef std::map<DtPagePath,OrderParameters> PagePathOrderMap;
274 
280  };
281 }
std::list< DtPagePath > PagePathList
Definition: DtPageConfiguration.h:30
int myLeft
Definition: DtPageConfiguration.h:60
bool beforeRelative
Definition: DtPageConfiguration.h:262
OrderParameters()
Definition: DtPageConfiguration.h:245
BOOST_CLASS_VERSION(makArchives::DtDiGuySettingsRecord, 3)
A unicode string.
Definition: DtUnicode.h:33
#define DT_SERIALIZE_BASE(BASE_CLASS)
Serialize the base class implementation.
Definition: DtSerialize.h:161
Definition: DtPageConfiguration.h:83
Contains makVrv::DtPagePath class.
int myTop
Definition: DtPageConfiguration.h:59
PageCollectionLocation
Definition: DtPageConfiguration.h:42
int myCurrentWeight
Definition: DtPageConfiguration.h:279
std::map< DtPagePath, OrderParameters > PagePathOrderMap
Definition: DtPageConfiguration.h:273
PagePathSet myPagePaths
Definition: DtPageConfiguration.h:275
Definition: DtPageConfiguration.h:56
int myTabIndex
Definition: DtPageConfiguration.h:90
std::map< std::string, PageCollectionState > PageCollectionStatesMap
Definition: DtPageConfiguration.h:135
void serialize(Archive &ar, const unsigned int version)
Definition: DtPageConfiguration.h:74
bool myFloatable
Definition: DtPageConfiguration.h:93
PagePathOrderMap myPageOrder
Definition: DtPageConfiguration.h:276
bool myVisibleFlag
Definition: DtPageConfiguration.h:89
Definition: DtPageConfiguration.h:243
PageCollectionGeometry myFloatingGeometry
Definition: DtPageConfiguration.h:87
static DtUnicode fromUtf8(const unsigned char *utf8, int len=-1)
Create a unicode string from an UTF-16 encoded string, the string MUST be zero terminated if the leng...
PageCollectionGeometry myDockedGeometry
Definition: DtPageConfiguration.h:88
void serialize(Archive &ar, const unsigned int version)
Definition: DtPageConfiguration.h:253
#define DT_DECLARE_serialize_FUNCTIONS
Declare all the serialize functions to use.
Definition: DtSerialize.h:120
int myWindowId
Definition: DtPageConfiguration.h:58
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
PageCollectionTitlesMap myPageCollectionTitles
Definition: DtPageConfiguration.h:278
A configuration of the pages in the gui.
Definition: DtPageConfiguration.h:25
bool myClosable
Definition: DtPageConfiguration.h:92
void _serialize(Archive &ar, const unsigned int version)
Declare serialize functions Call via serialize(Archive ar, unsigned int version); Where Archive can b...
Definition: DtPageConfiguration.h:230
std::map< std::string, DtUnicode > PageCollectionTitlesMap
Definition: DtPageConfiguration.h:136
const char * source
Definition: lz4.h:442
DtUnicode myTitle
Definition: DtPageConfiguration.h:85
std::set< DtPagePath > PagePathSet
Definition: DtPageConfiguration.h:31
Contains makVrv::DtConfiguration class.
A page path is the location of a page based upon its parents.
Definition: DtPagePath.h:21
PageCollectionState()
Definition: DtPageConfiguration.h:96
void serialize(Archive &ar, const unsigned int version)
Definition: DtPageConfiguration.h:108
int myWidth
Definition: DtPageConfiguration.h:61
bool myMovable
Definition: DtPageConfiguration.h:94
The base implementation of a configuration.
Definition: DtConfiguration.h:24
int orderWeight
Definition: DtPageConfiguration.h:260
PageCollectionStatesMap myCollections
Definition: DtPageConfiguration.h:277
Definition: DtPageConfiguration.h:44
#define DT_SERIALIZE_MEMBER(NAME)
Serialize a Member whose name starts with &#39;my&#39; If your member does not have that name, use Dt_SERIALIZE.
Definition: DtSerialize.h:158
std::string myPageToShow
Definition: DtPageConfiguration.h:91
PageCollectionGeometry()
Definition: DtPageConfiguration.h:64
DtPagePath relative
Definition: DtPageConfiguration.h:261
Definition: DtPageConfiguration.h:52
PageCollectionLocation myLocation
Definition: DtPageConfiguration.h:86
int myHeight
Definition: DtPageConfiguration.h:62
Contains DLL export macros.

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)