/***************************************************************************
                          SIMPLY POWERFUL TOOLKIT (SPTK)
                          CExcelView.h  -  description
                             -------------------
    begin                : August 19 2004
    copyright            : (C) 2004 by Alexey Parshin
    email                : alexeyp@gmail.com
 ***************************************************************************/

/***************************************************************************
   This library is free software; you can redistribute it and/or modify it 
   under the terms of the GNU Library General Public License as published by
   the Free Software Foundation; either version 2 of the License, or (at 
   your option) any later version.

   This library 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 Library
   General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; if not, write to the Free Software Foundation, 
   Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.

   Please report all bugs and problems to "alexeyp@gmail.com"
 ***************************************************************************/

#ifndef __CEXCELVIEW_H__
#define __CEXCELVIEW_H__

#include <FL/Fl_Box.h>
#include <sptk3/CGroup.h>
#include <sptk3/CScroll.h>
#include <sptk3/excel/CExcelBook.h>

namespace sptk {
   /// @addtogroup excel Excel Classes
   /// @{

   /// @brief Excel Sheet view (not implemented yet)
   ///
   /// Class CExcelSheetView represents the data in CExcelBook without any headers.
   /// This class is designed as an internal class for CExcelView
	class CExcelSheetView : public Fl_Box {
		CExcelSheet *m_excelSheet;	   /// Excel sheet to draw
	public:
      /// Constructor in FLTK style 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
      /// @param label const char *, label
		CExcelSheetView(int x,int y,int w,int h,const char *label=0);

      /// Attach an Excel book object
      /// @param excelSheet CExcelSheet *, Excel book object
		void attach(CExcelSheet *excelSheet);

      /// Custom handle method - to process events
		virtual int handle(int event);

      /// Custom draw method - to draw Excel data
		virtual void draw();

      /// Recomputes total size of the sheet and resizes the sheet accordingly
		void autoSize();
	};

   /// @brief Excel view (not implemented yet).
   ///
   /// A visual read-only presentation for CExcelBook.
	class CExcelView : public CGroup, public CExcelBook {
		CScroll	*m_headerScroll;
		CScroll	*m_dataScroll;
	public:
      /// Constructor in SPTK style 
      /// @param label const char *, label
      /// @param layoutSize int, widget align in layout
      /// @param layoutAlign CLayoutAlign, widget align in layout
		CExcelView(const char *label=0,int layoutSize=10,CLayoutAlign layoutAlign=SP_ALIGN_TOP);

#ifdef __COMPATIBILITY_MODE__    
      /// Constructor in FLTK style 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
      /// @param label, const char * label
		CExcelView(int x,int y,int w,int h,const char *label=0);
#endif
	};
   /// @}
}
#endif
