home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 035 / pmics.zip / wboard.hh < prev    next >
Text File  |  1994-12-10  |  2KB  |  57 lines

  1. #ifndef WBOARD_INCLUDED
  2. #define WBOARD_INCLUDED
  3. //**************************************************************************
  4. // Class:   BoardWindow                                                    *
  5. //                                                                         *
  6. // Purpose: Chessboard subwindow.                                          *
  7. //                                                                         *
  8. //**************************************************************************
  9.  
  10. #include <istattxt.hpp>
  11. #include <icolor.hpp>
  12. #include <ipainhdr.hpp>
  13. #include <imchdr.hpp>
  14. #include <ihandler.hpp>
  15. #include "game.hh"
  16.  
  17. class BoardWindow;
  18.  
  19. class BoardHandler : public IHandler
  20. {
  21. public:
  22.   Boolean dispatchHandlerEvent(IEvent &evt);
  23.   BoardHandler(BoardWindow *w) {}
  24. };
  25.  
  26.  
  27.  
  28. class BoardWindow : public IStaticText, 
  29.                     public IPaintHandler,
  30.                     public IMouseClickHandler
  31. {
  32. public:                               //Define the public Information
  33.   BoardWindow(unsigned long windowId, //Constructor for this class
  34.           IWindow *parent);
  35.  
  36.   Boolean paintWindow(IPaintEvent&) ; //Handle the paint window event
  37.   Boolean mouseClicked(IMouseClickEvent &keyevt);
  38.  
  39.   void BoardWindow::plotPiece(AGame::Piece piece, char rank, char file);
  40.   void setup(int size);              // set bitmap, colors, board size
  41.   Boolean whiteAtBottom() { return orientation == 0; }
  42.   void flip() { orientation = (orientation+180) % 360; }
  43.   void plot(Boolean force=false);
  44.   void setPromotePiece(char c) { promotePiece = c; }
  45.   int pixelSize() { return squareSize*8; }
  46.  
  47. private:                              //Define the private Information
  48.   BoardHandler  *boardHandler;
  49.   int     squareSize;              // bit dimension of board square
  50.   char    *pi_bits[13];       // bitmap pointers
  51.   char    promotePiece;
  52.   int     orientation;
  53.   AGame   prevGame;        // to update only changed squares
  54. };
  55.  
  56. #endif
  57.