/*	TViewTypeList.h
 *
 *		This is the view type list; this knows how to handle editing
 *	the contents of a view type
 */

/*  YAAF Constructor - Rapid application development for YAAF
 *  Copyright (C) 1998 William Edward Woody
 *  
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or (at your option) any later version.
 *  
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 *  02111-1307, USA.
 *  
 *  To contact the author, either e-mail me at woody@pandawave.com, 
 *	or write to
 *  
 *          William Edward Woody
 *          In Phase Consulting
 *          1545 Ard Eevin Avenue
 *          Glendale, CA 91202
 *
 *	Or visit us on the web at http://www.pandawave.com
 */

#ifndef PandaWave_TVIEWTYPELIST
#define PandaWave_TVIEWTYPELIST

#include <XView.h>

/************************************************************************/
/*																		*/
/*	External															*/
/*																		*/
/************************************************************************/

struct ViewTypeRecord;

class XGInlineEdit;
class XGPopWindow;
class XGPopMenuView;

/************************************************************************/
/*																		*/
/*	Class Declarations													*/
/*																		*/
/************************************************************************/

/*	TViewTypeList
 *
 *		The view type list editor view
 */

class TViewTypeList : public XGView {
	public:
								TViewTypeList(XGOwner *owner, XGArgStream &stream);
		virtual					~TViewTypeList();
		
		enum {
			kClassID = 'prAR'
		};
		
		void					InitEditor(ViewTypeRecord *e)
									{
										fViewType = e;
										RecalcScroll();
									}
		
		/*
		 *	Events
		 */
		
		void					DoDrawView(Rect);
		void					DoSizeView(void);
		bool					DoMouseDown(Point, short);
		void					DoMouseMove(Point, short);
		void					DoMouseUp(Point, short);
		
		DECLAREDISPATCH
		long					DoMenuCommand(long, void *);
		long					DoGetMenuStatus(long, void *);
		long					DoInlineClose(long, void *);
	private:
		void					RecalcScroll();
		
		void					DrawLine(XGDraw &, short, short, long);
		
		void					DoNewItem();
		void					DoDeleteItem();
		
		void					OpenPopupMenu();
		void					RunPopupMenu(Point,short);
		void					EndPopupMenu(Point,short);
		void					OpenInlineEdit();
		
		short					fColumn;
		long					fSelect;
		ViewTypeRecord			*fViewType;
		
		XGInlineEdit			*fInline;
		XGPopWindow				*fPopWindow;
		XGPopMenuView			*fPopView;
		XGStringList			fPopList;
};

#endif // PandaWave_TVIEWTYPELIST
