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

#include <BusChainFigure.hh>

Inheritance diagram for BusChainFigure:
Inheritance graph
Collaboration diagram for BusChainFigure:
Collaboration graph

Public Member Functions

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

Private Member Functions

BusChainFigureoperator= (BusChainFigure &old)
 Assignment not allowed. More...
 
 BusChainFigure (BusChainFigure &old)
 Copying not allowed. More...
 

Static Private Attributes

static const wxColour DEFAULT_COLOUR = wxColour(255, 150, 150)
 Default colour for the figure. 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 bus chain.

Definition at line 47 of file BusChainFigure.hh.

Constructor & Destructor Documentation

◆ BusChainFigure() [1/2]

BusChainFigure::BusChainFigure ( )

◆ ~BusChainFigure()

BusChainFigure::~BusChainFigure ( )
virtual

The Destructor.

Definition at line 58 of file BusChainFigure.cc.

58  {
59 }

◆ BusChainFigure() [2/2]

BusChainFigure::BusChainFigure ( BusChainFigure old)
private

Copying not allowed.

Member Function Documentation

◆ drawSelf()

void BusChainFigure::drawSelf ( wxDC *  dc)
protectedvirtual

Fills the background of the bus chain with a solid color.

Parameters
dcThe device context.

Reimplemented from Figure.

Definition at line 102 of file BusChainFigure.cc.

102  {
103  wxPen pen = wxPen(DEFAULT_COLOUR, 1, wxSOLID);
104  dc->SetPen(pen);
105  wxBrush brush = wxBrush(DEFAULT_COLOUR, wxSOLID);
106  dc->SetBrush(brush);
107  dc->DrawRectangle(location_.x, location_.y, size_.GetWidth(),
108  size_.GetHeight());
109 }

References DEFAULT_COLOUR, Figure::location_, and Figure::size_.

◆ layoutChildren()

void BusChainFigure::layoutChildren ( wxDC *  dc)
protectedvirtual

Lays out the segments in a column, spaced evenly.

Parameters
dcDevice context.

Reimplemented from Figure.

Definition at line 67 of file BusChainFigure.cc.

67  {
68 
71  int x = location_.x;
72 
73  for(unsigned int i = 0; i < children_.size(); i++) {
74 
75  children_[i]->setLocation(wxPoint(x, y));
76  children_[i]->setWidth(size_.GetWidth());
77 
78  // set bridge direction
79  BridgeFigure* br = dynamic_cast<BridgeFigure*>(children_[i]);
80  if (br != NULL && br->direction() != BridgeFigure::DIR_BIDIR &&
81  br->target() == children_[i-1]) {
82 
84  }
85 
86  children_[i]->layout(dc);
87  y += children_[i]->bounds().GetHeight() +
89  height += children_[i]->bounds().GetHeight() +
91  }
92 
93  size_.SetHeight(height);
94 }

References MachineCanvasLayoutConstraints::BRIDGE_SPACE, Figure::children_, BridgeFigure::DIR_BIDIR, BridgeFigure::DIR_LEFT, BridgeFigure::direction(), Figure::location_, BridgeFigure::setDirection(), Figure::size_, and ConnectionFigure::target().

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.

Member Data Documentation

◆ DEFAULT_COLOUR

const wxColour BusChainFigure::DEFAULT_COLOUR = wxColour(255, 150, 150)
staticprivate

Default colour for the figure.

Definition at line 63 of file BusChainFigure.hh.

Referenced by drawSelf().


The documentation for this class was generated from the following files:
BridgeFigure::setDirection
void setDirection(BridgeFigure::Direction direction)
MachineCanvasLayoutConstraints::BRIDGE_SPACE
static const int BRIDGE_SPACE
Space dividing buses and bridges.
Definition: MachineCanvasLayoutConstraints.hh:81
BusChainFigure::DEFAULT_COLOUR
static const wxColour DEFAULT_COLOUR
Default colour for the figure.
Definition: BusChainFigure.hh:63
MachineCanvasLayoutConstraints::BUS_MIN_WIDTH
static const int BUS_MIN_WIDTH
Minimum width of a bus.
Definition: MachineCanvasLayoutConstraints.hh:71
BridgeFigure::direction
Direction direction() const
BridgeFigure::DIR_BIDIR
@ DIR_BIDIR
Definition: BridgeFigure.hh:49
Figure::children_
std::vector< Figure * > children_
Figure's children.
Definition: Figure.hh:90
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
BridgeFigure
Definition: BridgeFigure.hh:46
Figure::minSize_
wxSize minSize_
Figure's minimum size.
Definition: Figure.hh:88
Figure::Figure
Figure()
Definition: Figure.cc:44
ConnectionFigure::target
Figure * target() const
BridgeFigure::DIR_LEFT
@ DIR_LEFT
Definition: BridgeFigure.hh:49
MachineCanvasLayoutConstraints::BUS_MIN_HEIGHT
static const int BUS_MIN_HEIGHT
Minimum height of a bus.
Definition: MachineCanvasLayoutConstraints.hh:73