if (lisVisible ()) {
status |= WS_VISIBLE;
screen.addView (this, getScreenRect (), 0 ); repaint ();
if ( deskTop == NULL ) deskTop = this;
}
if (isEnabled ()) setFocus (this );
}
void View :; hide () {
if (isVisible ()) {
if ( containsFocus ()) // move focus from this view { II or it's children
for (View * v=prev; v!=NULL; v=v -> prev) if (v->isVisible () && v->isEnabled(j) break;
setFocus ( v != NULL ? v : parent);
}
status ~WS_VISIBLE;
// hide all children for ( View * v = child; v != NULL; v = v -> prev )
{
v -> lockCount ++;
v -> hide ();
v -> lockCount --;
}
if (lisLocked ()) {
screen.rebuildMap ();
screen.redrawRect ( getScreenRect ());
}
if ( deskTop == this ) deskTop = NULL;
}
}
char * View :: setText ( const char * newText) {
free (text);
text = strdup ( newText); repaint ();
sendMessage (delegate, WM_COMMAND, VNJEXTCHANGED, 0, this);
Компьютерная графика. Полигональные модели
return text;
}
int View :: handle ( const Message& m ) { // check whether hook
// intercepts message if ( hook != NULL && hook -> handleHooked ( m )) return TRUE;
switch ( m.code ) {
case WM_KEYDOWN: return keyDown ( m );
case WM_KEYUP:
return keyUp ( m );
case WM_MOUSEMOVE:
return mouseMove ( m );
case WM_LBUTTONDOWN: return mouseDown ( m );
case WM_LBUTTONUP: return mouseUp ( m );
case WMJRBUTTONDOWN:
return rightMouseDown ( m );
case WM_RBUTTONUP:
return rightMouseUp ( m );
case WM_DBLCLICK:
return mouseDoubleClick ( m );
case WM_TRIPLECLICK:
return mouseTripleClick ( m );
case WM__RECEIVEFOCUS: return receiveFocus ( m );
case WM_LOOSEFOCUS: return looseFocus ( m );
case WM_COMMAND: return command ( m );
case WM_TIMER: return timer ( m );
case WM__CLOSE: return close ( m );
}
return FALSE; // unknown message - not processed
}
int View :: keyDown ( const Message& m ) // let parent process it {
return parent != NULL ? parent -> keyDown ( m ): FALSE;
}
5. Принципы построения пользовательского интерфей
int View :: keyUp ( const Message& m ) //let parent process it
{
return parent != NULL ? parent -> keyUp ( m ): FALSE;