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

#include <SocketBusConnFigure.hh>

Inheritance diagram for SocketBusConnFigure:
Inheritance graph
Collaboration diagram for SocketBusConnFigure:
Collaboration graph

Public Member Functions

 SocketBusConnFigure ()
 
virtual ~SocketBusConnFigure ()
 
- 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 drawConnection (wxDC *dc)
 
virtual void layoutSelf (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

SocketBusConnFigureoperator= (SocketBusConnFigure &old)
 Assignment not allowed. More...
 
 SocketBusConnFigure (SocketBusConnFigure &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-bus connection.

Definition at line 46 of file SocketBusConnFigure.hh.

Constructor & Destructor Documentation

◆ SocketBusConnFigure() [1/2]

SocketBusConnFigure::SocketBusConnFigure ( )

The Constructor.

Definition at line 45 of file SocketBusConnFigure.cc.

45  : ConnectionFigure() {
46 }

◆ ~SocketBusConnFigure()

SocketBusConnFigure::~SocketBusConnFigure ( )
virtual

The Destructor.

Definition at line 51 of file SocketBusConnFigure.cc.

51  {
52 }

◆ SocketBusConnFigure() [2/2]

SocketBusConnFigure::SocketBusConnFigure ( SocketBusConnFigure old)
private

Copying not allowed.

Member Function Documentation

◆ drawConnection()

void SocketBusConnFigure::drawConnection ( wxDC *  dc)
protectedvirtual

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

Definition at line 74 of file SocketBusConnFigure.cc.

74  {
75 
76  int xOffset = source_->bounds().GetWidth()/2;
77  int yOffset = target_->bounds().GetHeight()/2;
78 
79  // assumes that socket is always "source"
80  dc->DrawCircle(source_->location().x + xOffset,
81  target_->location().y + yOffset,
82  size_.GetWidth()/2);
83 }

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

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

Here is the call graph for this function:

◆ drawSelf()

void SocketBusConnFigure::drawSelf ( wxDC *  dc)
protectedvirtual

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

Parameters
dcThe device context.

Reimplemented from Figure.

Reimplemented in SocketBusConnToolFigure.

Definition at line 60 of file SocketBusConnFigure.cc.

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

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

Here is the call graph for this function:

◆ layoutSelf()

void SocketBusConnFigure::layoutSelf ( wxDC *  dc)
protectedvirtual

Sets the figure's bounds.

Reimplemented from Figure.

Definition at line 90 of file SocketBusConnFigure.cc.

90  {
92  wxPoint(
93  source_->location().x,
94  target_->location().y +
95  (target_->bounds().GetHeight()/2) -
97  int size = std::max(std::min(source_->bounds().GetWidth(),
100  setWidth(size);
101  setHeight(size);
102 
103 }

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

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.

Member Data Documentation

◆ DEFAULT_COLOUR

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

Default colour for the figure.

Definition at line 63 of file SocketBusConnFigure.hh.

Referenced by drawSelf().


The documentation for this class was generated from the following files:
SocketBusConnFigure::drawConnection
virtual void drawConnection(wxDC *dc)
Definition: SocketBusConnFigure.cc:74
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
MachineCanvasLayoutConstraints::SOCKET_WIDTH
static const int SOCKET_WIDTH
Width of a socket.
Definition: MachineCanvasLayoutConstraints.hh:59
Figure::location
wxPoint location() const
assert
#define assert(condition)
Definition: Application.hh:86
Figure::size_
wxSize size_
wxSize of the Figure's bounding rectangle.
Definition: Figure.hh:86
ConnectionFigure::ConnectionFigure
ConnectionFigure()
Definition: ConnectionFigure.cc:41
ConnectionFigure::source_
Figure * source_
Source of connection.
Definition: ConnectionFigure.hh:56
MachineCanvasLayoutConstraints::BUS_SPACE
static const int BUS_SPACE
Space between buses and bus chains.
Definition: MachineCanvasLayoutConstraints.hh:75
Figure::setHeight
void setHeight(int height)
Definition: Figure.cc:95
SocketBusConnFigure::DEFAULT_COLOUR
static const wxColour DEFAULT_COLOUR
Default colour for the figure.
Definition: SocketBusConnFigure.hh:63