Minsky: 3.17.0
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 ()
 
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 892 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.

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

◆ localX()

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

Definition at line 864 of file ravelWrap.cc.

References scale, and width.

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

865  {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 866 of file ravelWrap.cc.

References height, and scale.

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

867  {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 869 of file ravelWrap.cc.

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

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

◆ mouseLeave()

void minsky::RavelPopup::mouseLeave ( )

Definition at line 887 of file ravelWrap.cc.

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

887  {
888  ravel.wrappedRavel.onMouseLeave();
889  requestRedraw();
890  }
ravelCAPI::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 877 of file ravelWrap.cc.

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

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

◆ mouseOver()

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

Definition at line 881 of file ravelWrap.cc.

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

881  {
882  ravel.wrappedRavel.onMouseOver(localX(x),localY(y));
884  minsky().requestReset();
885  requestRedraw();
886  }
void requestReset()
Definition: minsky.cc:466
float localX(float x) const
Definition: ravelWrap.cc:864
void broadcastStateToLockGroup() const
Definition: ravelWrap.cc:569
Minsky & minsky()
global minsky object
Definition: addon.cc:545
float localY(float y) const
Definition: ravelWrap.cc:866
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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 873 of file ravelWrap.cc.

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

873  {
874  ravel.wrappedRavel.onMouseUp(localX(x),localY(y));
875  requestRedraw();
876  }
float localX(float x) const
Definition: ravelWrap.cc:864
float localY(float y) const
Definition: ravelWrap.cc:866
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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 850 of file ravelWrap.cc.

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

851  {
852  if (!surface.get()) return false;
853  this->width=width; this->height=height;
854  const ecolab::cairo::CairoSave cs(surface->cairo());
855  cairo_translate(surface->cairo(),0.5*width,0.5*height);
856  auto z=0.4*min(width,height)/ravel.wrappedRavel.radius();
857  scale=1/z;
858  cairo_scale(surface->cairo(), z,z);
859  CairoRenderer cr(surface->cairo());
860  ravel.wrappedRavel.render(cr);
861  return true;
862  }
ravelCAPI::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: