OpenASIP  2.0
Figure.hh
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.hh
26  *
27  * Declaration of Figure class.
28  *
29  * @author Ari Metsähalme 2003 (ari.metsahalme-no.spam-tut.fi)
30  * @note rating: yellow
31  * @note reviewed Jul 22 2004 by tr, ml, jm, am
32  */
33 
34 #ifndef TTA_FIGURE_HH
35 #define TTA_FIGURE_HH
36 
37 #include <wx/wx.h>
38 #include <vector>
39 
41 
42 /**
43  * Abstract base class for classes that represent the visuals of a
44  * machine block.
45  *
46  * Can draw itself on the given device context. May contain other
47  * Figures as children, and in that case, knows also how to layout
48  * them.
49  */
50 class Figure {
51 public:
52  Figure();
53  virtual ~Figure();
54 
55  wxPoint location() const;
56  void setLocation(wxPoint point);
57  void setX(int x);
58  void setY(int y);
59  void setPreferredX(int x);
60  bool xSet() const;
61  void clearXSetFlag();
62  virtual wxRect bounds() const;
63  virtual wxRect virtualBounds() const;
64  void setBounds(wxSize bounds);
65  void setWidth(int width);
66  void setHeight(int height);
67  virtual void addChild(Figure* child);
68  int childCount() const;
69  Figure* child(int index) const;
70  virtual void layout(wxDC* dc);
71  virtual void draw(wxDC* dc);
72  void highlight(const wxColour& colour);
73  void clearHighlight();
76 
77 protected:
78  virtual void drawSelf(wxDC* dc);
79  void drawChildren(wxDC* dc);
80  virtual void layoutSelf(wxDC*);
81  virtual void layoutChildren(wxDC*);
82 
83  /// Top-left location of the Figure's bounding rectangle.
84  wxPoint location_;
85  /// wxSize of the Figure's bounding rectangle.
86  wxSize size_;
87  /// Figure's minimum size.
88  wxSize minSize_;
89  /// Figure's children.
90  std::vector<Figure*> children_;
91 
92  /// Tells if x-coordinate has been fixed.
93  bool xSet_;
94  /// Tells whether the Figure and its children have been laid out or not.
95  bool laidOut_;
96  /// Tells whether the Figure and its children have been drawn or not.
97  bool drawn_;
98  /// Highlight colour.
99  wxColour highlight_;
100  /// Tells if the figure is highlighted.
102 
103  /// Options which are used for customizing figures.
105 
106 private:
107  /// Assignment not allowed.
108  Figure& operator=(Figure& old);
109  /// Copying not allowed.
110  Figure(Figure& old);
111 };
112 
113 #include "Figure.icc"
114 
115 #endif
Figure::setBounds
void setBounds(wxSize bounds)
Definition: Figure.cc:62
Figure::drawSelf
virtual void drawSelf(wxDC *dc)
Figure::setLocation
void setLocation(wxPoint point)
Figure::bounds
virtual wxRect bounds() const
Figure::laidOut_
bool laidOut_
Tells whether the Figure and its children have been laid out or not.
Definition: Figure.hh:95
Figure::highlight
void highlight(const wxColour &colour)
Definition: Figure.cc:182
Figure::setWidth
void setWidth(int width)
Definition: Figure.cc:81
Figure::drawChildren
void drawChildren(wxDC *dc)
Definition: Figure.cc:151
Figure::children_
std::vector< Figure * > children_
Figure's children.
Definition: Figure.hh:90
Figure::highlight_
wxColour highlight_
Highlight colour.
Definition: Figure.hh:99
Figure::layoutSelf
virtual void layoutSelf(wxDC *)
Figure::setOptions
void setOptions(MachineCanvasOptions *options)
Definition: Figure.cc:212
Figure::location
wxPoint location() const
Figure::options_
MachineCanvasOptions * options_
Options which are used for customizing figures.
Definition: Figure.hh:104
MachineCanvasOptions
Definition: MachineCanvasOptions.hh:42
Figure::size_
wxSize size_
wxSize of the Figure's bounding rectangle.
Definition: Figure.hh:86
Figure::addChild
virtual void addChild(Figure *child)
Figure::setPreferredX
void setPreferredX(int x)
Figure::child
Figure * child(int index) const
Figure
Definition: Figure.hh:50
Figure.icc
Figure::location_
wxPoint location_
Top-left location of the Figure's bounding rectangle.
Definition: Figure.hh:84
Figure::xSet
bool xSet() const
Figure::xSet_
bool xSet_
Tells if x-coordinate has been fixed.
Definition: Figure.hh:93
Figure::clearHighlight
void clearHighlight()
Definition: Figure.cc:165
Figure::~Figure
virtual ~Figure()
Definition: Figure.cc:53
Figure::highlighted_
bool highlighted_
Tells if the figure is highlighted.
Definition: Figure.hh:101
Figure::draw
virtual void draw(wxDC *dc)
Definition: Figure.cc:138
Figure::setY
void setY(int y)
Figure::minSize_
wxSize minSize_
Figure's minimum size.
Definition: Figure.hh:88
Figure::childCount
int childCount() const
Figure::Figure
Figure()
Definition: Figure.cc:44
Figure::layout
virtual void layout(wxDC *dc)
Definition: Figure.cc:109
Figure::setX
void setX(int x)
Figure::setHeight
void setHeight(int height)
Definition: Figure.cc:95
Figure::clearXSetFlag
void clearXSetFlag()
Figure::operator=
Figure & operator=(Figure &old)
Assignment not allowed.
Figure::options
MachineCanvasOptions * options()
Definition: Figure.cc:199
Figure::drawn_
bool drawn_
Tells whether the Figure and its children have been drawn or not.
Definition: Figure.hh:97
Figure::layoutChildren
virtual void layoutChildren(wxDC *)
Definition: Figure.cc:124
Figure::virtualBounds
virtual wxRect virtualBounds() const