home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Arbitrat.h
-
- Contains: XMPArbitrator interface
-
- Written by: Richard Rodseth
-
- Copyright: ⌐ 1993-94 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <28> 2/14/94 RR #1143609.
- relinguishingFrame->transferringFrame in
- TransferFocus
- <27> 2/9/94 NP Tiger Team cleanup.
- <26> 2/7/94 NP Tiger Team doings.
- <25> 2/7/94 NP Tiger Team doings.
- <24> 1/26/94 RR Moved Foci to Foci.h
- <23> 1/21/94 RR Renamed foci
- <22> 1/18/94 RR Added kXMPScrollingFocus
- <21> 1/11/94 Té Init... changes
- <20> 1/10/94 RR Added TransferFocus and TransferFocusSet
- <19> 12/23/93 RR Added "Macintosh:" to focus names
- <18> 12/20/93 RR New init strategy
- <17> 12/8/93 RR Added RequestFocus/RelinquishFocus. Moved
- extra classes to separate files
- <16> 12/6/93 RR Added modal focus
- <15> 12/2/93 CC Removed clipboard focus constant.
- <14> 11/19/93 RR Added IsFocusRegistered
- <13> 10/27/93 CC Added constant for the clipboard focus.
- <12> 10/18/93 CG Added #define id for ASLM
- <11> 8/17/93 RR Use DictionaryList instead of LinkedList
- <10> 8/9/93 NP Added class id string.
- <9> 7/21/93 NP Added a virtual keyword (temporary for
- ASLM).
- <7> 6/15/93 RCR Added session to constructor
- <6> 6/15/93 RCR Changed FocusType back to XMPTypeToken
- <5> 6/15/93 RCR Changed FocusType to ISOStr
- <4> 6/8/93 RCR Added IsFocusExclusive()
- <3> 6/8/93 RCR Added some support for non-exclusive foci
- <2> 4/29/93 RCR Rename Includes
- <1> 4/23/93 RCR first checked in
-
- To Do:
- */
-
- #ifndef _ARBITRAT_
- #define _ARBITRAT_
-
- #ifndef _XMPOBJ_
- #include "XMPObj.h"
- #endif
-
- #ifndef _XMPTYPES_
- #include "XMPTypes.h"
- #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
- //=====================================================================================
-
- class XMPArbitrator;
-
- //=====================================================================================
- // Classes used by this interface
- //=====================================================================================
-
- class XMPFocusModule;
- class XMPFocusSet;
- class XMPFocusOwnerIterator;
- class XMPSession;
- class XMPFrame;
- class DictionaryList;
-
- //=====================================================================================
- // Global Variables
- //=====================================================================================
-
- //=====================================================================================
- // Class XMPArbitrator
- //=====================================================================================
-
- #define kXMPArbitratorID "appl:xmparbitrator$class,1.0.0"
-
- class XMPArbitrator : public XMPObject
- {
- public:
-
- XMPArbitrator();
-
- virtual ~XMPArbitrator();
-
- XMPNVMethod void InitArbitrator(XMPSession* session);
-
- XMPMethod XMPSize Purge(XMPSize size);
-
- XMPMethod XMPBoolean RequestFocusSet(XMPFocusSet* focusSet, XMPFrame* requestingFrame);
-
- XMPMethod XMPBoolean RequestFocus(XMPTypeToken focus, XMPFrame* requestingFrame);
-
- XMPMethod void RelinquishFocusSet(XMPFocusSet* focusSet, XMPFrame* relinquishingFrame);
-
- XMPMethod void RelinquishFocus(XMPTypeToken focus, XMPFrame* relinquishingFrame);
-
- XMPMethod void TransferFocus(XMPTypeToken focus,
- XMPFrame* transferringFrame,
- XMPFrame* newOwner);
-
- XMPMethod void TransferFocusSet(XMPFocusSet* focusSet,
- XMPFrame* transferringFrame,
- XMPFrame* newOwner);
-
- XMPMethod XMPFrame* GetFocusOwner(XMPTypeToken focus);
-
- XMPMethod XMPFocusOwnerIterator* CreateOwnerIterator(XMPTypeToken focus);
-
- XMPMethod void RegisterFocus(XMPTypeToken focus, XMPFocusModule* focusModule);
-
- XMPMethod void UnregisterFocus(XMPTypeToken focus);
-
- XMPMethod XMPBoolean IsFocusRegistered(XMPTypeToken focus);
-
- XMPMethod XMPBoolean IsFocusExclusive(XMPTypeToken focus);
-
- protected:
-
- XMPMethod void SetFocusOwnership(XMPTypeToken focus, XMPFrame* frame);
-
- XMPMethod XMPFocusModule* GetFocusModule(XMPTypeToken focus);
-
- XMPMethod XMPBoolean BeginRelinquishFocus(
- XMPTypeToken focus,
- XMPFrame* requestingFrame);
-
- XMPMethod void CommitRelinquishFocus(XMPTypeToken focus,
- XMPFrame* requestingFrame);
-
- XMPMethod void AbortRelinquishFocus(XMPTypeToken focus,
- XMPFrame* requestingFrame);
-
- protected:
-
- XMPSession* fSession; // Access to globals
-
- private:
-
- DictionaryList* fFocusModules;
-
- };
-
-
-
- #endif // _ARBITRAT_
-