VR-Forces 4.1.1 Class Documentation
DtToolbarConfiguration.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2010 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: DtToolbarConfiguration.h,v $ $Revision: 1.9 $ $State: Exp $
7 ******************************************************************************/
8 
12 
13 #pragma once
14 
15 #include <vrvCore/vrvCore.h>
16 #include <vrvCore/DtToolbarPath.h>
17 #include <vrvCore/DtMenuPath.h>
19 
20 #include <list>
21 #include <set>
22 #include <boost/serialization/set.hpp>
23 
24 namespace makVrv
25 {
29  {
30  public:
31 
32  typedef std::list<DtToolbarPath> ToolbarPathList;
33  typedef std::set<DtToolbarPath> ToolbarPathSet;
34 
36  {
37  DockLeft = 0,
38  DockRight = 1,
39  DockTop = 2,
40  DockBottom = 3,
41  DockNone = 4
42  };
43 
45  {
46  int windowId;
47  int myTop;
48  int myLeft;
49  int myHeight;
50  int myWidth;
51 
53  {
54  windowId = -1;
55  myTop = 0;
56  myLeft = 0;
57  myWidth = 0;
58  myHeight = 0;
59  }
60 
61  template<class Archive>
62  void serialize(Archive & ar, const unsigned int version)
63  {
64  ar & DT_SERIALIZE_MEMBER(windowId);
65  ar & DT_SERIALIZE_MEMBER(myTop);
66  ar & DT_SERIALIZE_MEMBER(myLeft);
67  ar & DT_SERIALIZE_MEMBER(myHeight);
68  ar & DT_SERIALIZE_MEMBER(myWidth);
69  }
70  };
71 
72  struct ToolbarState
73  {
78 
79  template<class Archive>
80  void serialize(Archive & ar, const unsigned int version)
81  {
82  ar & DT_SERIALIZE_MEMBER(myIsVisible);
83  ar & DT_SERIALIZE_MEMBER(myIsFloating);
84  ar & DT_SERIALIZE_MEMBER(myLocation);
85  ar & DT_SERIALIZE_MEMBER(myGeometry);
86  }
87  };
88 
89  public:
90 
91  typedef std::map<DtToolbarPath,ToolbarState> ToolbarStateMap;
92 
95 
98 
100  void addToolbarPath(const DtToolbarPath&, int weight = -1);
101 
102  void addToolbarPathAfter(const DtToolbarPath& newPath, const DtToolbarPath& relativeTo);
103  void addToolbarPathBefore(const DtToolbarPath& newPath, const DtToolbarPath& relativeTo);
104 
106  void addMenuPath(const DtMenuPath&, int weight = -1);
107 
108  void addMenuPathAfter(const DtMenuPath& newPath, const DtMenuPath& relativeTo);
109  void addMenuPathBefore(const DtMenuPath& newPath, const DtMenuPath& relativeTo);
110  void removeMenuPath(const DtMenuPath& newPath);
111 
113  void addConfiguration(const DtToolbarConfiguration& subConfiguration);
114 
116  void removeToolbarPath(const DtToolbarPath&);
117 
119  void getRootPaths(ToolbarPathList& children) const;
120 
121  void getChildren(const DtToolbarPath& path, ToolbarPathList& children) const;
122 
124  void sortChildren(ToolbarPathList& children) const;
125 
127  int getNewWeight();
128 
130  {
131  if (this != &rhs)
132  {
133  myToolbarPaths = rhs.myToolbarPaths;
134  myToolbarOrder = rhs.myToolbarOrder;
135  myCurrentWeight = rhs.myCurrentWeight;
136  myMenuConfiguration = rhs.myMenuConfiguration;
137  }
138 
139  return *this;
140  }
141 
145  const DtMenuConfiguration& menuConfiguration() const
146  {
147  return myMenuConfiguration;
148  }
149 
152  void merge(const DtToolbarConfiguration& rhs);
153 
156  void copyValuesFrom( const DtToolbarConfiguration& source );
157 
158 
161  void updateState(const DtToolbarPath& tb, ToolbarState& state);
162 
164  const ToolbarState* state(const DtToolbarPath& tb) const;
165 
167  const ToolbarStateMap& states() const;
168 
170  void setVisible( const DtToolbarPath& tb, bool isVisible );
171 
173 
174  protected:
175 
176  template<class Archive>
177  void _serialize(Archive & ar, const unsigned int version)
178  {
181  ar & DT_SERIALIZE_MEMBER(myToolbarStates);
182  }
183 
184  bool sortAbsolute(const DtToolbarPath& a, const DtToolbarPath& b) const;
185 
187  {
189  : orderWeight(0)
190  , relative(DtToolbarPath::empty())
191  , beforeRelative(false)
192  {
193  }
194 
198  };
199 
200  typedef std::map<DtToolbarPath,OrderParameters> ToolbarPathOrderMap;
201 
208  };
209 }
210 

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)