home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / g / gina15.zip / demos / sleuth / SleuthView.h < prev    next >
C/C++ Source or Header  |  1992-02-27  |  4KB  |  123 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2.  
  3. //   Module      : SleuthView.h   Version 1.2
  4. //   LastSCCS    : 2/26/92  16:39:04
  5. //   LastEdit    : "Mon Jan 27 13:17:59 1992"
  6. //   Description : 
  7. //   Author      : 
  8. //   Copyright   : GMD Schloss Birlinghoven
  9.  
  10. #ifndef Sleuthview_h
  11. #define Sleuthview_h
  12.  
  13. enum TableArea { eTableNothing, ePlayer, eShapeRow, eColorColumn, eValueRow, eField };
  14.  
  15. class SleuthView : public GnView {
  16.   public:
  17.     SleuthView(SleuthDocument *document);
  18.     SleuthDocument *GetDocument()
  19.     { return document; }
  20.     TableArea WhatsUnder(int x, int y, int &shape, int &color, int &value);
  21.   protected:
  22.     virtual void draw(int count, int x, int y,
  23.               Dimension width, Dimension height );
  24.   protected:
  25.     void DrawEmptyTable();
  26.     void DrawName(int name, Boolean reverse = False);
  27.     void DrawShape(int shape, Boolean reverse = False);
  28.     void DrawValue(int shape, int value, Boolean reverse = False);
  29.     void DrawFilledString(char *string, unsigned int length,
  30.               Pixel foreground_color, Pixel background_color,
  31.               int x, int y, Dimension width, Dimension height,
  32.               unsigned char alignment = XmALIGNMENT_CENTER,
  33.               Dimension offset = 0);
  34.   public:
  35.     // Basic dimensions and offsets
  36.     static Dimension TableLineWidth()
  37.     { return 1; }
  38.     static Dimension TableFieldWidth()
  39.     { return 30; }
  40.     static Dimension TableFieldHeight()
  41.     { return 20; }
  42.     static Dimension TableHorizontalOffset()
  43.     { return 10; }
  44.     static Dimension TableVerticalOffset()
  45.     { return 15; }
  46.  
  47.     static Dimension StringLeftOffset()
  48.     { return 5; }
  49.     static Dimension StringRightOffset()
  50.     { return 5; }
  51.     
  52.     // Derived dimensions and offsets
  53.  
  54.     Dimension PlayerLabelWidth()
  55.     { return 2*TableFieldWidth(); }
  56.     Dimension PlayerLabelHeight()
  57.     { return 2 * TableFieldHeight(); }
  58.     
  59.     Dimension CardColorColumnWidth()
  60.     { return PlayerLabelWidth(); }
  61.     int CardColorColumnX()
  62.     { return TableX(); }
  63.     int CardColorColumnY(int nth)
  64.     { return TableY() + (nth + 2)*TableFieldHeight(); }
  65.  
  66.     int CardShapeX(int nth)
  67.     { return TableX() + CardColorColumnWidth() + 3*nth*TableFieldWidth();}
  68.     int CardShapeY()
  69.     { return TableY(); }
  70.     Dimension CardShapeWidth()
  71.     { return 3*TableFieldWidth(); }
  72.     
  73.     int CardValueX(int nth, int mth)
  74.     { return TableX() + CardColorColumnWidth()
  75.           + ((nth*3)+mth)*TableFieldWidth();}
  76.     int CardValueY()
  77.     { return TableY() + TableFieldHeight(); }
  78.  
  79.     int FieldX(int shape, int value)
  80.     { return CardValueX(shape, value); }
  81.     int FieldY(int color)
  82.     { return CardColorColumnY(color); }
  83.  
  84.     // Without right and bottom lines !!
  85.     Dimension TableWidth()
  86.     { return 9*TableFieldWidth() + CardColorColumnWidth(); }
  87.     Dimension TableHeight()
  88.     { return 6*TableFieldHeight(); }
  89.  
  90.     // Including right and bottom lines !!
  91.     Dimension TrueTableWidth()
  92.     { return TableWidth() + TableLineWidth(); }
  93.     Dimension TrueTableHeight()
  94.     { return TableHeight() + TableLineWidth(); }
  95.     
  96.     int TableX()
  97.     { return TableHorizontalOffset(); }
  98.     int TableY()
  99.     { return TableVerticalOffset(); }
  100.  
  101.     int TableMaxX()
  102.     { return TableX() + TableWidth(); }
  103.     int TableMaxY()
  104.     { return TableY() + TableHeight(); }
  105.  
  106.     int InnerX(int x)
  107.     { return x + TableLineWidth(); }
  108.     int InnerY(int y)
  109.     { return y + TableLineWidth(); }
  110.     Dimension InnerWidth(Dimension width)
  111.     { return width - TableLineWidth(); }
  112.     Dimension InnerHeight(Dimension height)
  113.     { return height - TableLineWidth(); }
  114.     
  115.     int InnerBottomY(int y)
  116.     { return y + TableFieldHeight() - TableLineWidth(); };
  117.  
  118.   protected:
  119.     SleuthDocument *document;
  120. };
  121.  
  122. #endif
  123.