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

#include <UnitContainerFigure.hh>

Inheritance diagram for UnitContainerFigure:
Inheritance graph
Collaboration diagram for UnitContainerFigure:
Collaboration graph

Public Member Functions

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

Private Member Functions

UnitContainerFigureoperator= (UnitContainerFigure &old)
 Assignment not allowed. More...
 
 UnitContainerFigure (UnitContainerFigure &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 units.

Definition at line 46 of file UnitContainerFigure.hh.

Constructor & Destructor Documentation

◆ UnitContainerFigure() [1/2]

UnitContainerFigure::UnitContainerFigure ( )

The Constructor.

Definition at line 44 of file UnitContainerFigure.cc.

44  : Figure() {
45 }

◆ ~UnitContainerFigure()

UnitContainerFigure::~UnitContainerFigure ( )
virtual

The Destructor.

Definition at line 50 of file UnitContainerFigure.cc.

50  {
51 }

◆ UnitContainerFigure() [2/2]

UnitContainerFigure::UnitContainerFigure ( UnitContainerFigure old)
private

Copying not allowed.

Member Function Documentation

◆ layoutChildren()

void UnitContainerFigure::layoutChildren ( wxDC *  dc)
protectedvirtual

Lays out the units in a row, spaced evenly.

Parameters
dcDevice context.

Reimplemented from Figure.

Definition at line 59 of file UnitContainerFigure.cc.

59  {
60 
61  int unitX = location_.x;
62  int unitY = location_.y;
63 
64  for(unsigned int i = 0; i < children_.size(); i++) {
65 
66  if (!children_[i]->xSet()) {
67  children_[i]->setLocation(wxPoint(unitX, unitY));
68  children_[i]->layout(dc);
69  unitX += children_[i]->bounds().GetWidth() +
71 
72  } else {
73  children_[i]->layout(dc);
74  unitX = children_[i]->location().x +
75  children_[i]->bounds().GetWidth() +
77  }
78  }
79 }

References Figure::children_, Figure::location_, MachineCanvasLayoutConstraints::UNIT_SPACE, and Figure::xSet().

Here is the call graph for this function:

◆ layoutSelf()

void UnitContainerFigure::layoutSelf ( wxDC *  )
protectedvirtual

Calculates and sets the size of the container.

Depends on the amount and position of the units.

Reimplemented from Figure.

Definition at line 87 of file UnitContainerFigure.cc.

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

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

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.


The documentation for this class was generated from the following files:
Figure::bounds
virtual wxRect bounds() const
Figure::children_
std::vector< Figure * > children_
Figure's children.
Definition: Figure.hh:90
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::xSet
bool xSet() const
Figure::Figure
Figure()
Definition: Figure.cc:44
MachineCanvasLayoutConstraints::UNIT_SPACE
static const int UNIT_SPACE
Space between units.
Definition: MachineCanvasLayoutConstraints.hh:47