Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::UI::View::SVGViewWidget Class Reference

A light-weight widget containing an Inkscape canvas for rendering an SVG. More...

#include <svg-view-widget.h>

Inheritance diagram for Inkscape::UI::View::SVGViewWidget:
Inkscape::UI::Widget::Bin

Public Member Functions

 SVGViewWidget (SPDocument *document=nullptr)
 
 ~SVGViewWidget () override
 
void setDocument (SPDocument *document)
 
void setResize (int width, int height)
 
- Public Member Functions inherited from Inkscape::UI::Widget::Bin
 Bin (Gtk::Widget *child=nullptr)
 
 Bin (BaseObjectType *cobject, Glib::RefPtr< Gtk::Builder > const &)
 
Gtk::Widget * get_child ()
 Gets the child widget, or nullptr if none.
 
Gtk::Widget const * get_child () const
 Gets the child widget, or nullptr if none.
 
void set_child (Gtk::Widget *child)
 Sets (parents) the child widget, or unsets (unparents) it if child is null.
 
void set_child (Gtk::Widget &child)
 Convenience function: Sets (parents) the child widget.
 
void unset_child ()
 Convenience function: Unsets (unparents) the child widget.
 
template<typename F >
sigc::connection connectBeforeResize (F &&slot)
 Register a handler to run immediately before a resize operation.
 
template<typename F >
sigc::connection connectAfterResize (F &&slot)
 Register a handler to run immediately after a resize operation.
 

Protected Member Functions

void on_size_allocate (int width, int height, int baseline) override
 
- Protected Member Functions inherited from Inkscape::UI::Widget::Bin
void measure_vfunc (Gtk::Orientation orientation, int for_size, int &min, int &nat, int &min_baseline, int &nat_baseline) const override
 

Private Member Functions

bool event (CanvasEvent const &event, DrawingItem *drawing_item)
 Callback connected with drawing_event.
 
void doRescale ()
 Helper function that sets rescale ratio.
 

Private Attributes

std::unique_ptr< UI::Widget::Canvas_canvas
 
bool _clicking = false
 
SPDocument_document = nullptr
 
unsigned _dkey = 0
 
CanvasItemGroup_parent = nullptr
 
CanvasItemDrawing_drawing = nullptr
 
double _hscale = 1.0
 Horizontal scale.
 
double _vscale = 1.0
 Vertical scale.
 
bool _rescale = true
 Whether to rescale automatically.
 
bool _keepaspect = true
 
double _width = 0.0
 
double _height = 0.0
 

Detailed Description

A light-weight widget containing an Inkscape canvas for rendering an SVG.

Definition at line 42 of file svg-view-widget.h.

Constructor & Destructor Documentation

◆ SVGViewWidget()

◆ ~SVGViewWidget()

Inkscape::UI::View::SVGViewWidget::~SVGViewWidget ( )
override

Definition at line 58 of file svg-view-widget.cpp.

References setDocument().

Member Function Documentation

◆ doRescale()

void Inkscape::UI::View::SVGViewWidget::doRescale ( )
private

◆ event()

bool Inkscape::UI::View::SVGViewWidget::event ( CanvasEvent const &  event,
DrawingItem drawing_item 
)
private

Callback connected with drawing_event.

Results in a cursor change over links, and allows clicking them.

Definition at line 127 of file svg-view-widget.cpp.

References _clicking, event(), Inkscape::DrawingItem::getItem(), and Inkscape::inspect_event().

Referenced by event(), and SVGViewWidget().

◆ on_size_allocate()

void Inkscape::UI::View::SVGViewWidget::on_size_allocate ( int  width,
int  height,
int  baseline 
)
overrideprotectedvirtual

Reimplemented from Inkscape::UI::Widget::Bin.

Definition at line 107 of file svg-view-widget.cpp.

References _document, _height, _width, doRescale(), height, and width.

◆ setDocument()

◆ setResize()

void Inkscape::UI::View::SVGViewWidget::setResize ( int  width,
int  height 
)

Member Data Documentation

◆ _canvas

std::unique_ptr<UI::Widget::Canvas> Inkscape::UI::View::SVGViewWidget::_canvas
private

Definition at line 55 of file svg-view-widget.h.

Referenced by doRescale(), and SVGViewWidget().

◆ _clicking

bool Inkscape::UI::View::SVGViewWidget::_clicking = false
private

Definition at line 56 of file svg-view-widget.h.

Referenced by event().

◆ _dkey

unsigned Inkscape::UI::View::SVGViewWidget::_dkey = 0
private

Definition at line 59 of file svg-view-widget.h.

Referenced by setDocument().

◆ _document

SPDocument* Inkscape::UI::View::SVGViewWidget::_document = nullptr
private

Definition at line 58 of file svg-view-widget.h.

Referenced by doRescale(), on_size_allocate(), and setDocument().

◆ _drawing

CanvasItemDrawing* Inkscape::UI::View::SVGViewWidget::_drawing = nullptr
private

Definition at line 61 of file svg-view-widget.h.

Referenced by doRescale(), setDocument(), and SVGViewWidget().

◆ _height

double Inkscape::UI::View::SVGViewWidget::_height = 0.0
private

Definition at line 67 of file svg-view-widget.h.

Referenced by doRescale(), and on_size_allocate().

◆ _hscale

double Inkscape::UI::View::SVGViewWidget::_hscale = 1.0
private

Horizontal scale.

Definition at line 62 of file svg-view-widget.h.

Referenced by doRescale().

◆ _keepaspect

bool Inkscape::UI::View::SVGViewWidget::_keepaspect = true
private

Definition at line 65 of file svg-view-widget.h.

Referenced by doRescale().

◆ _parent

CanvasItemGroup* Inkscape::UI::View::SVGViewWidget::_parent = nullptr
private

Definition at line 60 of file svg-view-widget.h.

◆ _rescale

bool Inkscape::UI::View::SVGViewWidget::_rescale = true
private

Whether to rescale automatically.

Definition at line 64 of file svg-view-widget.h.

Referenced by doRescale().

◆ _vscale

double Inkscape::UI::View::SVGViewWidget::_vscale = 1.0
private

Vertical scale.

Definition at line 63 of file svg-view-widget.h.

Referenced by doRescale().

◆ _width

double Inkscape::UI::View::SVGViewWidget::_width = 0.0
private

Definition at line 66 of file svg-view-widget.h.

Referenced by doRescale(), and on_size_allocate().


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