OpenASIP  2.0
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
SocketContainerFigure Class Reference

#include <SocketContainerFigure.hh>

Inheritance diagram for SocketContainerFigure:
Inheritance graph
Collaboration diagram for SocketContainerFigure:
Collaboration graph

Public Member Functions

 SocketContainerFigure ()
 
virtual ~SocketContainerFigure ()
 
- 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 layoutChildren (wxDC *)
 
virtual void layoutSelf (wxDC *)
 
- Protected Member Functions inherited from Figure
virtual void drawSelf (wxDC *dc)
 
void drawChildren (wxDC *dc)
 

Private Member Functions

SocketContainerFigureoperator= (SocketContainerFigure &old)
 Assignment not allowed. More...
 
 SocketContainerFigure (SocketContainerFigure &old)
 Copying not allowed. More...
 

Additional Inherited Members

- 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 container EditPart for sockets.

Definition at line 46 of file SocketContainerFigure.hh.

Constructor & Destructor Documentation

◆ SocketContainerFigure() [1/2]

SocketContainerFigure::SocketContainerFigure ( )

The Constructor.

Definition at line 44 of file SocketContainerFigure.cc.

44  : Figure() {
45 }

◆ ~SocketContainerFigure()

SocketContainerFigure::~SocketContainerFigure ( )
virtual

The Destructor.

Definition at line 50 of file SocketContainerFigure.cc.

50  {
51 }

◆ SocketContainerFigure() [2/2]

SocketContainerFigure::SocketContainerFigure ( SocketContainerFigure old)
private

Copying not allowed.

Member Function Documentation

◆ layoutChildren()

void SocketContainerFigure::layoutChildren ( wxDC *  dc)
protectedvirtual

Lays out child sockets.

Parameters
dcDevice context.

Reimplemented from Figure.

Definition at line 59 of file SocketContainerFigure.cc.

59  {
60 
61  int unknownSocketX = location_.x + size_.GetWidth();
62 
63  // set locations for sockets not connected to any port
64 
65  vector<Figure*>::iterator i = children_.begin();
66  for(; i != children_.end(); i++) {
67 
68  if ((*i)->location().x == 0) {
69  (*i)->setX(unknownSocketX);
72  }
73 
74  (*i)->setY(location_.y);
75  if (size_.GetHeight() > (*i)->bounds().GetHeight()) {
76  (*i)->setHeight(size_.GetHeight());
77  }
78  (*i)->layout(dc);
79  (*i)->clearXSetFlag();
80  }
81 }

References Figure::children_, Figure::location_, Figure::size_, MachineCanvasLayoutConstraints::SOCKET_SPACE, and MachineCanvasLayoutConstraints::SOCKET_WIDTH.

◆ layoutSelf()

void SocketContainerFigure::layoutSelf ( wxDC *  )
protectedvirtual

Calculates and sets the width of the container.

Depends on the amount and position of sockets.

Reimplemented from Figure.

Definition at line 89 of file SocketContainerFigure.cc.

89  {
90 
91  int maxIndex = 0;
92  int maxX = 0;
93 
94  for (unsigned int i = 0; i < children_.size(); i++) {
95  if (children_[i]->location().x > maxX) {
96  maxX = children_[i]->location().x;
97  maxIndex = i;
98  }
99  }
100 
101  int rightBound = maxX + children_[maxIndex]->bounds().GetWidth() +
103 
104  if (rightBound > location_.x + size_.GetWidth()) {
105  size_.SetWidth(rightBound - location_.x);
106  }
107 
108  if (children_[0]->bounds().GetHeight() > size_.GetHeight()) {
109  size_.SetHeight(children_[0]->bounds().GetHeight());
110  }
111 }

References Figure::bounds(), Figure::children_, Figure::location(), Figure::location_, Figure::size_, and MachineCanvasLayoutConstraints::SOCKET_WIDTH.

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.


The documentation for this class was generated from the following files:
Figure::bounds
virtual wxRect bounds() const
MachineCanvasLayoutConstraints::SOCKET_SPACE
static const int SOCKET_SPACE
Space dividing unconnected sockets.
Definition: MachineCanvasLayoutConstraints.hh:63
Figure::children_
std::vector< Figure * > children_
Figure's children.
Definition: Figure.hh:90
MachineCanvasLayoutConstraints::SOCKET_WIDTH
static const int SOCKET_WIDTH
Width of a socket.
Definition: MachineCanvasLayoutConstraints.hh:59
Figure::location
wxPoint location() const
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
Figure::Figure
Figure()
Definition: Figure.cc:44