/*
 * bonobo-ui.idl: Handles some User Interface issues for components
 *
 * Copyright (C) 2000  Helix Code, Inc.
 *
 * Author:
 *	Michael Meeks (michael@helixcode.com)
 */

#ifndef BONOBO_UI_IDL
#define BONOBO_UI_IDL

#include "Bonobo_Unknown.idl"

module Bonobo {
	interface UIContainer;

	interface UIComponent : Bonobo::Unknown {

		void setContainer   (in UIContainer container);
		void unsetContainer ();

		readonly attribute string name;

		enum EventType {
			STATE_CHANGED,
			OTHER
		};

		/*
		 * Returns an XML description of all available verbs.
		 */
		string      describeVerbs ();

		/*
		 * Allows a remote user to execute a verb by name.
		 */
		oneway void execVerb      (in string   cname);

		/*
		 * Allows a remote user to flag an event
		 */
		oneway void uiEvent       (in string    id,
					   in EventType type,
					   in string    state);

		/**
		 * unImplemented:
		 *
		 * placeholders for future expansion.
		 */
		void unImplemented  ();
		void unImplemented2 ();
		void unImplemented3 ();
		void unImplemented4 ();
	};

	interface UIContainer : Bonobo::Unknown {
		exception MalformedXML    {};
		exception InvalidPath     {};
		exception NonExistentAttr {};
		exception Insensitive     {};
		exception Unknown         {};

		/* FIXME: broken, should use set/get object instead */
		void    registerComponent   (in string component_name,
					      in Bonobo::UIComponent component);

		oneway void deregisterComponent (in string component_name);

		oneway void     freeze      ();
		oneway void     thaw        ();

		oneway void     setAttr     (in string path,
					     in string attr,
					     in string value,
					     in string component_name);
		string          getAttr     (in string path, in string attr)
			raises (InvalidPath, NonExistentAttr);

		void    setNode             (in string path, in string xml,
					     in string component_name)
			raises (MalformedXML, InvalidPath);

		string  getNode             (in string path,
					     in boolean nodeOnly)
			raises (InvalidPath);

		void    removeNode          (in string path,
					     in string by_component_name)
			raises (InvalidPath);

		boolean exists              (in string path);

		void    execVerb            (in string   cname)
			raises (Insensitive, Unknown);

		void    uiEvent             (in string                 id,
					     in UIComponent::EventType type,
					     in string                 state)
			raises (Insensitive, Unknown);

		/*
		 *  Currently the object should be a Bonobo::Control interface
		 * but this may be changed to a string based Moniker approach.
		 * 
		 *   The control's property bag will have the following
		 * properties set on it in various circumstances:
		 *
		 *  bonobo:ui:vertical	boolean
		 */
		void            setObject   (in string path,
					     in Bonobo::Unknown control)
			raises (InvalidPath);

		Bonobo::Unknown getObject   (in string path)
			raises (InvalidPath);

		/**
		 * unImplemented:
		 *
		 * placeholders for future expansion.
		 */
		void unImplemented  ();
		void unImplemented2 ();
		void unImplemented3 ();
		void unImplemented4 ();
	};
};

#endif /* BONOBO_UI_IDL */
