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

#include <SelectionFigure.hh>

Inheritance diagram for SelectionFigure:
Inheritance graph
Collaboration diagram for SelectionFigure:
Collaboration graph

Public Member Functions

 SelectionFigure (Figure *selection)
 
virtual ~SelectionFigure ()
 
void setSelection (Figure *selection)
 
virtual wxRect bounds () 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 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)
 
- Protected Member Functions inherited from Figure
void drawChildren (wxDC *dc)
 
virtual void layoutSelf (wxDC *)
 
virtual void layoutChildren (wxDC *)
 

Private Member Functions

SelectionFigureoperator= (SelectionFigure &old)
 Assignment not allowed. More...
 
 SelectionFigure (SelectionFigure &old)
 Copying not allowed. More...
 

Private Attributes

Figureselection_
 Selected part figure. More...
 

Static Private Attributes

static const int SELECT_BOX_MARGIN = 4
 Width of the margin between the part figure and selection box. 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 component selection.

Definition at line 45 of file SelectionFigure.hh.

Constructor & Destructor Documentation

◆ SelectionFigure() [1/2]

SelectionFigure::SelectionFigure ( Figure selection)

The Constructor.

Parameters
selectionFigure of the selected EditPart.

Definition at line 47 of file SelectionFigure.cc.

47  :
48  Figure(), selection_(selection) {
49 }

◆ ~SelectionFigure()

SelectionFigure::~SelectionFigure ( )
virtual

The Destructor.

Definition at line 54 of file SelectionFigure.cc.

54  {
55 }

◆ SelectionFigure() [2/2]

SelectionFigure::SelectionFigure ( SelectionFigure old)
private

Copying not allowed.

Member Function Documentation

◆ bounds()

wxRect SelectionFigure::bounds ( ) const
virtual

Returns the Figure's bounding rectangle.

Returns
Figure's bounding rectangle.

Reimplemented from Figure.

Definition at line 111 of file SelectionFigure.cc.

111  {
112  if (selection_ == NULL) {
113  return wxRect(0, 0, 0, 0);
114  }
115  wxRect bounds = selection_->bounds();
117  bounds.Inflate(SELECT_BOX_MARGIN * 4);
118  return bounds;
119 }

References Figure::bounds(), SELECT_BOX_MARGIN, and selection_.

Referenced by drawSelf().

Here is the call graph for this function:

◆ drawSelf()

void SelectionFigure::drawSelf ( wxDC *  dc)
protectedvirtual

Draws the selection's figure on the given device context.

Reimplemented from Figure.

Definition at line 61 of file SelectionFigure.cc.

61  {
62  // wxWidgets implementation of SVGFileDC doesnt support dashed lines, so
63  // we draw solid blue line when some item is selected when saving to *.svg
64  bool isSVGcontext = false;
65 
66 #if wxCHECK_VERSION(3, 0, 0)
67  if (dynamic_cast<wxSVGFileDC*> (dc)) {
68  isSVGcontext = true;
69  }
70 #endif
71 
72  // Draw blue rectangles around selected EditParts figures.
73  if (selection_ != NULL) {
74 
75  wxPen pen = wxPen(wxColour(0,0,255), 2, wxSHORT_DASH);
76  if (isSVGcontext) {
77  pen.SetStyle(wxSOLID);
78  }
79  wxBrush brush = wxBrush(wxColor(0,0,0), wxTRANSPARENT);
80  dc->SetBrush(brush);
81  dc->SetPen(pen);
82  wxRect bounds = selection_->bounds();
83  dc->DrawRectangle(
86  bounds.GetWidth() + 2*SELECT_BOX_MARGIN,
87  bounds.GetHeight() + 2*SELECT_BOX_MARGIN);
88  }
89 }

References bounds(), Figure::bounds(), SELECT_BOX_MARGIN, and selection_.

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.

◆ setSelection()

void SelectionFigure::setSelection ( Figure selection)

Set the selected figure.

Selection figure will be drawn around the selected figure.

Parameters
selectionFigure of the selected part.

Definition at line 100 of file SelectionFigure.cc.

100  {
101  selection_ = selection;
102 }

References selection_.

Referenced by SelectTool::leftClick().

Member Data Documentation

◆ SELECT_BOX_MARGIN

const int SelectionFigure::SELECT_BOX_MARGIN = 4
staticprivate

Width of the margin between the part figure and selection box.

Definition at line 65 of file SelectionFigure.hh.

Referenced by bounds(), and drawSelf().

◆ selection_

Figure* SelectionFigure::selection_
private

Selected part figure.

Definition at line 62 of file SelectionFigure.hh.

Referenced by bounds(), drawSelf(), and setSelection().


The documentation for this class was generated from the following files:
Figure::bounds
virtual wxRect bounds() const
SelectionFigure::bounds
virtual wxRect bounds() const
Definition: SelectionFigure.cc:111
SelectionFigure::selection_
Figure * selection_
Selected part figure.
Definition: SelectionFigure.hh:62
Figure::Figure
Figure()
Definition: Figure.cc:44
SelectionFigure::SELECT_BOX_MARGIN
static const int SELECT_BOX_MARGIN
Width of the margin between the part figure and selection box.
Definition: SelectionFigure.hh:65