Minsky: 3.17.0
minsky::BottomRightResizerItem Struct Reference

#include <item.h>

Inheritance diagram for minsky::BottomRightResizerItem:
Inheritance graph
Collaboration diagram for minsky::BottomRightResizerItem:
Collaboration graph

Public Member Functions

bool onResizeHandle (float x, float y) const override
 
void drawResizeHandles (cairo_t *cairo) const override
 
virtual Point resizeHandleCoords () const
 returns coordinates of the resizer handle More...
 
- Public Member Functions inherited from minsky::Item
 Item ()=default
 
virtual std::weak_ptr< Portports (std::size_t i) const
 callback to be run when item deleted from group More...
 
std::size_t portsSize () const
 number of ports More...
 
float portX (std::size_t i)
 
float portY (std::size_t i)
 
virtual bool contains (float xx, float yy) const
 
bool contains (const Point &p) const
 
void updateBoundingBox () override
 
void throw_error (const std::string &) const
 mark item on canvas, then throw More...
 
virtual bool ioVar () const
 indicates this is a group I/O variable More...
 
virtual double value () const
 current value of output port More...
 
double rotation () const
 
double rotation (const double &r)
 
std::pair< double, bool > rotationAsRadians () const
 return the rotation as radians, and whether rotation should have additional straight angle added for text that stays upright. More...
 
float iWidth () const
 
float iWidth (const float &w)
 
float iHeight () const
 
float iHeight (const float &h)
 
virtual void flip ()
 rotate icon though 180∘ More...
 
virtual std::string classType () const
 
std::string id () const
 return an id uniquely identifying this item More...
 
virtual float x () const
 
virtual float y () const
 
virtual float zoomFactor () const
 
void ensureBBValid () const
 
float width () const
 
float height () const
 
virtual std::vector< Pointcorners () const
 
float left () const
 
float right () const
 
float top () const
 
float bottom () const
 
std::string bookmarkId () const
 Id of bookmark associated with this. More...
 
void adjustBookmark () const override
 adjust bookmark list to reflect current configuration More...
 
float resizeHandleSize () const
 resize handles should be at least a percentage if the icon size (#1025) More...
 
virtual bool inItem (float x, float y) const
 
virtual bool onItem (float x, float y) const
 returns true if (x,y) is on the icon More...
 
virtual void onMouseDown (float x, float y)
 respond to mouse down events More...
 
virtual void onMouseUp (float x, float y)
 respond to mouse up events More...
 
virtual bool onMouseMotion (float x, float y)
 respond to mouse motion events with button pressed More...
 
virtual bool onMouseOver (float x, float y)
 respond to mouse motion events (hover) without button pressed More...
 
virtual void onMouseLeave ()
 respond to mouse leave events (when mouse leaves item) More...
 
virtual bool onKeyPress (int keySym, const std::string &utf8, int state)
 respond to key press events More...
 
virtual void deleteAttachedWires ()
 delete all attached wires More...
 
virtual Itemclone () const
 
virtual bool visible () const
 whether this item is visible on the canvas. More...
 
void moveTo (float x, float y)
 
virtual void draw (cairo_t *cairo) const
 draw this item into a cairo context More...
 
virtual void resize (const LassoBox &b)
 resize this item on the canvas More...
 
virtual float scaleFactor () const
 factor by which item has been resized More...
 
virtual float scaleFactor (const float &sf)
 
void dummyDraw () const
 draw into a dummy cairo context, for purposes of calculating port positions More...
 
virtual void displayTooltip (cairo_t *, const std::string &) const
 display tooltip text, eg on mouseover More...
 
virtual void updateIcon (double t)
 update display after a step() More...
 
 Item (const Item &)=default
 
Itemoperator= (const Item &)=default
 
virtual ~Item ()
 
void drawPorts (cairo_t *cairo) const
 
virtual ClickType::Type clickType (float x, float y) const
 returns the clicktype given a mouse click at x, y. More...
 
virtual std::shared_ptr< PortclosestOutPort (float x, float y) const
 returns closest output port to x,y More...
 
virtual std::shared_ptr< PortclosestInPort (float x, float y) const
 
virtual std::shared_ptr< Itemselect (float x, float y) const
 returns the variable if point (x,y) is within a visible variable icon, null otherwise. More...
 
void RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) override
 runs the RESTProcess descriptor suitable for this type More...
 
void RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) const override
 
virtual void json_pack (classdesc::json_pack_t &j) const
 
virtual void displayDelayedTooltip (float x, float y)
 enable extended tooltip help message appropriate for mouse at (x,y) More...
 
virtual void disableDelayedTooltip ()
 
virtual bool editorMode () const
 some items have an editor mode attribute More...
 
virtual void toggleEditorMode ()
 
virtual Units units (bool check=false) const
 compute the dimensional units More...
 
Units checkUnits () const
 perform units consistency checks More...
 
ItemPtr itemPtrFromThis () const
 return a shared_ptr to this More...
 
virtual void destroyFrame ()
 destroy any popup windows associated with this More...
 
- Public Member Functions inherited from minsky::NoteBase
virtual std::string const & detailedText () const
 
virtual std::string const & detailedText (const std::string &x)
 
virtual std::string const & tooltip () const
 
virtual std::string const & tooltip (const std::string &x)
 
virtual ~NoteBase ()=default
 

Additional Inherited Members

- Static Public Member Functions inherited from minsky::Item
static void drawSelected (cairo_t *cairo)
 
- Public Attributes inherited from minsky::Item
float m_x =0
 
float m_y =0
 position in canvas, or within group More...
 
float m_sf =1
 scale factor of item on canvas, or within group More...
 
bool onResizeHandles =false
 set to true to indicate mouse is ovcaler resize handles More...
 
bool onBorder =false
 true to indicate mouse hovering over border More...
 
std::string deleteCallback
 
BoundingBox bb
 canvas bounding box. More...
 
- Public Attributes inherited from minsky::NoteBase
bool mouseFocus =false
 true if target of a mouseover More...
 
bool selected =false
 true if selected for cut, copy or group operation More...
 
bool bookmark =false
 Is this item also a bookmark? More...
 
- Static Protected Member Functions inherited from minsky::Item
static void drawResizeHandle (cairo_t *cairo, double x, double y, double sf, double angle)
 
- Protected Attributes inherited from minsky::Item
double m_width =20
 
double m_height =20
 
ItemPortVector m_ports
 
minsky::Item::MemoisedRotator memoisedRotator
 

Detailed Description

Definition at line 362 of file item.h.

Member Function Documentation

◆ drawResizeHandles()

void minsky::BottomRightResizerItem::drawResizeHandles ( cairo_t *  cairo) const
overridevirtual

Reimplemented from minsky::Item.

Definition at line 355 of file item.cc.

Referenced by minsky::IntOp::draw(), and minsky::Ravel::draw().

356  {
357  const Point p=resizeHandleCoords();
358  drawResizeHandle(cairo,p.x()-x(),p.y()-y(),resizeHandleSize(),0);
359  cairo_stroke(cairo);
360  }
virtual Point resizeHandleCoords() const
returns coordinates of the resizer handle
Definition: item.cc:205
virtual float x() const
Definition: item.cc:107
virtual float y() const
Definition: item.cc:114
static void drawResizeHandle(cairo_t *cairo, double x, double y, double sf, double angle)
Definition: item.cc:316
boost::geometry::model::d2::point_xy< float > Point
Definition: geometry.h:34
float resizeHandleSize() const
resize handles should be at least a percentage if the icon size (#1025)
Definition: item.h:252
Here is the caller graph for this function:

◆ onResizeHandle()

bool minsky::BottomRightResizerItem::onResizeHandle ( float  x,
float  y 
) const
overridevirtual
Returns
true is (x,y) is located on a resize handle

Reimplemented from minsky::Item.

Definition at line 236 of file item.cc.

References minsky::anonymous_namespace{item.cc}::near().

237  {
238  const Point p=resizeHandleCoords();
239  return near(x,y,p.x(),p.y(),resizeHandleSize());
240  }
virtual Point resizeHandleCoords() const
returns coordinates of the resizer handle
Definition: item.cc:205
virtual float x() const
Definition: item.cc:107
virtual float y() const
Definition: item.cc:114
bool near(float x0, float y0, float x1, float y1, float d)
Definition: item.cc:147
boost::geometry::model::d2::point_xy< float > Point
Definition: geometry.h:34
float resizeHandleSize() const
resize handles should be at least a percentage if the icon size (#1025)
Definition: item.h:252
Here is the call graph for this function:

◆ resizeHandleCoords()

Point minsky::BottomRightResizerItem::resizeHandleCoords ( ) const
virtual

returns coordinates of the resizer handle

Definition at line 205 of file item.cc.

References minsky::quadrant().

206  {
207  // ensure resize handle is always active on the same corner of variable/items. for ticket 1232
208  ensureBBValid();
210  auto left=x()+bb.left()*zoomFactor(), right=x()+bb.right()*zoomFactor();
211  auto top=y()+bb.top()*zoomFactor(), bottom=y()+bb.bottom()*zoomFactor();
212  switch (quadrant(rotation()))
213  {
214  case 0:
215  return memoisedRotator(right,bottom);
216  case 1:
217  return memoisedRotator(right,top);
218  case 2:
219  return memoisedRotator(left,top);
220  case 3:
221  return memoisedRotator(left,bottom);
222  default:
223  assert(false);
224  return {};
225  }
226  }
float bottom() const
Definition: item.h:97
float right() const
Definition: item.cc:170
virtual float x() const
Definition: item.cc:107
virtual float y() const
Definition: item.cc:114
float top() const
Definition: item.cc:177
BoundingBox bb
canvas bounding box.
Definition: item.h:192
virtual float zoomFactor() const
Definition: item.cc:121
minsky::Item::MemoisedRotator memoisedRotator
void ensureBBValid() const
Definition: item.h:238
int quadrant(double x)
return quadrant x is in: 0=[-45,45),1=[45,135), etc
Definition: geometry.h:96
float left() const
Definition: item.cc:163
float right() const
Definition: item.h:95
float left() const
Definition: item.h:94
float bottom() const
Definition: item.cc:184
void update(float a, float x, float y)
Definition: item.h:159
float top() const
Definition: item.h:96
double rotation() const
Definition: item.h:208
Here is the call graph for this function:

The documentation for this struct was generated from the following files: