Minsky
minsky::VariablePaneCell Class Reference

#include <variablePane.h>

Collaboration diagram for minsky::VariablePaneCell:
Collaboration graph

Public Member Functions

 VariablePaneCell ()
 
 VariablePaneCell (const VariableValue &var)
 
void reset (cairo_t *cairo)
 
void show ()
 
double width () const
 
double height () const
 
void emplace () const
 
const VariableBasevariable () const
 

Private Member Functions

 CLASSDESC_ACCESS (VariablePaneCell)
 

Private Attributes

VariablePtr var
 
double m_width =0
 
double m_height =0
 
cairo_t * cachedCairo =nullptr
 

Detailed Description

Definition at line 32 of file variablePane.h.

Constructor & Destructor Documentation

◆ VariablePaneCell() [1/2]

minsky::VariablePaneCell::VariablePaneCell ( )
inline

Definition at line 39 of file variablePane.h.

39 {}

◆ VariablePaneCell() [2/2]

minsky::VariablePaneCell::VariablePaneCell ( const VariableValue var)

Definition at line 35 of file variablePane.cc.

References minsky::RenderVariable::draw(), m_height, and m_width.

35  :
36  var(var.type(), ':'+uqName(var.name))
37  {
38  const ecolab::cairo::Surface surf
39  (cairo_recording_surface_create(CAIRO_CONTENT_COLOR_ALPHA,NULL));
40  cairo_move_to(surf.cairo(),0,0);
41  RenderVariable rv(*this->var, surf.cairo());
42  rv.draw();
43  double l,t;
44  cairo_recording_surface_ink_extents(surf.surface(),&l,&t,&m_width,&m_height);
45  }
std::string uqName(const std::string &name)
extract unqualified portion of name
Definition: valueId.cc:135
Here is the call graph for this function:

Member Function Documentation

◆ CLASSDESC_ACCESS()

minsky::VariablePaneCell::CLASSDESC_ACCESS ( VariablePaneCell  )
private

◆ emplace()

void minsky::VariablePaneCell::emplace ( ) const

Definition at line 57 of file variablePane.cc.

References minsky::Canvas::addVariable(), minsky::Minsky::canvas, minsky::minsky(), minsky::VariableType::undefined, and var.

Referenced by minsky::VariablePane::mouseDown().

58  {
59  if (var && var->type()!=VariableType::undefined)
60  minsky().canvas.addVariable(var->rawName(), var->type());
61  }
void addVariable(const std::string &name, VariableType::Type type)
item or wire obtained by get*At() calls
Definition: canvas.h:187
Canvas canvas
Definition: minsky.h:256
Minsky & minsky()
global minsky object
Definition: minskyTCL.cc:51
Here is the call graph for this function:
Here is the caller graph for this function:

◆ height()

double minsky::VariablePaneCell::height ( ) const
inline

Definition at line 44 of file variablePane.h.

References m_height.

44 {return m_height+4;}

◆ reset()

void minsky::VariablePaneCell::reset ( cairo_t *  cairo)
inline

Definition at line 41 of file variablePane.h.

References cachedCairo.

41 {cachedCairo=cairo;}

◆ show()

void minsky::VariablePaneCell::show ( )

Definition at line 47 of file variablePane.cc.

References cachedCairo, minsky::RenderVariable::draw(), m_height, m_width, minsky::VariableType::undefined, and var.

48  {
49  if (!cachedCairo || !var || var->type()==VariableType::undefined) return;
50  RenderVariable rv(*var, cachedCairo);
51  const ecolab::cairo::CairoSave cs(cachedCairo);
52  cairo_translate(cachedCairo,0.5*m_width,0.5*m_height);
53  rv.draw();
54  cairo_reset_clip(cachedCairo);
55  }
Here is the call graph for this function:

◆ variable()

const VariableBase & minsky::VariablePaneCell::variable ( ) const

Definition at line 63 of file variablePane.cc.

References var.

64  {
65  if (var) return *var;
66  static const Variable<VariableType::undefined> undefined;
67  return undefined;
68  }

◆ width()

double minsky::VariablePaneCell::width ( ) const
inline

Definition at line 43 of file variablePane.h.

References m_width.

43 {return m_width+2;}

Member Data Documentation

◆ cachedCairo

cairo_t* minsky::VariablePaneCell::cachedCairo =nullptr
private

Definition at line 36 of file variablePane.h.

Referenced by reset(), and show().

◆ m_height

double minsky::VariablePaneCell::m_height =0
private

Definition at line 35 of file variablePane.h.

Referenced by height(), show(), and VariablePaneCell().

◆ m_width

double minsky::VariablePaneCell::m_width =0
private

Definition at line 35 of file variablePane.h.

Referenced by show(), VariablePaneCell(), and width().

◆ var

VariablePtr minsky::VariablePaneCell::var
private

Definition at line 34 of file variablePane.h.

Referenced by emplace(), show(), and variable().


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