OpenASIP  2.0
EditPart.icc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file EditPart.icc
26  *
27  * Inline implementation of EditPart class.
28  *
29  * @author Ari Metsähalme 2004 (ari.metsahalme-no.spam-tut.fi)
30  * @note rating: yellow
31  * @note reviewed Jul 13 2004 by vpj, ll, jn, am
32  */
33 
34 #include "Application.hh"
35 
36 /**
37  * Returns the parent of this EditPart.
38  *
39  * @return Parent of this EditPart.
40  */
41 inline EditPart*
42 EditPart::parent() const {
43  return parent_;
44 }
45 
46 /**
47  * Sets the parent EditPart.
48  *
49  * @param parent New parent.
50  */
51 inline void
52 EditPart::setParent(EditPart* parent) {
53  parent_ = parent;
54 }
55 
56 /**
57  * Returns the model object corresponding to this EditPart.
58  *
59  * @return The model object corresponding to this EditPart.
60  */
61 inline TTAMachine::MachinePart*
62 EditPart::model() const {
63  return model_;
64 }
65 
66 /**
67  * Sets the corresponding model object.
68  *
69  * @param model New model object.
70  */
71 inline void
72 EditPart::setModel(TTAMachine::MachinePart* model) {
73  model_ = model;
74 }
75 
76 /**
77  * Returns the Figure of this EditPart.
78  *
79  * @return Figure of this EditPart.
80  */
81 inline Figure*
82 EditPart::figure() const {
83  return figure_;
84 }
85 
86 /**
87  * Sets the Figure.
88  *
89  * @param figure New Figure.
90  */
91 inline void
92 EditPart::setFigure(Figure* figure) {
93  figure_ = figure;
94 }
95 
96 /**
97  * Tells whether the EditPart is selectable or not.
98  *
99  * @return True if selectable, false otherwise.
100  */
101 inline bool
102 EditPart::selectable() const {
103  return selectable_;
104 }
105 
106 /**
107  * Tells if the EditPart is selected.
108  *
109  * @return True if selected.
110  */
111 inline bool
112 EditPart::selected() const {
113  return selected_;
114 }
115 
116 /**
117  * Sets selectability of the EditPart.
118  *
119  * @param selectable True if selectable, false otherwise.
120  */
121 inline void
122 EditPart::setSelectable(bool selectable) {
123  selectable_ = selectable;
124 }
125 
126 /**
127  * Sets selection status of the EditPart.
128  *
129  * @param select True to select, false to unselect.
130  */
131 inline void
132 EditPart::setSelected(bool select) {
133  selected_ = select;
134 }
135 
136 /**
137  * Returns the number of children.
138  *
139  * @return The number of child EditParts.
140  */
141 inline int
142 EditPart::childCount() const {
143  return children_.size();
144 }
145 
146 /**
147  * Returns the child corresponding to the given index.
148  *
149  * @param index Index of the child EditPart to return
150  * @return The child corresponding to the given index.
151  */
152 inline EditPart*
153 EditPart::child(unsigned int index) const {
154  assert(index < children_.size());
155  return children_[index];
156 }