OpenASIP 2.2
Loading...
Searching...
No Matches
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 */
50class Figure {
51public:
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;
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
77protected:
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.
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
106private:
107 /// Assignment not allowed.
109 /// Copying not allowed.
111};
112
113#include "Figure.icc"
114
115#endif
bool drawn_
Tells whether the Figure and its children have been drawn or not.
Definition Figure.hh:97
wxSize minSize_
Figure's minimum size.
Definition Figure.hh:88
MachineCanvasOptions * options()
Definition Figure.cc:199
Figure(Figure &old)
Copying not allowed.
void setOptions(MachineCanvasOptions *options)
Definition Figure.cc:212
Figure()
Definition Figure.cc:44
wxColour highlight_
Highlight colour.
Definition Figure.hh:99
void clearXSetFlag()
void setHeight(int height)
Definition Figure.cc:95
void setPreferredX(int x)
MachineCanvasOptions * options_
Options which are used for customizing figures.
Definition Figure.hh:104
virtual void layoutChildren(wxDC *)
Definition Figure.cc:124
Figure & operator=(Figure &old)
Assignment not allowed.
int childCount() const
Figure * child(int index) const
void setX(int x)
std::vector< Figure * > children_
Figure's children.
Definition Figure.hh:90
virtual void drawSelf(wxDC *dc)
void highlight(const wxColour &colour)
Definition Figure.cc:182
virtual wxRect bounds() const
virtual void layoutSelf(wxDC *)
bool laidOut_
Tells whether the Figure and its children have been laid out or not.
Definition Figure.hh:95
virtual void layout(wxDC *dc)
Definition Figure.cc:109
void setWidth(int width)
Definition Figure.cc:81
wxSize size_
wxSize of the Figure's bounding rectangle.
Definition Figure.hh:86
wxPoint location() const
void setLocation(wxPoint point)
void clearHighlight()
Definition Figure.cc:165
void drawChildren(wxDC *dc)
Definition Figure.cc:151
bool highlighted_
Tells if the figure is highlighted.
Definition Figure.hh:101
bool xSet_
Tells if x-coordinate has been fixed.
Definition Figure.hh:93
virtual wxRect virtualBounds() const
void setY(int y)
void setBounds(wxSize bounds)
Definition Figure.cc:62
virtual void draw(wxDC *dc)
Definition Figure.cc:138
bool xSet() const
virtual ~Figure()
Definition Figure.cc:53
wxPoint location_
Top-left location of the Figure's bounding rectangle.
Definition Figure.hh:84
virtual void addChild(Figure *child)