/*	TErrorView.h
 *
 *		Error display view
 */

/*  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_TERRORVIEW
#define PandaWave_TERRORVIEW

#include <XView.h>

/************************************************************************/
/*																		*/
/*	Structures															*/
/*																		*/
/************************************************************************/

struct ErrorDeclaration;

/************************************************************************/
/*																		*/
/*	Error List															*/
/*																		*/
/************************************************************************/

/*	TErrorView
 *
 *		Error list view
 */

class TErrorView : public XGView {
	public:
								TErrorView(XGOwner *parent, XGArgStream &stream);
		virtual					~TErrorView();
		
		enum {
			kClassID = 'prER'
		};
		
		void					InitErrorView(ErrorDeclaration *e)
									{
										fError = e;
										InvalView();
										RecalcScroll();
									}
		
		/*
		 *	Drawing
		 */
		
		void					DoDrawView(Rect);
		void					DoSizeView();
		
		bool					DoMouseDown(Point,short);
		void					DoMouseMove(Point,short);
		void					DoMouseUp(Point,short);
		
		void					Scroll(long x, long y);
		
		DECLAREDISPATCH
		long					DoMenuCommand(long, void *);
		long					DoGetMenuStatus(long, void *);
		long					DoInlineClose(long, void *);
		long					DoKeyEvent(long,void *);

	private:
		void					RecalcScroll();
		void					DrawLine(XGDraw &draw, long index, Rect r);
		void					OpenInlineEdit();
		void					AppendError();
		void					DeleteError();

		long					fSelect;
		short					fColSel;
		long					fDrawSel;
		ErrorDeclaration		*fError;
		XGInlineEdit			*fInline;
};

#endif // PandaWave_TERRORVIEW
