Minsky
minsky::RavelPopup Class Reference

#include <ravelWrap.h>

Inheritance diagram for minsky::RavelPopup:
Inheritance graph
Collaboration diagram for minsky::RavelPopup:
Collaboration graph

Public Member Functions

 RavelPopup (Ravel &ravel)
 
void mouseDown (float x, float y) override
 
void mouseUp (float x, float y) override
 
void mouseMove (float x, float y) override
 
void mouseOver (float x, float y)
 
void mouseLeave ()
 
bool keyPress (const EventInterface::KeyPressArgs &) override
 handle key press over current itemFocus, More...
 
- Public Member Functions inherited from minsky::RenderNativeWindow
const RenderFrameArgsframeArgs () const
 
 ~RenderNativeWindow () override
 
virtual void init ()
 perform any initialisation of any subclasses of this More...
 
void renderFrame (const RenderFrameArgs &args)
 
void destroyFrame ()
 
void draw ()
 
void requestRedraw ()
 
void macOSXRedraw ()
 
RenderNativeWindowoperator= (const RenderNativeWindow &x)
 
 RenderNativeWindow ()=default
 
 RenderNativeWindow (const RenderNativeWindow &)=default
 
virtual bool hasScrollBars () const
 return whether this window has scrollbars (needed for MacOSX). More...
 
- Public Member Functions inherited from minsky::EventInterface
virtual void controlMouseDown (float x, float y)
 
virtual void zoom (double x, double y, double z)
 
virtual void moveTo (float x, float y)
 move this so that (x,y) is centred More...
 
virtual std::vector< float > position () const
 current centre coordinates More...
 
virtual double zoomFactor () const
 
virtual bool getItemAt (float x, float y)
 item or wire obtained by get*At() calls More...
 
virtual bool getWireAt (float x, float y)
 item or wire obtained by get*At() calls More...
 

Private Member Functions

float localX (float x) const
 
float localY (float y) const
 
bool redraw (int x0, int y0, int width, int height) override
 
 CLASSDESC_ACCESS (RavelPopup)
 

Private Attributes

Ravelravel
 
float width
 
float height
 
float scale =1
 

Additional Inherited Members

- Static Public Member Functions inherited from minsky::RenderNativeWindow
static double scaleFactor ()
 
- Public Attributes inherited from minsky::EventInterface
ItemPtr item
 item or wire obtained by get*At() calls More...
 
WirePtr wire
 item or wire obtained by get*At() calls More...
 
- Static Public Attributes inherited from minsky::RenderNativeWindow
static ecolab::cairo::Colour backgroundColour {0.8,0.8,0.8,1}
 

Detailed Description

Definition at line 37 of file ravelWrap.h.

Constructor & Destructor Documentation

◆ RavelPopup()

minsky::RavelPopup::RavelPopup ( Ravel ravel)
inline

Definition at line 46 of file ravelWrap.h.

46 : ravel(ravel) {}

Member Function Documentation

◆ CLASSDESC_ACCESS()

minsky::RavelPopup::CLASSDESC_ACCESS ( RavelPopup  )
private

◆ keyPress()

bool minsky::RavelPopup::keyPress ( const EventInterface::KeyPressArgs )
overridevirtual

handle key press over current itemFocus,

Parameters
keySymthe X key sym code
utf8utf8 encoded character
statemodifer state 1=shift, 2=caps lock, 4=ctrl, 8=alt
x& y contain mouse coordinates
Returns
true if event handled

Reimplemented from minsky::EventInterface.

Definition at line 893 of file ravelWrap.cc.

References minsky::EventInterface::KeyPressArgs::keySym, minsky::Ravel::onKeyPress(), ravel, minsky::RenderNativeWindow::requestRedraw(), minsky::EventInterface::KeyPressArgs::state, and minsky::EventInterface::KeyPressArgs::utf8.

894  {
895  auto r=ravel.onKeyPress(args.keySym,args.utf8,args.state);
896  if (r) requestRedraw();
897  return r;
898  }
bool onKeyPress(int, const std::string &, int) override
respond to key press events
Definition: ravelWrap.cc:247
Here is the call graph for this function:

◆ localX()

float minsky::RavelPopup::localX ( float  x) const
private

Definition at line 865 of file ravelWrap.cc.

References scale, and width.

Referenced by mouseDown(), mouseMove(), mouseOver(), and mouseUp().

866  {return scale*(x-0.5*width);}
Here is the caller graph for this function:

◆ localY()

float minsky::RavelPopup::localY ( float  y) const
private

Definition at line 867 of file ravelWrap.cc.

References height, and scale.

Referenced by mouseDown(), mouseMove(), mouseOver(), and mouseUp().

868  {return scale*(y-0.5*height);}
Here is the caller graph for this function:

◆ mouseDown()

void minsky::RavelPopup::mouseDown ( float  x,
float  y 
)
overridevirtual

Reimplemented from minsky::EventInterface.

Definition at line 870 of file ravelWrap.cc.

References localX(), localY(), ravel, minsky::RenderNativeWindow::requestRedraw(), and minsky::Ravel::wrappedRavel.

870  {
871  ravel.wrappedRavel.onMouseDown(localX(x),localY(y));
872  requestRedraw();
873  }
float localX(float x) const
Definition: ravelWrap.cc:865
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
float localY(float y) const
Definition: ravelWrap.cc:867
Here is the call graph for this function:

◆ mouseLeave()

void minsky::RavelPopup::mouseLeave ( )

Definition at line 888 of file ravelWrap.cc.

References ravel, minsky::RenderNativeWindow::requestRedraw(), and minsky::Ravel::wrappedRavel.

888  {
889  ravel.wrappedRavel.onMouseLeave();
890  requestRedraw();
891  }
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
Here is the call graph for this function:

◆ mouseMove()

void minsky::RavelPopup::mouseMove ( float  x,
float  y 
)
overridevirtual

Reimplemented from minsky::EventInterface.

Definition at line 878 of file ravelWrap.cc.

References localX(), localY(), ravel, minsky::RenderNativeWindow::requestRedraw(), and minsky::Ravel::wrappedRavel.

878  {
879  ravel.wrappedRavel.onMouseMotion(localX(x),localY(y));
880  requestRedraw();
881  }
float localX(float x) const
Definition: ravelWrap.cc:865
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
float localY(float y) const
Definition: ravelWrap.cc:867
Here is the call graph for this function:

◆ mouseOver()

void minsky::RavelPopup::mouseOver ( float  x,
float  y 
)

Definition at line 882 of file ravelWrap.cc.

References minsky::Ravel::broadcastStateToLockGroup(), localX(), localY(), minsky::minsky(), ravel, minsky::RenderNativeWindow::requestRedraw(), minsky::Minsky::requestReset(), and minsky::Ravel::wrappedRavel.

882  {
883  ravel.wrappedRavel.onMouseOver(localX(x),localY(y));
885  minsky().requestReset();
886  requestRedraw();
887  }
void requestReset()
Definition: minsky.cc:467
float localX(float x) const
Definition: ravelWrap.cc:865
void broadcastStateToLockGroup() const
Definition: ravelWrap.cc:570
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
Minsky & minsky()
global minsky object
Definition: minskyTCL.cc:51
float localY(float y) const
Definition: ravelWrap.cc:867
Here is the call graph for this function:

◆ mouseUp()

void minsky::RavelPopup::mouseUp ( float  x,
float  y 
)
overridevirtual

Reimplemented from minsky::EventInterface.

Definition at line 874 of file ravelWrap.cc.

References localX(), localY(), ravel, minsky::RenderNativeWindow::requestRedraw(), and minsky::Ravel::wrappedRavel.

874  {
875  ravel.wrappedRavel.onMouseUp(localX(x),localY(y));
876  requestRedraw();
877  }
float localX(float x) const
Definition: ravelWrap.cc:865
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
float localY(float y) const
Definition: ravelWrap.cc:867
Here is the call graph for this function:

◆ redraw()

bool minsky::RavelPopup::redraw ( int  x0,
int  y0,
int  width,
int  height 
)
overrideprivate

Definition at line 851 of file ravelWrap.cc.

References height, ravel, scale, width, and minsky::Ravel::wrappedRavel.

852  {
853  if (!surface.get()) return false;
854  this->width=width; this->height=height;
855  const ecolab::cairo::CairoSave cs(surface->cairo());
856  cairo_translate(surface->cairo(),0.5*width,0.5*height);
857  auto z=0.4*min(width,height)/ravel.wrappedRavel.radius();
858  scale=1/z;
859  cairo_scale(surface->cairo(), z,z);
860  CairoRenderer cr(surface->cairo());
861  ravel.wrappedRavel.render(cr);
862  return true;
863  }
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80

Member Data Documentation

◆ height

float minsky::RavelPopup::height
private

Definition at line 40 of file ravelWrap.h.

Referenced by localY(), and redraw().

◆ ravel

Ravel& minsky::RavelPopup::ravel
private

Definition at line 39 of file ravelWrap.h.

Referenced by keyPress(), mouseDown(), mouseLeave(), mouseMove(), mouseOver(), mouseUp(), and redraw().

◆ scale

float minsky::RavelPopup::scale =1
private

Definition at line 40 of file ravelWrap.h.

Referenced by localX(), localY(), and redraw().

◆ width

float minsky::RavelPopup::width
private

Definition at line 40 of file ravelWrap.h.

Referenced by localX(), and redraw().


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