/*
 * bonobo-listener.idl: Generic listener handling interfaces
 *
 * Copyright (C) 2000,  Helix Code, Inc.
 *
 * Authors:
 *      Alex Graveley (alex@helixcode.com)
 *	Michael Meeks (michael@helixcode.com)
 */

#ifndef BONOBO_LISTENER_IDL
#define BONOBO_LISTENER_IDL

#include "Bonobo_Unknown.idl"

module Bonobo {
  
	interface Listener : Bonobo::Unknown {
  		/**
  		 * event:   Invokes a named event on this listener object,
  		 * thus a single Bonobo / CORBA object can multiplex
  		 * many event requests without the overhead of an
  		 * object per type of event we want to listen to.
  		 * @event_name: the name of the event
 		 * @args: A CORBA Any argument.
  		 */
 		oneway void event (in string event_name, in any args);
  	};
  
  	interface EventSource : Bonobo::Unknown {
  		typedef unsigned long ListenerId;

		exception UnknownListener {};
  
  		/**
 		 * addListener: Adds a listener to all events being
 		 * emitted by this object.
  		 * @l: the listener implementation.
		 *
		 * Returns: The ListenerId which can be passed to the 
		 * remove method
  		 */
 		ListenerId addListener (in Listener l);
  		
  		/**
 		 * addListenerWithMask: Adds a listener to certain events
 		 * emitted by this object.
 		 * @l: the listener implementation.
 		 * @event_mask: a comma-separated list of event names this listener 
		 * is interested in recieving. If this listener is already 
 		 * receiving events from this EventSource, only the 
 		 * events listed here will be delivered.
		 *
		 * Returns: The ListenerId which can be passed to the 
		 * remove method
 		 */
 		ListenerId addListenerWithMask (in Listener l,
						in string   event_mask);
 
 		/**
  		 * removeListener: Removes a listener
  		 * @id: the listener Id
  		 */
 		void removeListener (in ListenerId id)
  			raises (UnknownListener);
  	};
};

#endif /* BONOBO_LISTENER_IDL */

