}
inmmnunnmminimiimiinttmiuuni
static Map screen ( 2000 );
///////////////////// View methods /////////////////////
View :: View (int x, int y, int w, int h, View * p ): area (x, y, x + w-1,y + h-1 )
{
style = 0;
status =0;
lockCount = 0; // initially not locked
tag = -1; // default tag
child = NULL;
prev = NULL;
next = NULL;
delegate = p; // by default all notifications are sent to parent
hook = NULL;
text = (char *) malloc ( 80 );
strcpy (text,"");
if (( parent = p ) != NULL )
parent -> addSubView (this );
}
View:: View () {
parent = deskTop;
text = (char *) malloc ( 80 );
}
View :: -View () {
hide ();
Компьютерная графика. Полигональные модели
while ( child != NULL ) // remove all subwindows delete child;
if ( parent != NULL )
if ( parent -> child == this ) parent -> child = prev;
if ( prev != NULL ) // remove from chain
prev -> next = next;
if ( next != NULL )
next -> prev = prev;
free (text);
}
int View :: put ( Store * s ) const {
s -> putString (text); s -> putlnt ( style ); s -> putlnt ( status ); s -> putlnt ( area.xl ); s -> putlnt ( area.yl ); s -> putlnt ( area.x2 ); s -> putlnt ( area.y2 ); s -> putlnt (tag );
int subViewCount = 0;
for ( View * v = child; v -> prev != NULL;
v = v -> prev, subViewCount++ )
s -> putlnt ( subViewCount + 1 );
for (; v != NULL; v = v -> next) s -> putObject (v );
return TRUE;
}
int View :: get (Store * s ) {
text = s -> getString ();
style = s -> getlnt ();
status = s -> getlnt () & ~WS_VISIBLE;
area.xl = s -> getlnt {);
area.yl = s -> getlnt ();
area.x2 = s -> getlnt ();
area.y2 = s -> getlnt ();
tag = s -> getlnt ();
int subViewCount = s -> getlnt ();
for (int i = 0; i < subViewCount; i++ )
addSubView ((View *) s -> getObject ());
return TRUE;
}
D8^^
5. Принципы построения пользовательского интерфейс
void .View :: show () {