VR-Forces 4.3.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 
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 = "";
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 }

Document ID: Generated on Wed Jul 29 00:55:00 EDT 2015 from SVN revision 155257
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)