model_server/gala/src/genDialog.cxx
//
//  Go through an item list looking for containers.  If a container is found, then
//  go through the container looking for the named item.
//
Go through an item list looking for containers.  If a container is found, then
go through the container looking for the named item.
Go through an item list looking for containers . If a container is found then go through the container looking for the named item .
vdialogItem *GDialog::find_item (vdialogItemList *itemList, const vname *tag) {
    vdialogItem *result = NULL;
    for (int i = 0; i < itemList->GetCount() && !result; i++) {
        vobjectAttributed* vo = itemList->GetAt(i); 
        if (vo->IsKindOf(&vnotebook::Kind)) {
            vdialogItemList* il = vnotebook::CastDown(vo)->GetItemList();
            result = find_item(il, tag);
        } else if (vo->IsKindOf(&vcontainer::Kind)) {
            vcontainer* container = vcontainer::CastDown(vo);
            const vchar *containerTagName = container->GetTag();
            if (containerTagName && (vcharCompare(container->GetTag(), tag) == 0))
	   	result = container;
	    else
            	result = container->FindItem(tag);
            if (!result) {
                vdialogItemList* item_list = container->GetItemList();
                result = find_item(item_list, tag);
            }
        }
    }
    return result;
}
vdialogItem * GDialog :: find_item ( vdialogItemList * itemList , const vname * tag ) { vdialogItem * result = NULL ; for ( int i = 0 ; i < itemList -> GetCount ( ) && ! result ; i ++ ) { vobjectAttributed * vo = itemList -> GetAt ( i ) ; if ( vo -> IsKindOf ( & vnotebook :: Kind ) ) { vdialogItemList * il = vnotebook :: CastDown ( vo ) -> GetItemList ( ) ; result = find_item ( il , tag ) ; } else if ( vo -> IsKindOf ( & vcontainer :: Kind ) ) { vcontainer * container = vcontainer :: CastDown ( vo ) ; const vchar * containerTagName = container -> GetTag ( ) ; if ( containerTagName && ( vcharCompare ( container -> GetTag ( ) , tag ) == 0 ) ) result = container ; else result = container -> FindItem ( tag ) ; if ( ! result ) { vdialogItemList * item_list = container -> GetItemList ( ) ; result = find_item ( item_list , tag ) ; } } } return result ; }
Go through an item list looking for containers.
Go through an item list looking for containers .
// Get next object. // If it is a notebook, recursively check its items. // Else if it is a container, look in it. // If not found, recursively check the container.