Files
eepp/include/eepp/ui/css/stylesheetlength.hpp
Martín Lucas Golini 2b5454b041 Small fix in the syntax tokenizer.
Fix in the key events received by the UICodeEditor.
Reimplemented TextDocument::insert to improve performance.
Dragged Tab relative position fix.
Removed incorrect KeyDown event.
Minor UI tweaks.
2020-06-27 06:54:22 -03:00

77 lines
1.5 KiB
C++

#ifndef EE_UI_CSS_STYLESHEETLENGTH_HPP
#define EE_UI_CSS_STYLESHEETLENGTH_HPP
#include <eepp/config.hpp>
#include <eepp/math/size.hpp>
#include <eepp/scene/scenenode.hpp>
#include <string>
using namespace EE::Math;
namespace EE { namespace UI { namespace CSS {
class EE_API StyleSheetLength {
public:
enum Unit {
Percentage,
In,
Cm,
Mm,
Em,
Ex,
Pt,
Pc,
Px,
Dpi,
Dp,
Dpcm,
Vw,
Vh,
Vmin,
Vmax,
Rem,
};
static Unit unitFromString( std::string unitStr );
static std::string unitToString( const Unit& unit );
StyleSheetLength();
StyleSheetLength( const Float& val, const Unit& unit );
StyleSheetLength( std::string val, const Float& defaultValue = 0 );
StyleSheetLength( const StyleSheetLength& val );
void setValue( const Float& val, const Unit& units );
const Float& getValue() const;
const Unit& getUnit() const;
Float asPixels( const Float& parentSize, const Sizef& viewSize, const Float& displayDpi,
const Float& elFontSize = 12, const Float& globalFontSize = 12 ) const;
Float asDp( const Float& parentSize, const Sizef& viewSize, const Float& displayDpi,
const Float& elFontSize = 12, const Float& globalFontSize = 12 ) const;
bool operator==( const StyleSheetLength& val );
StyleSheetLength& operator=( const StyleSheetLength& val );
StyleSheetLength& operator=( const Float& val );
static StyleSheetLength fromString( std::string str, const Float& defaultValue = 0 );
std::string toString() const;
protected:
Unit mUnit;
Float mValue;
};
}}} // namespace EE::UI::CSS
#endif