/*
   grid.h

   This file is part of libgtools.
   
   Copyright (C) 1994,1995 Frank McIngvale (frankm@nuance.com)
   
   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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef _grid_h_
#define _grid_h_

#include <gtools/handle.h>
#include <gtools/bitmap.h>
#include <gtools/geom.h>

class BitmapGrid : public Handler {
 public:
  BitmapGrid( Rect &rect, Bitmap *bmp );

  virtual ~BitmapGrid();

  int handle_mouse( int,int );
  int set_draw_color( int );

  void shift_left();
  void shift_right();
  void shift_up();
  void shift_down();

  void flip_lr();
  void flip_ud();
  
 protected:
  int x1, x2, y1, y2;		/* Bounding box */
  int cx, cy;				/* Cell X and Y sizes */
  int clr;
  Bitmap *map;
  
  void draw_grid();
  void fill_grid();
};

#endif
