~peppujols/stellarium/printsky

« back to all changes in this revision

Viewing changes to plugins/TextUserInterface/src/TuiNode.hpp

  • Committer: Pep Pujols
  • Date: 2012-02-17 14:58:45 UTC
  • mfrom: (4722.1.5 printsky)
  • Revision ID: maslarocaxica@gmail.com-20120217145845-fo4jextrb9z83sbb
Merge from code refactoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 *
14
14
 * You should have received a copy of the GNU General Public License
15
15
 * along with this program; if not, write to the Free Software
16
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
16
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
17
17
 */
18
18
 
19
19
#ifndef _TUINODE_HPP_
21
21
 
22
22
#include <QObject>
23
23
#include <QString>
 
24
#include <QList>
24
25
 
25
26
//! @struct TuiNodeResponse
26
27
//! A TuiNodeResponse contains a flag, "accepted" if a keystroke was accepted
52
53
        virtual TuiNodeResponse navigation(int key);
53
54
        virtual QString getDisplayText();
54
55
        virtual TuiNode* getParentNode() {return parentNode;}
55
 
        virtual void setParentNode(TuiNode* n) {parentNode=n;}
 
56
        virtual void setParentNode(TuiNode* n) {parentNode=n; updateNodeNumber();}
56
57
        virtual TuiNode* getChildNode() {return childNode;}
57
58
        virtual void setChildNode(TuiNode* n) {childNode=n;}
58
59
        virtual TuiNode* getPrevNode() {return prevNode;}
59
 
        virtual void setPrevNode(TuiNode* n) {prevNode=n;}
 
60
        virtual void setPrevNode(TuiNode* n) {prevNode=n; updateNodeNumber();}
60
61
        virtual TuiNode* getNextNode() {return nextNode;}
61
62
        virtual void setNextNode(TuiNode* n) {nextNode=n;}
 
63
        //! Set prevNode to the last of the chain of nextNode-s.
 
64
        //! Call for the first node of a menu after all others have been added.
 
65
        virtual void loopToTheLast();
 
66
        
 
67
        int getNodeNumber() {return nodeNumber;}
 
68
        QList<int> getAncestorsNumbers() {return ancestorsNumbers;}
62
69
 
63
70
protected:      
64
71
        TuiNode* parentNode;
65
72
        TuiNode* childNode;
66
73
        TuiNode* prevNode;
67
74
        TuiNode* nextNode;
 
75
        //! Text of the prefix containing the hierarchical node number.
 
76
        QString prefixText;
68
77
        QString displayText;
 
78
        //! Number of the node in the current menu.
 
79
        //! Automatically set to 1 if there is no prevNode.
 
80
        int nodeNumber;
 
81
        //! Contains the numbers of the parent nodes in the hierarchy.
 
82
        //! The last element is the number of the node in the current menu.
 
83
        QList<int> ancestorsNumbers;
 
84
        //! Updates nodeNumber, ancestorNumbers and prefixText.
 
85
        void updateNodeNumber();
69
86
};
70
87
 
71
88
#endif /* _TUINODE_HPP_ */