#ifdef __PRIVATE__
//#
//#	File:		Arbitrat.idl
//#
//#	Contains:	xxx put contents here xxx
//#
//#	Written by:	xxx put writers here xxx
//#
//#	Copyright:	c 1994 by Apple Computer, Inc., all rights reserved.
//#
//#	Change History (most recent first):
//#
//#		 <5>	10/18/94	RR		Removed unused private methods
//#									BeginRequestFocus etc.
//#		 <4>	  9/1/94	CC		RADAR #1181971 - missing factory methods
//#									(for JBS)
//#		 <3>	  8/4/94	eeh		bug 1177981: make GetFocusModule public
//#		 <2>	 6/15/94	RR		Added function prefix
//#		 <1>	  6/8/94	RR		first checked in
//#		 <9>	  6/2/94	RR		Testing
//#		 <7>	 5/12/94	RR	inout->in		
//#		 <7>	 5/12/94	RR		
//#
//#	To Do:
//#
#else
//#	Copyright:	c 1993-1994 by Apple Computer, Inc., all rights reserved.
#endif

#ifndef _ARBITRAT_
#define _ARBITRAT_

#ifndef _ODOBJECT_
#include "ODObject.idl"
#endif

//==============================================================================
// Theory of Operation
//==============================================================================

/*
  The arbitrator is used to manage competition for facilities which can only
  be controlled by a single part at a time. These facilities are referred to
  as "focus types". An example is the keystroke focus. Keyboard events are
  sent to the part which has the keystroke focus. Another example is the menu
  focus. One part owns the menu bar at any time. Many focus types are related
  to event distribution, but focus types could also be associated with ports,
  for example.
  
  Rather than having an all-encompassing notion of "active" part, parts simply
  request ownership of a set of focus types. It is possible, in principle, to
  have one part receive keystroke events while another receives sound input,
  though the human interface guidelines may encourage parts to request and 
  relinquish most focus types along with the menu focus.
    
  New focus types can be added. This might be done by a part handler which is
  associated with some exotic input device.
  
  Parts request ownership of a set of focus types. This is necessary to 
  avoid deadlock.
    
*/

//==============================================================================
// Constants
//==============================================================================


//==============================================================================
// Scalar Types
//==============================================================================

//=====================================================================================
// Class defined in this interface
//=====================================================================================

interface  ODArbitrator;

//=====================================================================================
// Classes used by this interface
//=====================================================================================

interface  ODFocusModule;
interface  ODFocusSet;
interface  ODFocusOwnerIterator;
interface  ODSession;
interface  ODFrame;

//=====================================================================================
// Implementation Types
//=====================================================================================

#ifdef __PRIVATE__
typedef somToken DictionaryList;
#endif

//=====================================================================================
// Global Variables
//=====================================================================================

//=====================================================================================
// Class ODArbitrator
//=====================================================================================

interface ODArbitrator :  ODObject
{    
   ODBoolean RequestFocusSet(in ODFocusSet focusSet,
   							  in ODFrame requestingFrame);
    
   ODBoolean RequestFocus(in ODTypeToken focus,
   						   in ODFrame requestingFrame);
        
   void RelinquishFocusSet(in ODFocusSet focusSet,
   						   in ODFrame relinquishingFrame);
        
   void RelinquishFocus(in ODTypeToken focus,
   						in ODFrame relinquishingFrame);
  
   void TransferFocus(in ODTypeToken focus,
   					  in ODFrame transferringFrame,
					  in ODFrame newOwner);
                 
   void TransferFocusSet(in ODFocusSet focusSet, 
   						in ODFrame transferringFrame,
						in ODFrame newOwner);
                 
   ODFrame GetFocusOwner(in ODTypeToken focus);
    
   ODFocusOwnerIterator CreateOwnerIterator(in ODTypeToken focus);
          
   void RegisterFocus(in ODTypeToken focus,
   					  in ODFocusModule focusModule);
      
   void UnregisterFocus(in ODTypeToken focus);

   ODBoolean IsFocusRegistered(in ODTypeToken focus);
  
   ODBoolean IsFocusExclusive(in ODTypeToken focus);
  
   ODFocusModule GetFocusModule(in ODTypeToken focus);
   
   ODFocusSet CreateFocusSet();

#ifdef __PRIVATE__

   void InitArbitrator(in ODSession session);

#endif

#ifdef __SOMIDL__
  implementation
  {
  	functionprefix = ODArbitrator;
	
    override:
		somInit,
		somUninit,
        Purge;
    releaseorder:
        RequestFocusSet,
        RequestFocus,
        RelinquishFocusSet,
        RelinquishFocus,
        TransferFocus,
        TransferFocusSet,
        GetFocusOwner,
        CreateOwnerIterator,
        RegisterFocus,
        UnregisterFocus,
        IsFocusRegistered,
        IsFocusExclusive,
        GetFocusModule,
		CreateFocusSet,
	#ifdef __PRIVATE__
        InitArbitrator;
	#else
		reserved1;
	#endif

		majorversion = 1; minorversion = 0;

    #ifdef __PRIVATE__
	  passthru C_xih = "class DictionaryList;";

      ODSession  		fSession;
      DictionaryList*  	fFocusModules;
    #endif
    
  };
#endif
};

#endif // _ARBITRAT_
