OpenASIP
2.0
src
applibs
wxToolkit
MachineWindow
BidirBridgeFigure.cc
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 BidirBridgeFigure.cc
26
*
27
* Definition of BidirBridgeFigure class.
28
*
29
* @author Ari Metsähalme 2004 (ari.metsahalme-no.spam-tut.fi)
30
* @note rating: yellow
31
* @note reviewed Jul 27 2004 by ml, pj, am
32
*/
33
34
#include <vector>
35
36
#include "
Application.hh
"
37
#include "
BidirBridgeFigure.hh
"
38
#include "
BridgeFigure.hh
"
39
#include "
MachineCanvasLayoutConstraints.hh
"
40
41
using
std::vector;
42
43
/**
44
* The Constructor.
45
*/
46
BidirBridgeFigure::BidirBridgeFigure
():
BridgeFigure
() {
47
minSize_
= wxSize(
48
MachineCanvasLayoutConstraints::BRIDGE_WIDTH
,
49
MachineCanvasLayoutConstraints::BRIDGE_HEIGHT
* 2);
50
size_
=
minSize_
;
51
}
52
53
/**
54
* The Destructor.
55
*/
56
BidirBridgeFigure::~BidirBridgeFigure
() {
57
}
58
59
/**
60
* Lays out the two child bridges.
61
*
62
* @param dc Device context.
63
*/
64
void
65
BidirBridgeFigure::layoutChildren
(wxDC* dc) {
66
67
assert
(
children_
.size() == 2);
68
69
dynamic_cast<
BridgeFigure
*
>
(
70
children_
[0])->
setDirection
(
BridgeFigure::DIR_LEFT
);
71
72
children_
[0]->setX(
location_
.x);
73
children_
[0]->setY(
location_
.y);
74
children_
[0]->setWidth(
size_
.GetWidth());
75
children_
[0]->layout(dc);
76
77
dynamic_cast<
BridgeFigure
*
>
(
78
children_
[1])->
setDirection
(
BridgeFigure::DIR_RIGHT
);
79
80
children_
[1]->setX(
location_
.x);
81
children_
[1]->setY(
82
location_
.y +
MachineCanvasLayoutConstraints::BRIDGE_HEIGHT
);
83
84
children_
[1]->setWidth(
size_
.GetWidth());
85
children_
[1]->layout(dc);
86
}
87
88
/**
89
* This figure is not visible on the canvas.
90
*
91
* Empty implementation is defined to override BridgeFigure.
92
*/
93
void
94
BidirBridgeFigure::drawSelf
(wxDC*) {
95
}
BridgeFigure::setDirection
void setDirection(BridgeFigure::Direction direction)
BidirBridgeFigure::BidirBridgeFigure
BidirBridgeFigure()
Definition:
BidirBridgeFigure.cc:46
BidirBridgeFigure::~BidirBridgeFigure
virtual ~BidirBridgeFigure()
Definition:
BidirBridgeFigure.cc:56
Figure::children_
std::vector< Figure * > children_
Figure's children.
Definition:
Figure.hh:90
assert
#define assert(condition)
Definition:
Application.hh:86
Figure::size_
wxSize size_
wxSize of the Figure's bounding rectangle.
Definition:
Figure.hh:86
BidirBridgeFigure::drawSelf
virtual void drawSelf(wxDC *dc)
Definition:
BidirBridgeFigure.cc:94
Application.hh
Figure::location_
wxPoint location_
Top-left location of the Figure's bounding rectangle.
Definition:
Figure.hh:84
BridgeFigure
Definition:
BridgeFigure.hh:46
BidirBridgeFigure.hh
BridgeFigure.hh
BridgeFigure::DIR_RIGHT
@ DIR_RIGHT
Definition:
BridgeFigure.hh:49
MachineCanvasLayoutConstraints::BRIDGE_WIDTH
static const int BRIDGE_WIDTH
Width of a bridge.
Definition:
MachineCanvasLayoutConstraints.hh:77
Figure::minSize_
wxSize minSize_
Figure's minimum size.
Definition:
Figure.hh:88
BidirBridgeFigure::layoutChildren
virtual void layoutChildren(wxDC *)
Definition:
BidirBridgeFigure.cc:65
MachineCanvasLayoutConstraints.hh
MachineCanvasLayoutConstraints::BRIDGE_HEIGHT
static const int BRIDGE_HEIGHT
Height of a bridge.
Definition:
MachineCanvasLayoutConstraints.hh:79
BridgeFigure::DIR_LEFT
@ DIR_LEFT
Definition:
BridgeFigure.hh:49
Generated by
1.8.17