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 >
Wrap
C/C++ Source or Header
|
1992-02-27
|
4KB
|
123 lines
// This may look like C code, but it is really -*- C++ -*-
// Module : SleuthView.h Version 1.2
// LastSCCS : 2/26/92 16:39:04
// LastEdit : "Mon Jan 27 13:17:59 1992"
// Description :
// Author :
// Copyright : GMD Schloss Birlinghoven
#ifndef Sleuthview_h
#define Sleuthview_h
enum TableArea { eTableNothing, ePlayer, eShapeRow, eColorColumn, eValueRow, eField };
class SleuthView : public GnView {
public:
SleuthView(SleuthDocument *document);
SleuthDocument *GetDocument()
{ return document; }
TableArea WhatsUnder(int x, int y, int &shape, int &color, int &value);
protected:
virtual void draw(int count, int x, int y,
Dimension width, Dimension height );
protected:
void DrawEmptyTable();
void DrawName(int name, Boolean reverse = False);
void DrawShape(int shape, Boolean reverse = False);
void DrawValue(int shape, int value, Boolean reverse = False);
void DrawFilledString(char *string, unsigned int length,
Pixel foreground_color, Pixel background_color,
int x, int y, Dimension width, Dimension height,
unsigned char alignment = XmALIGNMENT_CENTER,
Dimension offset = 0);
public:
// Basic dimensions and offsets
static Dimension TableLineWidth()
{ return 1; }
static Dimension TableFieldWidth()
{ return 30; }
static Dimension TableFieldHeight()
{ return 20; }
static Dimension TableHorizontalOffset()
{ return 10; }
static Dimension TableVerticalOffset()
{ return 15; }
static Dimension StringLeftOffset()
{ return 5; }
static Dimension StringRightOffset()
{ return 5; }
// Derived dimensions and offsets
Dimension PlayerLabelWidth()
{ return 2*TableFieldWidth(); }
Dimension PlayerLabelHeight()
{ return 2 * TableFieldHeight(); }
Dimension CardColorColumnWidth()
{ return PlayerLabelWidth(); }
int CardColorColumnX()
{ return TableX(); }
int CardColorColumnY(int nth)
{ return TableY() + (nth + 2)*TableFieldHeight(); }
int CardShapeX(int nth)
{ return TableX() + CardColorColumnWidth() + 3*nth*TableFieldWidth();}
int CardShapeY()
{ return TableY(); }
Dimension CardShapeWidth()
{ return 3*TableFieldWidth(); }
int CardValueX(int nth, int mth)
{ return TableX() + CardColorColumnWidth()
+ ((nth*3)+mth)*TableFieldWidth();}
int CardValueY()
{ return TableY() + TableFieldHeight(); }
int FieldX(int shape, int value)
{ return CardValueX(shape, value); }
int FieldY(int color)
{ return CardColorColumnY(color); }
// Without right and bottom lines !!
Dimension TableWidth()
{ return 9*TableFieldWidth() + CardColorColumnWidth(); }
Dimension TableHeight()
{ return 6*TableFieldHeight(); }
// Including right and bottom lines !!
Dimension TrueTableWidth()
{ return TableWidth() + TableLineWidth(); }
Dimension TrueTableHeight()
{ return TableHeight() + TableLineWidth(); }
int TableX()
{ return TableHorizontalOffset(); }
int TableY()
{ return TableVerticalOffset(); }
int TableMaxX()
{ return TableX() + TableWidth(); }
int TableMaxY()
{ return TableY() + TableHeight(); }
int InnerX(int x)
{ return x + TableLineWidth(); }
int InnerY(int y)
{ return y + TableLineWidth(); }
Dimension InnerWidth(Dimension width)
{ return width - TableLineWidth(); }
Dimension InnerHeight(Dimension height)
{ return height - TableLineWidth(); }
int InnerBottomY(int y)
{ return y + TableFieldHeight() - TableLineWidth(); };
protected:
SleuthDocument *document;
};
#endif