OpenASIP  2.0
Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Attributes | List of all members
SocketPortConnFigure Class Reference

#include <SocketPortConnFigure.hh>

Inheritance diagram for SocketPortConnFigure:
Inheritance graph
Collaboration diagram for SocketPortConnFigure:
Collaboration graph

Public Member Functions

 SocketPortConnFigure ()
 
virtual ~SocketPortConnFigure ()
 
- Public Member Functions inherited from ConnectionFigure
virtual ~ConnectionFigure ()
 
void setSource (Figure *figure)
 
void setTarget (Figure *figure)
 
Figuresource () const
 
Figuretarget () const
 
- Public Member Functions inherited from Figure
 Figure ()
 
virtual ~Figure ()
 
wxPoint location () const
 
void setLocation (wxPoint point)
 
void setX (int x)
 
void setY (int y)
 
void setPreferredX (int x)
 
bool xSet () const
 
void clearXSetFlag ()
 
virtual wxRect bounds () const
 
virtual wxRect virtualBounds () const
 
void setBounds (wxSize bounds)
 
void setWidth (int width)
 
void setHeight (int height)
 
virtual void addChild (Figure *child)
 
int childCount () const
 
Figurechild (int index) const
 
virtual void layout (wxDC *dc)
 
virtual void draw (wxDC *dc)
 
void highlight (const wxColour &colour)
 
void clearHighlight ()
 
void setOptions (MachineCanvasOptions *options)
 
MachineCanvasOptionsoptions ()
 

Protected Member Functions

virtual void drawSelf (wxDC *dc)
 
virtual void layoutSelf (wxDC *dc)
 
virtual void drawConnection (wxDC *dc)
 
- Protected Member Functions inherited from ConnectionFigure
 ConnectionFigure ()
 
- Protected Member Functions inherited from Figure
void drawChildren (wxDC *dc)
 
virtual void layoutChildren (wxDC *)
 

Private Member Functions

SocketPortConnFigureoperator= (SocketPortConnFigure &old)
 Assignment not allowed. More...
 
 SocketPortConnFigure (SocketPortConnFigure &old)
 Copying not allowed. More...
 

Static Private Attributes

static const wxColour DEFAULT_COLOUR = wxColour(0, 0, 0)
 Default colour for the figure. More...
 

Additional Inherited Members

- Protected Attributes inherited from ConnectionFigure
Figuresource_
 Source of connection. More...
 
Figuretarget_
 Target of connection. More...
 
- Protected Attributes inherited from Figure
wxPoint location_
 Top-left location of the Figure's bounding rectangle. More...
 
wxSize size_
 wxSize of the Figure's bounding rectangle. More...
 
wxSize minSize_
 Figure's minimum size. More...
 
std::vector< Figure * > children_
 Figure's children. More...
 
bool xSet_
 Tells if x-coordinate has been fixed. More...
 
bool laidOut_
 Tells whether the Figure and its children have been laid out or not. More...
 
bool drawn_
 Tells whether the Figure and its children have been drawn or not. More...
 
wxColour highlight_
 Highlight colour. More...
 
bool highlighted_
 Tells if the figure is highlighted. More...
 
MachineCanvasOptionsoptions_
 Options which are used for customizing figures. More...
 

Detailed Description

Figure of a socket-to-port connection.

Definition at line 46 of file SocketPortConnFigure.hh.

Constructor & Destructor Documentation

◆ SocketPortConnFigure() [1/2]

SocketPortConnFigure::SocketPortConnFigure ( )

The Constructor.

Definition at line 45 of file SocketPortConnFigure.cc.

45  : ConnectionFigure() {
46 }

◆ ~SocketPortConnFigure()

SocketPortConnFigure::~SocketPortConnFigure ( )
virtual

The Destructor.

Definition at line 51 of file SocketPortConnFigure.cc.

51  {
52 }

◆ SocketPortConnFigure() [2/2]

SocketPortConnFigure::SocketPortConnFigure ( SocketPortConnFigure old)
private

Copying not allowed.

Member Function Documentation

◆ drawConnection()

void SocketPortConnFigure::drawConnection ( wxDC *  dc)
protectedvirtual

Draws the connection line on the dc.

Definition at line 71 of file SocketPortConnFigure.cc.

71  {
72  int xOffset = source_->bounds().GetWidth() / 2;
73 
75  // assumes that port is always "source"
76  dc->DrawLine(source_->location().x + xOffset,
77  source_->location().y + yOffset*2,
78  target_->location().x + xOffset,
79  target_->location().y);
80 }

References Figure::bounds(), Figure::location(), MachineCanvasLayoutConstraints::PORT_WIDTH, ConnectionFigure::source_, and ConnectionFigure::target_.

Referenced by SocketPortConnToolFigure::drawSelf(), and drawSelf().

Here is the call graph for this function:

◆ drawSelf()

void SocketPortConnFigure::drawSelf ( wxDC *  dc)
protectedvirtual

Draws the connection's Figure on the given device context.

Parameters
dcThe device context.

Reimplemented from Figure.

Reimplemented in SocketPortConnToolFigure.

Definition at line 60 of file SocketPortConnFigure.cc.

60  {
61  assert(source_ != NULL && target_ != NULL);
62  wxPen pen = wxPen(DEFAULT_COLOUR, 1, wxSOLID);
63  dc->SetPen(pen);
64  drawConnection(dc);
65 }

References assert, DEFAULT_COLOUR, drawConnection(), ConnectionFigure::source_, and ConnectionFigure::target_.

Here is the call graph for this function:

◆ layoutSelf()

void SocketPortConnFigure::layoutSelf ( wxDC *  dc)
protectedvirtual

Sets the figure's bounds.

Reimplemented from Figure.

Definition at line 86 of file SocketPortConnFigure.cc.

86  {
87  // assumes that port is always "source"
89  int xOffset = source_->bounds().GetWidth() / 2;
90 
91  setHeight(target_->location().y - source_->location().y - yOffset*2);
92  if(source_->location().x < target_->location().x) {
93  setWidth(target_->location().x - source_->location().x + 3);
95  wxPoint(source_->location().x - 1 + xOffset,
96  source_->location().y + yOffset*2));
97 
98  } else {
99  setWidth(source_->location().x - target_->location().x + 3);
100  setLocation(
101  wxPoint(target_->location().x - 1 + xOffset,
102  source_->location().y + yOffset*2));
103  }
104 }

References Figure::bounds(), Figure::location(), MachineCanvasLayoutConstraints::PORT_WIDTH, Figure::setHeight(), Figure::setLocation(), Figure::setWidth(), ConnectionFigure::source_, and ConnectionFigure::target_.

Here is the call graph for this function:

◆ operator=()

SocketPortConnFigure& SocketPortConnFigure::operator= ( SocketPortConnFigure old)
private

Assignment not allowed.

Member Data Documentation

◆ DEFAULT_COLOUR

const wxColour SocketPortConnFigure::DEFAULT_COLOUR = wxColour(0, 0, 0)
staticprivate

Default colour for the figure.

Definition at line 62 of file SocketPortConnFigure.hh.

Referenced by drawSelf().


The documentation for this class was generated from the following files:
ConnectionFigure::target_
Figure * target_
Target of connection.
Definition: ConnectionFigure.hh:58
Figure::setLocation
void setLocation(wxPoint point)
Figure::bounds
virtual wxRect bounds() const
Figure::setWidth
void setWidth(int width)
Definition: Figure.cc:81
SocketPortConnFigure::DEFAULT_COLOUR
static const wxColour DEFAULT_COLOUR
Default colour for the figure.
Definition: SocketPortConnFigure.hh:62
Figure::location
wxPoint location() const
assert
#define assert(condition)
Definition: Application.hh:86
ConnectionFigure::ConnectionFigure
ConnectionFigure()
Definition: ConnectionFigure.cc:41
MachineCanvasLayoutConstraints::PORT_WIDTH
static const int PORT_WIDTH
Default Width of a port.
Definition: MachineCanvasLayoutConstraints.hh:51
ConnectionFigure::source_
Figure * source_
Source of connection.
Definition: ConnectionFigure.hh:56
Figure::setHeight
void setHeight(int height)
Definition: Figure.cc:95
SocketPortConnFigure::drawConnection
virtual void drawConnection(wxDC *dc)
Definition: SocketPortConnFigure.cc:71