OpenASIP 2.2
Loading...
Searching...
No Matches
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.
 
 BusChainFigure (BusChainFigure &old)
 Copying not allowed.
 

Static Private Attributes

static const wxColour DEFAULT_COLOUR = wxColour(255, 150, 150)
 Default colour for the figure.
 

Additional Inherited Members

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

Detailed Description

Figure of a bus chain.

Definition at line 47 of file BusChainFigure.hh.

Constructor & Destructor Documentation

◆ BusChainFigure() [1/2]

BusChainFigure::BusChainFigure ( )

The Constructor.

Definition at line 48 of file BusChainFigure.cc.

48 : Figure() {
49 minSize_ = wxSize(
53}
wxSize minSize_
Figure's minimum size.
Definition Figure.hh:88
Figure()
Definition Figure.cc:44
wxSize size_
wxSize of the Figure's bounding rectangle.
Definition Figure.hh:86
static const int BUS_MIN_WIDTH
Minimum width of a bus.
static const int BUS_MIN_HEIGHT
Minimum height of a bus.

References MachineCanvasLayoutConstraints::BUS_MIN_HEIGHT, MachineCanvasLayoutConstraints::BUS_MIN_WIDTH, Figure::minSize_, and Figure::size_.

◆ ~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}
static const wxColour DEFAULT_COLOUR
Default colour for the figure.
wxPoint location_
Top-left location of the Figure's bounding rectangle.
Definition Figure.hh:84

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}
void setDirection(BridgeFigure::Direction direction)
Direction direction() const
Figure * target() const
std::vector< Figure * > children_
Figure's children.
Definition Figure.hh:90
static const int BRIDGE_SPACE
Space dividing buses and bridges.

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: