VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtMenuPath.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2008 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: DtMenuPath.h,v $ $Revision: 1.9 $ $State: Exp $
7 ******************************************************************************/
8 
12 
13 #ifndef DtMenuPath_H_
14 #define DtMenuPath_H_
15 
16 #include <vrvCore/vrvCore.h>
17 #include <string>
18 
19 namespace makVrv
20 {
21 
31  {
32  public:
33 
34  //Internal class which is used to ensure that it is not possible to incorrectly
35  //build a menu path.
37  {
38  public:
39  friend class DtMenuPath;
40 
41  //Add a menu to the path.
42  MenuPathBuilder menu(const std::string& name) const;
43 
46  DtMenuPath item(const std::string& name) const;
47 
50  DtMenuPath operator/(const std::string& name) const;
51 
53  DtMenuPath separator(const std::string& name) const;
54 
55  protected:
56 
57  //Access the path.
58  inline const std::string& path() const { return myPath; }
59 
60  //The CTOR this class is automatically created by the DtMenuPath.
61  MenuPathBuilder(const std::string& name);
62 
63  std::string myPath;
64  };
65 
66  //Useful CTOR.
67  DtMenuPath(const MenuPathBuilder& builder);
68 
70  DtMenuPath(const DtMenuPath& copy);
71 
72  //Create an empty menu path.
73  static DtMenuPath empty();
74 
75  //Create an empty root menu path.
76  static DtMenuPath root();
77 
78  //Create an empty popup menu path.
79  static DtMenuPath popup();
80 
81  //Start a main menu.
82  static MenuPathBuilder mainMenu(const std::string& name);
83 
84  //Start a popup menu.
85  static MenuPathBuilder popupMenu( const std::string& name );
86 
87  //Start a relative menu.
88  static MenuPathBuilder menu(const std::string& name);
89 
90  //Get the current path.
91  inline const std::string& path() const { return myPath; }
92 
95  DtMenuPath menuPart() const;
96 
99  DtMenuPath parentMenu() const;
100 
102  DtMenuPath rootParentMenu() const;
103 
106  std::string name() const;
107 
109  bool isEmpty() const;
110 
112  bool isAbsolutePath() const;
113 
115  bool isMainMenu() const;
116 
118  bool isPopupPath() const;
119 
121  bool isMenu() const;
122 
124  bool isItem() const;
125 
127  bool isChildOf(const DtMenuPath& parent) const;
128 
130  bool isDescendant(const DtMenuPath& ancestor) const;
131 
133  bool isSiblingOf(const DtMenuPath& sibling) const;
134 
136  bool isSeparator() const;
137 
138  bool operator ==(const DtMenuPath& other) const;
139  bool operator <(const DtMenuPath& other) const;
140  bool operator !=(const DtMenuPath& other) const;
141 
142  protected:
143 
145  DtMenuPath(const std::string& path);
146 
148  std::string myPath;
149  };
150 
151 
152 }
153 
154 #endif
155 

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)