/* @(#)Z 1.3 com/src/ui/FocusItr.cpp, odui, od96nt, odnt9712d 97/03/21 16:49:04 (96/07/15 18:26:33) */
//====START_GENERATED_PROLOG======================================
//
//
//   COMPONENT_NAME: odui
//
//   CLASSES: none
//
//   ORIGINS: 82,27
//
//
//   (C) COPYRIGHT International Business Machines Corp. 1995,1996
//   All Rights Reserved
//   Licensed Materials - Property of IBM
//   US Government Users Restricted Rights - Use, duplication or
//   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
//   	
//   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
//   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
//   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
//   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
//   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
//   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
//   OR PERFORMANCE OF THIS SOFTWARE.
//
//====END_GENERATED_PROLOG========================================
//
/*
	File:		FocusItr.cpp

	Contains:	xxx put contents here xxx

	Owned by:	xxx put writers here xxx

	Copyright:	© 1994 - 1995 by Apple Computer, Inc., all rights reserved.

	Change History (most recent first):

		 <7>	  8/3/95	RR		#1257260: Collapse B classes. Remove
									somInit methods. Don't call IsInitialized
									or SubclassResponsibility
		 <6>	 6/22/95	RR		Call InitObject
		 <5>	 5/26/95	RR		#1251403: Multithreading naming support
		 <4>	 5/25/95	jpa		List.h --> LinkList.h [1253324]
		 <3>	  4/7/95	RR		#1216618 Added SOM_TRY etc.
		 <2>	 2/22/95	RR		#1209427 Changed private api between
									iterator and iteratee
		 <1>	 9/26/94	RR		first checked in

	To Do:
	In Progress:
*/


/*
 *  This file was generated by the SOM Compiler.
 *  Generated using: 
 *      SOM Emitter emitxtm.dll: somc/smmain.c
 */

#define ODFocusSetIterator_Class_Source
#define VARIABLE_MACROS
#include <FocusItr.xih>

#ifndef SOM_ODFocusSet_xh
#include "FocusSet.xh"
#endif

#ifndef SOM_Module_OpenDoc_Foci_defined
#include "Foci.xh"	// For kODNULLFocus. 
#endif

#ifndef _ARBUTILS_
#include "ArbUtils.h"
#endif

#ifndef _LINKLIST_
#include <LinkList.h>
#endif

#ifndef _EXCEPT_
#include "Except.h"
#endif


#if !defined(_PLATFORM_OS2_) && !defined(_PLATFORM_WIN32_)
#pragma segment ODFocusSet
#endif

SOM_Scope ODTypeToken  SOMLINK ODFocusSetIteratorFirst(ODFocusSetIterator *somSelf, Environment *ev)
{
    ODFocusSetIteratorData *somThis = ODFocusSetIteratorGetData(somSelf);
    ODFocusSetIteratorMethodDebug("ODFocusSetIterator","ODFocusSetIteratorFirst");

	ODTypeToken focus = kODNullFocus;
	
	SOM_TRY

		focus = _fFocusSet->First(ev, _fIteratorID);
	
	SOM_CATCH_ALL
	SOM_ENDTRY
	
	return focus;
}

SOM_Scope ODTypeToken  SOMLINK ODFocusSetIteratorNext(ODFocusSetIterator *somSelf, Environment *ev)
{
    ODFocusSetIteratorData *somThis = ODFocusSetIteratorGetData(somSelf);
    ODFocusSetIteratorMethodDebug("ODFocusSetIterator","ODFocusSetIteratorNext");

	ODTypeToken focus = kODNullFocus;
	
	SOM_TRY

		focus = _fFocusSet->Next(ev, _fIteratorID);
	
	SOM_CATCH_ALL
	SOM_ENDTRY

	return focus;
}

SOM_Scope ODBoolean  SOMLINK ODFocusSetIteratorIsNotComplete(ODFocusSetIterator *somSelf, Environment *ev)
{
    ODFocusSetIteratorData *somThis = ODFocusSetIteratorGetData(somSelf);
    ODFocusSetIteratorMethodDebug("ODFocusSetIterator","ODFocusSetIteratorIsNotComplete");

	ODBoolean isNotComplete = kODFalse;
	
	SOM_TRY

		isNotComplete = _fFocusSet->IsNotComplete(ev, _fIteratorID);
	
	SOM_CATCH_ALL
	SOM_ENDTRY

	return isNotComplete;
}

SOM_Scope void  SOMLINK ODFocusSetIteratorInitFocusSetIterator(ODFocusSetIterator *somSelf, Environment *ev,
		ODFocusSet* focusSet)
{
    ODFocusSetIteratorData *somThis = ODFocusSetIteratorGetData(somSelf);
    ODFocusSetIteratorMethodDebug("ODFocusSetIterator","ODFocusSetIteratorInitFocusSetIterator");

	_fFocusSet = focusSet;

	SOM_TRY
	
		/* Moved from somInit. SOM itself sets fields to zero
		_fFocusSet = kODNULL;
		_fIteratorID = 0;
		*/
		
		somSelf->InitObject(ev);
	
		if (_fFocusSet)
			_fIteratorID = _fFocusSet->AddIterator(ev, somSelf);

	SOM_CATCH_ALL
	SOM_ENDTRY
}


SOM_Scope void  SOMLINK ODFocusSetIteratorsomUninit(ODFocusSetIterator *somSelf)
{
    ODFocusSetIteratorData *somThis = ODFocusSetIteratorGetData(somSelf);
    ODFocusSetIteratorMethodDebug("ODFocusSetIterator","ODFocusSetIteratorsomUninit");


	_fFocusSet->RemoveIterator(somGetGlobalEnvironment(), _fIteratorID);
	_fIteratorID = 0;
	_fFocusSet = kODNULL;
    parent_somUninit(somSelf);
}
