41 #ifndef _uiunifieddim_h
42 #define _uiunifieddim_h
76 : Rel(Relative), Abs(Absolute) {}
80 : Rel(Other.Rel), Abs(Other.Abs) {}
107 return ( (this->Rel * Actual) + this->Abs );
140 Other.
Abs == 0.0f ? 0.0f : this->Abs / Other.
Abs);
148 this->Rel += Other.
Rel;
149 this->Abs += Other.
Abs;
157 this->Rel -= Other.
Rel;
158 this->Abs -= Other.
Abs;
166 this->Rel *= Other.
Rel;
167 this->Abs *= Other.
Abs;
175 this->Rel = (Other.
Rel == 0.0f ? 0.0f : this->Rel / Other.
Rel);
176 this->Abs = (Other.
Abs == 0.0f ? 0.0f : this->Abs / Other.
Abs);
188 return UnifiedDim( this->Rel * Other, this->Abs * Other );
195 return UnifiedDim( ( Other == 0 ? 0.0 : this->Rel / Other ),
196 ( Other == 0 ? 0.0 : this->Abs / Other ) );
226 return this->Rel == Other.
Rel && this->Abs == Other.
Abs;
233 return this->Rel != Other.
Rel || this->Abs != Other.
Abs;
244 this->Rel = Other.
Rel;
245 this->Abs = Other.
Abs;
275 if( !CurrAttrib.
Empty() )
276 this->Rel = CurrAttrib.
AsReal();
279 if( !CurrAttrib.
Empty() )
280 this->Abs = CurrAttrib.
AsReal();
319 this->X.SetIdentity();
320 this->Y.SetIdentity();
334 this->X.SetValues(Xrel,Xabs);
335 this->Y.SetValues(Yrel,Yabs);
340 : X(Other.X), Y(Other.Y) {}
362 this->X.SetValues(Xrel,Xabs);
363 this->Y.SetValues(Yrel,Yabs);
368 this->X.SetIdentity();
369 this->Y.SetIdentity();
377 return Vector2( this->X.CalculateActualDimension(Actual.
X),
378 this->Y.CalculateActualDimension(Actual.
Y) );
446 this->X = this->X / Other.
X;
447 this->Y = this->Y / Other.
Y;
459 return UnifiedVec2(this->X + Other, this->Y + Other);
466 return UnifiedVec2(this->X - Other, this->Y - Other);
473 return UnifiedVec2(this->X * Other, this->Y * Other);
516 this->X = this->X / Other;
517 this->Y = this->Y / Other;
529 return UnifiedVec2( this->X * Other, this->Y * Other );
536 return UnifiedVec2( this->X / Other, this->Y / Other );
566 return this->X == Other.
X && this->Y == Other.
Y;
573 return this->X != Other.
X || this->Y != Other.
Y;
617 if( !CurrAttrib.
Empty() )
618 this->X.Rel = CurrAttrib.
AsReal();
621 if( !CurrAttrib.
Empty() )
622 this->Y.Rel = CurrAttrib.
AsReal();
625 if( !CurrAttrib.
Empty() )
626 this->X.Abs = CurrAttrib.
AsReal();
629 if( !CurrAttrib.
Empty() )
630 this->Y.Abs = CurrAttrib.
AsReal();
642 return "UnifiedVec2";
669 this->Position.SetIdentity();
670 this->Size.SetIdentity();
676 : Position(Pos), Size(Area) {}
684 this->Position.SetValues(PositionX,PositionY);
685 this->Size.SetValues(SizeX,SizeY);
697 const Real& PositionXabs,
const Real& PositionYabs,
const Real& SizeXabs,
const Real& SizeYabs)
699 this->Position.SetValues(PositionXrel,PositionYrel,PositionXabs,PositionYabs);
700 this->Size.SetValues(SizeXrel,SizeYrel,SizeXabs,SizeYabs);
713 this->Position = Pos;
723 this->Position.SetValues(PositionX,PositionY);
724 this->Size.SetValues(SizeX,SizeY);
736 const Real& PositionXabs,
const Real& PositionYabs,
const Real& SizeXabs,
const Real& SizeYabs)
738 this->Position.SetValues(PositionXrel,PositionYrel,PositionXabs,PositionYabs);
739 this->Size.SetValues(SizeXrel,SizeYrel,SizeXabs,SizeYabs);
744 this->Position.SetIdentity();
745 this->Size.SetIdentity();
753 Vector2 Pos = this->Position.CalculateActualDimensions(Actual.
Size);
754 Vector2 Size = this->Size.CalculateActualDimensions(Actual.
Size);
755 return Rect( ( AsChild ? Pos + Actual.
Position : Pos ), Size );
766 return this->Position == Other.
Position && this->Size == Other.
Size;
773 return this->Position != Other.
Position || this->Size != Other.
Size;
785 this->Size = Other.
Size;
821 if( !CurrAttrib.
Empty() )
822 this->Position.X.Rel = CurrAttrib.
AsReal();
825 if( !CurrAttrib.
Empty() )
826 this->Position.Y.Rel = CurrAttrib.
AsReal();
829 if( !CurrAttrib.
Empty() )
830 this->Size.X.Rel = CurrAttrib.
AsReal();
833 if( !CurrAttrib.
Empty() )
834 this->Size.Y.Rel = CurrAttrib.
AsReal();
837 if( !CurrAttrib.
Empty() )
838 this->Position.X.Abs = CurrAttrib.
AsReal();
841 if( !CurrAttrib.
Empty() )
842 this->Position.Y.Abs = CurrAttrib.
AsReal();
845 if( !CurrAttrib.
Empty() )
846 this->Size.X.Abs = CurrAttrib.
AsReal();
849 if( !CurrAttrib.
Empty() )
850 this->Size.Y.Abs = CurrAttrib.
AsReal();
862 return "UnifiedRect";