34 friend std::ostream & operator<<( std::ostream & str,
const wpair & obj );
44 wpair(
int v = 0 ) { A = B = v; }
46 wpair(
int a,
int b ) { A = a; B = b; }
48 wpair(
const wpair & Rhs ) { A = Rhs.A; B = Rhs.B; }
54 wpair & operator= (
const wpair & Rhs ) { A = Rhs.A; B = Rhs.B;
return *
this; }
56 wpair & operator+=(
const wpair & Rhs ) { A += Rhs.A; B += Rhs.B;
return *
this; }
58 wpair & operator-=(
const wpair & Rhs ) { A -= Rhs.A; B -= Rhs.B;
return *
this; }
60 wpair & operator*=(
const wpair & Rhs ) { A *= Rhs.A; B *= Rhs.B;
return *
this; }
62 wpair & operator/=(
const wpair & Rhs ) { A /= Rhs.A; B /= Rhs.B;
return *
this; }
64 wpair operator+(
const wpair & Rhs )
const {
return wpair( A + Rhs.A, B + Rhs.B ); }
66 wpair operator-(
const wpair & Rhs )
const {
return wpair( A - Rhs.A, B - Rhs.B ); }
68 wpair operator*(
const wpair & Rhs )
const {
return wpair( A * Rhs.A, B * Rhs.B ); }
70 wpair operator/(
const wpair & Rhs )
const {
return wpair( A / Rhs.A, B / Rhs.B ); }
74 bool operator==(
const wpair & Rhs )
const {
return A == Rhs.A && B == Rhs.B; }
76 bool operator!=(
const wpair & Rhs )
const {
return A != Rhs.A || B != Rhs.B; }
78 bool operator> (
const wpair & Rhs )
const {
return A > Rhs.A && B > Rhs.B; }
80 bool operator< (
const wpair & Rhs )
const {
return A < Rhs.A && B < Rhs.B; }
82 bool operator>=(
const wpair & Rhs )
const {
return A >= Rhs.A && B >= Rhs.B; }
84 bool operator<=(
const wpair & Rhs )
const {
return A <= Rhs.A && B <= Rhs.B; }
89 return min( max( *
this, Min ), Max );
94 return wpair( Lhs.A < Rhs.A ? Lhs.A : Rhs.A,
95 Lhs.B < Rhs.B ? Lhs.B : Rhs.B );
100 return wpair( Lhs.A > Rhs.A ? Lhs.A : Rhs.A,
101 Lhs.B > Rhs.B ? Lhs.B : Rhs.B );
117 wpos(
int v = 0 ) :
wpair( v ), L( A ), C( B ) {}
119 wpos(
int l,
int c ) :
wpair( l, c ), L( A ), C( B ) {}
129 wpos & operator= (
const wpos & Rhs ) { wpair::operator= ( Rhs );
return *
this; }
131 wpos & operator+=(
const wpair & Rhs ) { wpair::operator+=( Rhs );
return *
this; }
133 wpos & operator-=(
const wpair & Rhs ) { wpair::operator-=( Rhs );
return *
this; }
135 wpos & operator*=(
const wpair & Rhs ) { wpair::operator*=( Rhs );
return *
this; }
137 wpos & operator/=(
const wpair & Rhs ) { wpair::operator/=( Rhs );
return *
this; }
139 wpos operator+(
const wpair & Rhs )
const {
return wpair::operator+( Rhs ); }
141 wpos operator-(
const wpair & Rhs )
const {
return wpair::operator-( Rhs ); }
143 wpos operator*(
const wpair & Rhs )
const {
return wpair::operator*( Rhs ); }
145 wpos operator/(
const wpair & Rhs )
const {
return wpair::operator/( Rhs ); }
161 wsze(
int v = 0 ) :
wpair( v ), H( A ), W( B ) {}
163 wsze(
int h,
int w ) :
wpair( h, w ), H( A ), W( B ) {}
171 wsze & operator= (
const wsze & Rhs ) { wpair::operator= ( Rhs );
return *
this; }
173 wsze & operator+=(
const wpair & Rhs ) { wpair::operator+=( Rhs );
return *
this; }
175 wsze & operator-=(
const wpair & Rhs ) { wpair::operator-=( Rhs );
return *
this; }
177 wsze & operator*=(
const wpair & Rhs ) { wpair::operator*=( Rhs );
return *
this; }
179 wsze & operator/=(
const wpair & Rhs ) { wpair::operator/=( Rhs );
return *
this; }
181 wsze operator+(
const wpair & Rhs )
const {
return wpair::operator+( Rhs ); }
183 wsze operator-(
const wpair & Rhs )
const {
return wpair::operator-( Rhs ); }
185 wsze operator*(
const wpair & Rhs )
const {
return wpair::operator*( Rhs ); }
187 wsze operator/(
const wpair & Rhs )
const {
return wpair::operator/( Rhs ); }
201 wrect() : Pos( 0 ), Sze( 0 ) {}
203 wrect(
const wpos & pos,
const wsze & sze ) : Pos( pos ), Sze( sze ) {}
209 bool operator==(
const wrect & Rhs )
const
211 return Pos == Rhs.Pos && Sze == Rhs.Sze;
214 bool operator!=(
const wrect & Rhs )
const {
return !operator==( Rhs ); }
223 incpos.L = decsze.H = 0;
226 incpos.C = decsze.W = 0;
228 return wrect( Pos + incpos, Sze - decsze );
232 wrect intersectRelTo(
const wrect & par )
const
235 if ( !( Pos < par.Sze ) )
242 ret.Sze.H = par.Sze.H - ret.Pos.L;
245 ret.Sze.W = par.Sze.W - ret.Pos.C;
247 if ( !( ret.Pos + ret.Sze >= 0 ) )
255 ret.Sze.H += ret.Pos.L;
261 ret.Sze.W += ret.Pos.C;
266 ret.Sze = wpair::min( ret.Sze, par.Sze - ret.Pos );
Screen position pair in the order line, column: (L, C)
Definition position.h:110
A rectangle is defined by its position and size: wpos Pos, wsze Sze.
Definition position.h:194
Screen dimension (screen size) in the order height, width: (H, W)
Definition position.h:154