{
if (tag == theTag ) return this;
View * res = NULL;
for (View * v = child; v != NULL; v = v -> prev )
if ((res = v -> viewWithTag (theTag )) != NULL ) return res;
return res;
}
void View :: addSubView (View * sub View ) {
if ( child != NULL )
child -> next = subView;
subView -> prev = child; child = subView;

5. Принципы построения пользовательского интерфейс

}
void View ;: setFrame (int x, int y, int width, int height) {
Rect r ( x, y, x + width - 1, y + height - 1 );
if (r != area ) {
Rect updateRect = area;
updateRect |= r; area = r;
if ( parent != NULL )
parent -> local2Screen ( updateRect);
screen.rebuildMap ();
screen.redrawRect ( updateRect);
}
}
Rect View :: getScreenRect () const {
Rect r (area );
if ( parent != NULL )
parent -> loca!2Screen {r );
return r;
}
Point& View :: local2Screen ( Point& p ) const {
for ( View * w = (View *) this; w != NULL; w = w -> parent) {
p.x += w -> area.xl; p.y += w -> area.yl;
}
return p;
}
Rect& View :: local2Screen ( Rect& r) const {
for ( View * w = (View *) this; w != NULL; w = w -> parent) r.move (w -> area.xl, w -> area.yl );
return r;
}
Points View :: screen2Locai ( Point& p ) const {
for ( View * w = (View *) this; w != NULL; w = w -> parent) {
p.x -= w -> area.xl; p.y -= w -> area.yl;
}
return p;

Компьютерная графика. Полигональные модели

Rect& View :: screen2Local ( Rect& r) const {
for ( View * w = (View *) this; w != NULL; w = w -> parent) r.move (- w -> area.xl, - w -> area.yl );
return r;
}
void View :: enableView (int flag ) {
if (flag)
status |= WS_ENABLED;
else
status &= ~WS_ENABLED;
}
void View :: beginDraw () const {
Rect clipRect ( getScreenRect ()); Point org ( 0, 0 );
clipRect &= screenRect;
local2Screen (org );
screenSurface -> setOrg ( org ); hideMouseCursor ();
}
void View :: endDraw () const {
showMouseCursor ();
}
void View :: repaint () const {
if (isVisible () && lisLocked ()) {
Rect clipRect (getScreenRect ());
clipRect &= screenRect;

⇐ Предыдущая| |Следующая ⇒