if ( style & WS_COMPLETELYVISlBLE ) {
Rect drawRect ( 0, 0, width () -1,
height () -1 );
screenSurface -> beginDraw (); beginDraw (); draw (drawRect); endDraw ();
screenSurface -> endDraw ();
}
else
screen.redrawRect ( clipRect );
}
}
void View :: lock (int flag )
5. Принципы построения пользовательского интерфейс
{
if (flag )
lockCount++;
else
lockCount--;
}
View * View :: getFirstTab () const {
if ( child == NULL ) return NULL;
for (View * w = child; w -> prev != NULL; w = w -> prev )
while (w!=NULL && !(w->isVisible () && w->isEnabled ())) w = w -> next;
return w;
}
void View :: setZOrder (View * behind ) {
if ( prev != NULL ) // remove from chain
prev -> next = next;
if ( next != NULL )
next -> prev = prev;
if ( parent != NULL && parent -> child == this ) parent -> child = prev;
if ( behind == NULL ) // set above all children {
if ( parent != NULL ) {
if ( parent -> child != this ) {
parent -> child -> next = this; prev = parent -> child;
next = NULL;
parent -> child = this;
}
}
}
else
{
if (( prev = behind -> prev ) != NULL ) behind -> prev -> next = this;
next = behind; behind -> prev = this;
}
screen.rebuildMap ();
screen.redrawRect ( getScreenRect ());
}
View * View :: hookWindow (View * whome )
мпьютерная графика. Полигональные модели
{
View * oldHook = whome -> hook; whome -> hook = this; return oldHook;
}
int View :: containsFocus () const {
for (View * w = focusedView; w != NULL; w = w -> parent) if (w == this )
return TRUE;
return FALSE;
}
llllllllllllilllllllllllllllllllllllllllllillllllllllllllli int setFocus (View * view )
r
i
if (focusedView == view ) // check if already focused
return TRUE;
// check whether we can set focus // to this view (it's visible & enabled) for (View * v = view; v !- NULL; v = v -> parent) if (! v -> isVisibie ())
return FALSE; // cannot set focus on invisible window
if ( view != NULL && ! view -> isEnabled ())
return FALSE; // cannot set focus on disabled window