18 #define _ulength_hpp_ 1 19 #include <ubit/uobject.hpp> 24 enum Type {PX, EM, EX, IN, CM, MM, PT, PC, PERCENT, PERCENT_CTR, AUTO, IGNORE};
27 explicit UUnit(UUnit::Type t) : type(t) {}
29 UUnit& operator=(
const UUnit& u) {type = u.type;
return *
this;}
30 UUnit& operator=(UUnit::Type t) {type = t;
return *
this;}
32 UUnit::Type getType()
const {
return (UUnit::Type)type;}
34 bool operator==(
UUnit u)
const {
return u.type == type;}
35 bool operator==(UUnit::Type t)
const {
return t == type;}
37 bool operator!=(
UUnit u)
const {
return u.type != type;}
38 bool operator!=(UUnit::Type t)
const {
return t != type;}
64 explicit Modes(
unsigned char m) : val(m) {}
67 ULength(
float value = 0.0) : val(value), unit(
UUnit::PX), modes(0) {}
79 bool operator==(
const ULength&)
const;
80 bool operator!=(
const ULength&)
const;
82 operator float()
const {
return val;}
84 float getValue()
const {
return val;}
85 UUnit getUnit()
const {
return unit;}
86 Modes getModes()
const {
return modes;}
88 ULength& setValue(
float value) {val = value;
return *
this;}
90 ULength& setUnit(
const char* unit);
96 UStr toString()
const;
98 float toPixels(
UDisp*,
const UFontDesc&,
float view_len,
float parview_len)
const;
100 friend std::ostream& operator<<(std::ostream& s,
const ULength& l);
112 std::ostream& operator<<(std::ostream&,
const ULength&);
153 void set(
ULength horiz,
ULength vert) {left = right = horiz; top = bottom = vert;}
155 ULength top, right, bottom, left;
ULength(float value=0.0)
creates a new length with the specified value, unit = PX and modes = 0.
Definition: ulength.hpp:67
Length of positions (UPos), sizes (USize) and padding (UPadding)
Definition: ulength.hpp:59
Definition: ulength.hpp:135
Display Context.
Definition: udisp.hpp:44
[impl] Internal representation for fonts.
Definition: ufontImpl.hpp:24
ULength(float value, UUnit u)
creates a new length with the specified value and unit (modes = 0).
Definition: ulength.hpp:70
Definition: ulength.hpp:22
Box padding.
Definition: ulength.hpp:150
Definition: uhardfont.hpp:31
Definition: ulength.hpp:142
Definition: ulength.hpp:61
ULength(float value, UUnit u, Modes m)
creates a new length with the specified value, unit and modes.
Definition: ulength.hpp:73
Ubit String.
Definition: ustr.hpp:72