Ipelib

Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
ipe::Canvas Class Reference
Ipe canvas

`#include <ipecanvas_win.h>`

Inherits ipe::CanvasBase, QWidget, ipe::CanvasBase, and ipe::CanvasBase.

## Public Member Functions
| Canvas (GtkWidget *parent)
| ~Canvas ()
GtkWidget * | window () const
| Canvas (QWidget *parent, Qt::WFlags f=0)
virtual void | setCursor (TCursor cursor, double w=1.0, Color *color=nullptr)
| Canvas (HWND parent, HINSTANCE hInstance=nullptr)
HWND | windowId () const
Public Member Functions inherited from ipe::CanvasBase
virtual | ~CanvasBase ()
void | setPage (const Page *page, int pno, int view, const Cascade *sheet)
void | setResources (const PdfResources *resources)
Vector | pan () const
double | zoom () const
const Cascade * | cascade () const
Vector | center () const
Vector | pos () const
Vector | unsnappedPos () const
Vector | globalPos () const
Vector | simpleSnapPos () const
const Snap & | snap () const
void | setInkMode (bool ink)
int | additionalModifiers () const
void | setAdditionalModifiers (int mod)
Vector | devToUser (const Vector &arg) const
Vector | userToDev (const Vector &arg) const
void | setCanvasStyle (const Style &style)
Style | canvasStyle () const
void | setPan (const Vector &v)
void | setZoom (double zoom)
void | setSnap (const Snap &s)
void | setDimmed (bool dimmed)
void | setAutoOrigin (const Vector &v)
Matrix | canvasTfm () const
void | setObserver (CanvasObserver *observer)
void | setFifiVisible (bool visible)
void | setSelectionVisible (bool visible)
void | setTool (Tool *tool)
void | finishTool ()
Tool * | tool ()
void | update ()
void | updateTool ()
int | canvasWidth () const
int | canvasHeight () const

## Static Public Member Functions
static void | init (HINSTANCE hInstance)
static UINT | getDpiForWindow (HWND hwnd)
static HBITMAP | createBitmap (uint8_t *p, int w, int h)
Static Public Member Functions inherited from ipe::CanvasBase
static int | selectPageOrView (Document *doc, int page=-1, int startIndex=0, int pageWidth=240, int width=600, int height=480)

## Protected Member Functions
virtual void | invalidate ()
virtual void | invalidate (int x, int y, int w, int h)
void | drawFifi (QPainter &q)
virtual void | paintEvent (QPaintEvent *ev)
void | mouseButton (QMouseEvent *ev, int button, bool press)
virtual void | mouseDoubleClickEvent (QMouseEvent *ev)
virtual void | mousePressEvent (QMouseEvent *ev)
virtual void | mouseReleaseEvent (QMouseEvent *ev)
virtual void | mouseMoveEvent (QMouseEvent *ev)
virtual void | tabletEvent (QTabletEvent *ev)
virtual void | wheelEvent (QWheelEvent *ev)
virtual void | keyPressEvent (QKeyEvent *ev)
virtual QSize | sizeHint () const
Protected Member Functions inherited from ipe::CanvasBase
| CanvasBase ()
void | drawPaper (cairo_t *cc)
void | drawFrame (cairo_t *cc)
void | drawAxes (cairo_t *cc)
void | drawGrid (cairo_t *cc)
void | drawObjects (cairo_t *cc)
void | drawTool (Painter &painter)
void | snapToPaperAndFrame ()
void | refreshSurface ()
void | computeFifi (double x, double y)
void | drawFifi (cairo_t *cr)

## Additional Inherited Members
Public Types inherited from ipe::CanvasBase
enum | TModifiers { EShift = 0x100, EControl = 0x200, EAlt = 0x400, EMeta = 0x800, ECommand = 0x1000 }
enum | TCursor { EStandardCursor, EHandCursor, ECrossCursor, EDotCursor }
Protected Attributes inherited from ipe::CanvasBase
CanvasObserver * | iObserver
Tool * | iTool
const Page * | iPage
int | iPageNumber
int | iView
const Cascade * | iCascade
Style | iStyle
Vector | iPan
double | iZoom
Snap | iSnap
bool | iDimmed
bool | iAutoSnap
Vector | iAutoOrigin
int | iAdditionalModifiers
bool | isInkMode
bool | iRepaintObjects
double | iWidth
double | iHeight
double | iBWidth
double | iBHeight
cairo_surface_t * | iSurface
Vector | iUnsnappedMousePos
Vector | iMousePos
Vector | iGlobalPos
Vector | iOldFifi
bool | iFifiVisible
Snap::TSnapModes | iFifiMode
bool | iSelectionVisible
const PdfResources * | iResources
std::unique_ptr< Fonts > | iFonts

## Detailed Description

A widget (control) that displays an Ipe document page.

## Constructor & Destructor Documentation

## ◆ Canvas() [1/3]

Canvas::Canvas | ( | GtkWidget * | parent | ) |

References ~Canvas().

Referenced by ipe::IpeQ(), and Canvas::scrollWheel().

## ◆ ~Canvas()

Canvas::~Canvas | ( |  | ) |

References ipe::CanvasBase::iBHeight, ipe::CanvasBase::iBWidth, ipe::CanvasBase::iHeight, ipe::CanvasBase::iRepaintObjects, ipe::CanvasBase::iSurface, ipe::CanvasBase::iView, ipe::CanvasBase::iWidth, ipe::CanvasBase::refreshSurface(), and ipe::size().

Referenced by Canvas().

## ◆ Canvas() [2/3]

Canvas::Canvas | ( | QWidget * | parent,
|  | Qt::WFlags | f = `0`
| ) |  |

Construct a new canvas.

## ◆ Canvas() [3/3]

Canvas::Canvas | ( | HWND | parent,
|  | HINSTANCE | hInstance = `nullptr`
| ) |  |

## Member Function Documentation

## ◆ window()

GtkWidget* ipe::Canvas::window | ( |  | ) | const
| inline

Referenced by Canvas::drawRect().

## ◆ setCursor()

virtual void ipe::Canvas::setCursor | ( | TCursor | cursor,
|  | double | w = `1.0`,
|  | Color * | color = `nullptr`
| ) |  |
| virtual

Implements ipe::CanvasBase.

## ◆ invalidate() [1/2]

virtual void ipe::Canvas::invalidate | ( |  | ) |
| protected virtual

Implements ipe::CanvasBase.

## ◆ invalidate() [2/2]

virtual void ipe::Canvas::invalidate | ( | int | x,
|  | int | y,
|  | int | w,
|  | int | h
| ) |  |
| protected virtual

Implements ipe::CanvasBase.

## ◆ drawFifi()

void Canvas::drawFifi | ( | QPainter & | q | ) |
| protected

References ipe::Snap::ESnapAngle, ipe::Snap::ESnapAuto, ipe::Snap::ESnapBd, ipe::Snap::ESnapCtl, ipe::Snap::ESnapGrid, ipe::Snap::ESnapInt, ipe::Snap::ESnapNone, ipe::Snap::ESnapVtx, ipe::CanvasBase::iFifiMode, ipe::CanvasBase::iMousePos, ipe::CanvasBase::iOldFifi, and ipe::CanvasBase::userToDev().

Referenced by Canvas::drawRect(), ipe::IpeQ(), and paintEvent().

## ◆ paintEvent()

void Canvas::paintEvent | ( | QPaintEvent * | ev | ) |
| protected virtual

References ipe::CanvasBase::canvasTfm(), drawFifi(), ipe::CanvasBase::drawTool(), ipe::CanvasBase::iBHeight, ipe::CanvasBase::iBWidth, ipe::CanvasBase::iCascade, ipe::CanvasBase::iFifiVisible, ipe::CanvasBase::iHeight, ipe::CanvasBase::iPage, ipe::CanvasBase::iSurface, ipe::CanvasBase::iWidth, and ipe::CanvasBase::refreshSurface().

Referenced by ipe::IpeQ().

## ◆ mouseButton()

void Canvas::mouseButton | ( | QMouseEvent * | ev,
|  | int | button,
|  | bool | press
| ) |  |
| protected

References ipe::CanvasObserver::canvasObserverMouseAction(), ipe::CanvasBase::computeFifi(), ipe::CanvasBase::iAdditionalModifiers, ipe::CanvasBase::iGlobalPos, ipe::CanvasBase::iObserver, ipe::CanvasBase::iTool, and ipe::Tool::mouseButton().

Referenced by ipe::IpeQ(), mouseDoubleClickEvent(), mousePressEvent(), mouseReleaseEvent(), and windowId().

## ◆ mouseDoubleClickEvent()

void Canvas::mouseDoubleClickEvent | ( | QMouseEvent * | ev | ) |
| protected virtual

References mouseButton().

Referenced by ipe::IpeQ().

## ◆ mousePressEvent()

void Canvas::mousePressEvent | ( | QMouseEvent * | ev | ) |
| protected virtual

References mouseButton().

Referenced by ipe::IpeQ().

## ◆ mouseReleaseEvent()

void Canvas::mouseReleaseEvent | ( | QMouseEvent * | ev | ) |
| protected virtual

References mouseButton().

Referenced by ipe::IpeQ().

## ◆ mouseMoveEvent()

void Canvas::mouseMoveEvent | ( | QMouseEvent * | ev | ) |
| protected virtual

References ipe::CanvasObserver::canvasObserverPositionChanged(), ipe::CanvasBase::computeFifi(), ipe::CanvasBase::iObserver, ipe::CanvasBase::iTool, and ipe::Tool::mouseMove().

Referenced by ipe::IpeQ().

## ◆ tabletEvent()

void Canvas::tabletEvent | ( | QTabletEvent * | ev | ) |
| protected virtual

References ipe::CanvasObserver::canvasObserverMouseAction(), ipe::CanvasObserver::canvasObserverPositionChanged(), ipe::CanvasBase::computeFifi(), ipe::CanvasBase::globalPos(), ipe::CanvasBase::iAdditionalModifiers, ipe::CanvasBase::iGlobalPos, ipe::CanvasBase::iObserver, ipe::CanvasBase::iTool, ipe::Tool::mouseButton(), and ipe::Tool::mouseMove().

Referenced by ipe::IpeQ().

## ◆ wheelEvent()

void Canvas::wheelEvent | ( | QWheelEvent * | ev | ) |
| protected virtual

References ipe::CanvasObserver::canvasObserverWheelMoved(), ipe::CanvasBase::iObserver, and ipe::QPt().

Referenced by ipe::IpeQ().

## ◆ keyPressEvent()

void Canvas::keyPressEvent | ( | QKeyEvent * | ev | ) |
| protected virtual

References ipe::CanvasBase::iAdditionalModifiers, ipe::IpeQ(), ipe::CanvasBase::iTool, and ipe::Tool::key().

Referenced by ipe::IpeQ().

## ◆ sizeHint()

QSize Canvas::sizeHint | ( |  | ) | const
| protected virtual

References ipe::CanvasBase::EAlt, ipe::CanvasBase::EControl, ipe::CanvasBase::ECrossCursor, ipe::CanvasBase::EDotCursor, ipe::CanvasBase::EHandCursor, ipe::CanvasBase::EMeta, ipe::CanvasBase::EShift, ipe::CanvasBase::EStandardCursor, ipe::Color::iBlue, ipe::Color::iGreen, ipe::Fixed::internal(), ipe::Color::iRed, and ipe::CanvasBase::zoom().

Referenced by ipe::IpeQ().

## ◆ init()

void Canvas::init | ( | HINSTANCE | hInstance | ) |
| static

## ◆ getDpiForWindow()

UINT Canvas::getDpiForWindow | ( | HWND | hwnd | ) |
| static

## ◆ windowId()

HWND ipe::Canvas::windowId | ( |  | ) | const
| inline

References createBitmap(), and mouseButton().

## ◆ createBitmap()

static HBITMAP ipe::Canvas::createBitmap | ( | uint8_t * | p,
|  | int | w,
|  | int | h
| ) |  |
| static

Referenced by windowId().

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

- ipecanvas_gtk.h
- ipecanvas_win.h
- ipecanvas_qt.h
- ipecanvas_cocoa.cpp
- ipecanvas_gtk.cpp
- ipecanvas_qt.cpp
- ipecanvas_win.cpp