OpenASIP 2.2
Loading...
Searching...
No Matches
OutputSocketFigure.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 OutputSocketFigure.cc
26 *
27 * Definition of OutputSocketFigure class.
28 *
29 * @author Ari Metsähalme 2003 (ari.metsahalme-no.spam-tut.fi)
30 * @note rating: yellow
31 * @note reviewed Jul 27 2004 by ml, pj, am
32 */
33
34#include "OutputSocketFigure.hh"
36
37const wxColour OutputSocketFigure::DEFAULT_COLOUR = wxColour(0, 0, 0);
38const wxColour OutputSocketFigure::DEFAULT_BG_COLOUR = wxColour(255, 255, 255);
39
40/**
41 * The Constructor.
42 */
48
49/**
50 * The Destructor.
51 */
54
55/**
56 * Draws the output socket's Figure on the given device context.
57 *
58 * @param dc The device context.
59 */
60void
62 wxPen pen = wxPen(DEFAULT_COLOUR, 1, wxSOLID);
63 dc->SetPen(pen);
64 wxBrush brush = wxBrush(DEFAULT_BG_COLOUR, wxSOLID);
65 if (highlighted_) {
66 brush = wxBrush(highlight_, wxSOLID);
67 }
68 dc->SetBrush(brush);
69
71
72 wxPoint point1 = wxPoint(0, 0);
73 wxPoint point2 = wxPoint(size_.GetWidth(), 0);
74 wxPoint point3 = wxPoint(size_.GetWidth()/2, triangleHeight);
75 wxPoint trianglePoints[3] = {point1, point2, point3};
76
77 dc->DrawPolygon(3, trianglePoints, location_.x, location_.y);
78 dc->DrawRectangle(
79 location_.x, location_.y + triangleHeight, size_.GetWidth(),
80 size_.GetHeight() - triangleHeight);
81}
wxColour highlight_
Highlight colour.
Definition Figure.hh:99
wxSize size_
wxSize of the Figure's bounding rectangle.
Definition Figure.hh:86
bool highlighted_
Tells if the figure is highlighted.
Definition Figure.hh:101
wxPoint location_
Top-left location of the Figure's bounding rectangle.
Definition Figure.hh:84
static const int SOCKET_WIDTH
Width of a socket.
static const int SOCKET_HEIGHT
Height of a socket.
static const int TRIANGLE_HEIGHT
Size of the sockets' direction triangle.
static const wxColour DEFAULT_BG_COLOUR
Default background colour for the figure.
static const wxColour DEFAULT_COLOUR
Default colour for the figure.
virtual void drawSelf(wxDC *dc)