OpenASIP  2.0
TriggeringPortFigure.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 TriggeringPortFigure.cc
26  *
27  * Definition of TriggeringPortFigure class.
28  *
29  * @author Veli-Pekka Jääskeläinen 2006 (vjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #include <vector>
34 
35 #include "TriggeringPortFigure.hh"
37 
38 using std::vector;
39 
40 const wxColour TriggeringPortFigure::DEFAULT_COLOUR = wxColour(0, 0, 0);
42  wxColour(255, 255, 255);
43 
44 
45 /**
46  * The Constructor.
47  *
48  * @param name Name of the port.
49  */
50 TriggeringPortFigure::TriggeringPortFigure(std::string name, int bitWidth):
51  UnitPortFigure(name, bitWidth) {
52 }
53 
54 /**
55  * The Destructor.
56  */
58 }
59 
60 
61 /**
62  * Draws the port's Figure on the given device context.
63  *
64  * @param dc The device context.
65  */
66 void
68 
69  wxPen pen = wxPen(DEFAULT_COLOUR, 1, wxSOLID);
70  dc->SetPen(pen);
71  wxBrush brush = wxBrush(DEFAULT_BG_COLOUR, wxSOLID);
72  if (highlighted_) {
73  brush = wxBrush(highlight_, wxSOLID);
74  }
75 
76  dc->SetBrush(brush);
77 
78  dc->DrawRectangle(location_.x, location_.y, size_.GetWidth(),
79  size_.GetHeight());
80 
81  dc->DrawLine(
82  location_.x, location_.y,
83  location_.x + size_.GetWidth() - 1,
84  location_.y + size_.GetHeight() - 1);
85  dc->DrawLine(
86  location_.x, location_.y + size_.GetHeight() - 1,
87  location_.x + size_.GetWidth() - 1, location_.y);
88 
89 }
TriggeringPortFigure::TriggeringPortFigure
TriggeringPortFigure(std::string name, int bitWidth)
Definition: TriggeringPortFigure.cc:50
TriggeringPortFigure::DEFAULT_BG_COLOUR
static const wxColour DEFAULT_BG_COLOUR
Default background colour for the figure.
Definition: TriggeringPortFigure.hh:62
TriggeringPortFigure::DEFAULT_COLOUR
static const wxColour DEFAULT_COLOUR
Default colour for the figure.
Definition: TriggeringPortFigure.hh:60
UnitPortFigure
Definition: UnitPortFigure.hh:46
Figure::highlight_
wxColour highlight_
Highlight colour.
Definition: Figure.hh:99
TriggeringPortFigure::~TriggeringPortFigure
virtual ~TriggeringPortFigure()
Definition: TriggeringPortFigure.cc:57
Figure::size_
wxSize size_
wxSize of the Figure's bounding rectangle.
Definition: Figure.hh:86
Figure::location_
wxPoint location_
Top-left location of the Figure's bounding rectangle.
Definition: Figure.hh:84
TriggeringPortFigure::drawSelf
virtual void drawSelf(wxDC *dc)
Definition: TriggeringPortFigure.cc:67
TriggeringPortFigure.hh
Figure::highlighted_
bool highlighted_
Tells if the figure is highlighted.
Definition: Figure.hh:101
MachineCanvasLayoutConstraints.hh