/*	XInlinePopup.h
 *
 *		This contains the XGInlinePopup class, which is used for inline
 *	editing the contents of a view. To use this class, declare an instance
 *	of this object inside of a view, and use the external API to create,
 *	destroy, and get the contents of an edit view
 */

/**********************************************************************

  YAAF is Copyright 1997-1999 by William Woody.

  Redistribution and use in source and binary forms, with or without 
  modification, are permitted provided that the following conditions 
  are met:

  Redistributions of source code must retain the above copyright notice, 
  this list of conditions and the following disclaimer.

  Neither the name of the copyright holder or other contributors may
  be used to promote products derived from this software without
  specific written prior permission.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
  SOFTWARE.
  
  Contact:   woody@alumni.caltech.edu
  Web page:  http://www.pandawave.com/yaaf/

**********************************************************************/

#ifndef PandaWave_XINLINEPOPUP
#define PandaWave_XINLINEPOPUP

#include <XConfig.h>
#include <XTextControls.h>
#include <XHandle.h>
#include <XWindow.h>
#include <XPopup.h>

/************************************************************************/
/*																		*/
/*	Standard Classes													*/
/*																		*/
/************************************************************************/

/*$	XGInlinePopup
 *
 *		This is an inline editing class. This basically knows how to
 *	self-destruct when it is deactivated or loses focus
 */

class XGInlinePopup : public XGView {
	public:
								XGInlinePopup(XGView *parent, XGSViewInitRecord &init);
		virtual					~XGInlinePopup();
		
		/*
		 *	Initialization support
		 */
		
		static XGInlinePopup	*Create(XGView *parent, 
										XRect &where,
										short font,
										XGStringList &list,
										short value);
		void					Close();

		/*
		 *	Delete me
		 */
		
		void					DoDrawView(XRect);
		void					DoActivate(bool);
		void					DoLoseFocus();
		bool					DoMouseDown(XPoint,short);
		void					DoMouseMove(XPoint,short);
		void					DoMouseUp(XPoint,short);
		
		DECLAREDISPATCH
		long					DoKey(long, void *);
		
		static void				CloseInline(XGView *parent);
	protected:
		virtual XGDispatch		*GetParentDispatch();
		
	private:
		void					DeleteSelf(bool adjfocus = true);
		XGView					*fParentEvent;
		static XGInlinePopup	*gInlineEditor;
		
		long					fPopTime;
		XGStringList			fPopList;
		XGPopMenuView			*fPopView;
		XGPopWindow				*fPopWindow;
};


#endif // PandaWave_XINLINEPOPUP
