OpenASIP  2.0
Figure.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 Figure.icc
26  *
27  * Inline implementation of Figure class.
28  *
29  * @author Ari Metsähalme 2004 (ari.metsahalme-no.spam-tut.fi)
30  * @note rating: yellow
31  * @note reviewed Jul 22 2004 by tr, ml, jm, am
32  */
33 
34 #include <iostream>
35 using std::cerr;
36 using std::endl;
37 
38 /**
39  * Returns the top-left location of the Figure's bounding rectangle.
40  *
41  * @return The top-left location of the Figure's bounding rectangle.
42  */
43 inline wxPoint
44 Figure::location() const {
45  return location_;
46 }
47 
48 /**
49  * Sets the top-left location of the Figure's bounding rectangle.
50  *
51  * @param point New location.
52  */
53 inline void
54 Figure::setLocation(wxPoint point) {
55  location_ = point;
56 }
57 
58 /**
59  * Sets the x-coordinate of the Figure's location.
60  *
61  * @param x New x-coordinate.
62  */
63 inline void
64 Figure::setX(int x) {
65  location_.x = x;
66  xSet_ = true;
67 }
68 
69 /**
70  * Sets the y-coordinate of the Figure's location.
71  *
72  * @param y New y-coordinate.
73  */
74 inline void
75 Figure::setY(int y) {
76  location_.y = y;
77 }
78 
79 /**
80  * Returns the Figure's bounding rectangle.
81  *
82  * @return The Figure's bounding rectangle.
83  */
84 inline wxRect
85 Figure::bounds() const {
86  return wxRect(location_, size_);
87 }
88 
89 /**
90  * Returns the Figure's virtual bounding rectangle for easying
91  * selection of smaller blocks.
92  *
93  * Default implementation returns normal bounds.
94  *
95  * @return The Figure's virtual bounding rectangle.
96  */
97 inline wxRect
98 Figure::virtualBounds() const {
99  return wxRect(location_, size_);
100 }
101 
102 /**
103  * Sets an 'ok' x-coordinate, that will be used if not decided
104  * otherwise.
105  *
106  * @param prefX New preferred x-coordinate.
107  */
108 inline void
109 Figure::setPreferredX(int prefX) {
110  location_.x = prefX;
111 }
112 
113 /**
114  * Tells if the x-coordinate of the Figure has been finally decided.
115  *
116  * @return True if x-coordinate has been fixed.
117  */
118 inline bool
119 Figure::xSet() const {
120  return xSet_;
121 }
122 
123 /**
124  * Clears the flag that tells that the x-coordinate of this Figure has
125  * been set.
126  */
127 inline void
128 Figure::clearXSetFlag() {
129  xSet_ = false;
130 }
131 
132 /**
133  * Adds a Figure as a child of this Figure.
134  *
135  * @param child Child to be added.
136  */
137 inline void
138 Figure::addChild(Figure* child) {
139  children_.push_back(child);
140 }
141 
142 /**
143  * Returns the number of child Figures.
144  *
145  * @return The number of child Figures.
146  */
147 inline int
148 Figure::childCount() const {
149  return children_.size();
150 }
151 
152 /**
153  * Returns the child figure at index.
154  *
155  * @param index Index of the child to return.
156  * @return The child figure corresponding to the given index.
157  */
158 inline Figure*
159 Figure::child(int index) const {
160  return children_[index];
161 }
162 
163 /**
164  * Empty default implementation that can be used if no specific laying
165  * out needs to be done.
166  */
167 inline void
168 Figure::layoutSelf(wxDC*) {
169 }
170 
171 /**
172  * Empty default implementation that can be used if the Figure is invisible.
173  *
174  * @param dc Device context.
175  */
176 inline void
177 Figure::drawSelf(wxDC*) {
178 }