Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
SPILength Class Reference

Length type internal to SPStyle. More...

#include <style-internal.h>

Inheritance diagram for SPILength:
SPIBase TypedSPI< SPAttr::TEXT_INDENT, SPILength > TypedSPI< SPAttr::SHAPE_PADDING, SPILength > TypedSPI< SPAttr::SHAPE_MARGIN, SPILength > TypedSPI< SPAttr::INLINE_SIZE, SPILength > TypedSPI< SPAttr::STROKE_WIDTH, SPILength > TypedSPI< SPAttr::STROKE_DASHOFFSET, SPILength > TypedSPI< SPAttr::INVALID, SPILength > SPILengthOrNormal

Public Member Functions

 SPILength (float value=0)
 
 ~SPILength () override=default
 
void read (gchar const *str) override
 
const Glib::ustring get_value () const override
 
void clear () override
 
void cascade (const SPIBase *const parent) override
 
void merge (const SPIBase *const parent) override
 
SPILengthoperator= (const SPILength &rhs)=default
 
bool equals (const SPIBase &rhs) const override
 
void setDouble (double v)
 
virtual const Glib::ustring toString (bool wname=false) const
 
- Public Member Functions inherited from SPIBase
 SPIBase (bool inherits_=true)
 
virtual ~SPIBase ()=default
 
void readIfUnset (gchar const *str, SPStyleSrc source=SPStyleSrc::STYLE_PROP)
 
void readAttribute (Inkscape::XML::Node *repr)
 
bool shall_write (guint const flags=SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req=SPStyleSrc::STYLE_PROP, SPIBase const *const base=nullptr) const
 Check if this property should be written.
 
virtual const Glib::ustring write (guint const flags=SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req=SPStyleSrc::STYLE_PROP, SPIBase const *const base=nullptr) const
 Compile this style conditionally into a 'name: value' string suitable for css attrs.
 
void overwrite (const SPIBase *const other)
 
void setStylePointer (SPStyle *style_in)
 
SPIBaseoperator= (const SPIBase &rhs)=default
 
bool operator== (const SPIBase &rhs) const
 
virtual SPAttr id () const
 
Glib::ustring const & name () const
 

Public Attributes

unsigned unit: 4
 
float value = 0.f
 
float computed = 0.f
 
- Public Attributes inherited from SPIBase
bool inherits: 1
 
bool set: 1
 
bool inherit: 1
 
bool important: 1
 
SPStyleSrc style_src
 

Private Attributes

float value_default = 0.f
 

Additional Inherited Members

- Protected Member Functions inherited from SPIBase
char const * important_str () const
 
- Protected Attributes inherited from SPIBase
SPStylestyle
 

Detailed Description

Length type internal to SPStyle.

Definition at line 358 of file style-internal.h.

Constructor & Destructor Documentation

◆ SPILength()

SPILength::SPILength ( float  value = 0)
inline

Definition at line 362 of file style-internal.h.

◆ ~SPILength()

SPILength::~SPILength ( )
overridedefault

Member Function Documentation

◆ cascade()

void SPILength::cascade ( const SPIBase *const  parent)
overridevirtual

◆ clear()

void SPILength::clear ( )
inlineoverridevirtual

Reimplemented from SPIBase.

Reimplemented in SPILengthOrNormal.

Definition at line 374 of file style-internal.h.

References SPIBase::clear(), computed, SP_CSS_UNIT_NONE, unit, value, and value_default.

Referenced by SPILengthOrNormal::clear().

◆ equals()

bool SPILength::equals ( const SPIBase rhs) const
overridevirtual

Reimplemented from SPIBase.

Reimplemented in SPILengthOrNormal.

Definition at line 538 of file style-internal.cpp.

References computed, SP_CSS_UNIT_EM, SP_CSS_UNIT_EX, SP_CSS_UNIT_PERCENT, and unit.

Referenced by SPILengthOrNormal::equals().

◆ get_value()

◆ merge()

void SPILength::merge ( const SPIBase *const  parent)
overridevirtual
Todo:
FIXME: Have separate ex ratio parameter. Get x height from libnrtype or pango.

Implements SPIBase.

Reimplemented in SPILengthOrNormal.

Definition at line 479 of file style-internal.cpp.

References computed, SPStyle::font_size, SPIBase::inherit, SPIBase::inherits, parent, SPIBase::set, SP_CSS_UNIT_EM, SP_CSS_UNIT_EX, SP_CSS_UNIT_NONE, SPIBase::style, unit, and value.

Referenced by SPILengthOrNormal::merge().

◆ operator=()

SPILength & SPILength::operator= ( const SPILength rhs)
default

◆ read()

◆ setDouble()

◆ toString()

const Glib::ustring SPILength::toString ( bool  wname = false) const
virtual

Definition at line 523 of file style-internal.cpp.

Member Data Documentation

◆ computed

float SPILength::computed = 0.f

◆ unit

◆ value

◆ value_default

float SPILength::value_default = 0.f
private

Definition at line 396 of file style-internal.h.

Referenced by clear(), and setDouble().


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