home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / go / prog / xigcv2_8.taz / xigcv2_8 / Goban.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-08  |  5.1 KB  |  137 lines

  1. /****************************************************************************************************************
  2.  *
  3.  *  Copyright (c) 1992 by Antoine Dumesnil de Maricourt. All rights reserved.
  4.  *
  5.  *  This program is distributed in the hope that it will be useful.
  6.  *  Use and copying of this software and preparation of derivative works
  7.  *  based upon this software are permitted, so long as the following
  8.  *  conditions are met:
  9.  *       o credit to the authors is acknowledged following current
  10.  *         academic behaviour
  11.  *       o no fees or compensation are charged for use, copies, or
  12.  *         access to this software
  13.  *       o this copyright notice is included intact.
  14.  *  This software is made available AS IS, and no warranty is made about 
  15.  *  the software or its performance. 
  16.  * 
  17.  *  Bug descriptions, use reports, comments or suggestions are welcome.
  18.  *  Send them to    dumesnil@etca.fr   or to:
  19.  *       
  20.  *       Antoine de Maricourt
  21.  *       ETCA CREA-SP
  22.  *       16 bis, avenue Prieur de la Cote d'Or
  23.  *       94114 Arcueil Cedex
  24.  *       France
  25.  */
  26.  
  27. #ifndef _Goban_h
  28. #define _Goban_h
  29.  
  30. /* Resources:
  31.  
  32.  Name               Class          RepType        Default Value
  33.  ----               -----          -------        -------------
  34.  autoRedisplay         AutoRedisplay      Boolean         True
  35.  background           Background      Pixel          XtDefaultBackground
  36.  blackStoneBackground  Background      Pixel          black
  37.  blackStoneBorder      BorderColor      Pixel          black
  38.  blackStoneForeground  Foreground      Pixel          white
  39.  border               BorderColor      Pixel          XtDefaultForeground
  40.  borderWidth           BorderWidth      Dimension      1
  41.  cursor                Cursor             Integer         GbGrayCursor
  42.  destroyCallback       Callback          Pointer      NULL
  43.  displayCoordinates    DisplayCoordinates Boolean      True
  44.  font                  Font               XFontStruct*    fixed
  45.  foreground            Foreground         Pixel           XtDefaultForeground
  46.  gameSize              Size               Dimension       19
  47.  height               Height          Dimension      computed at create
  48.  mappedWhenManaged     MappedWhenManaged  Boolean      True
  49.  pointSize             Size               Dimension       24
  50.  sensitive           Sensitive      Boolean      True
  51.  viewBottom            Position           Position        computed at create
  52.  viewLeft              Position           Position        computed at create
  53.  viewRight             Position           Position        computed at create
  54.  viewTop               Position           Position        computed at create
  55.  whiteStoneBackground  Background      Pixel          white
  56.  whiteStoneBorder      BorderColor      Pixel          black
  57.  whiteStoneForeground  Foreground      Pixel          black
  58.  width               Width          Dimension      computed at create
  59.  x               Position          Position      0
  60.  y               Position          Position      0
  61. */
  62.  
  63. /* define any special resource names here that are not in <X11/StringDefs.h> */
  64.  
  65. #define XtNautoRedisplay         "autoRedisplay"
  66. #define XtNviewBottom            "viewBottom"
  67.  
  68. #ifndef XtNcursor
  69. #define XtNcursor                "cursor"
  70. #endif
  71.  
  72. #define XtNgameSize              "gameSize"
  73. #define XtNviewLeft              "viewLeft"
  74. #define XtNdisplayCoordinates    "displayCoordinates"
  75. #define XtNpointSize             "pointSize"
  76. #define XtNstipple               "stipple"
  77. #define XtNviewRight             "viewRight"
  78. #define XtNviewTop               "viewTop"
  79. #define XtNblackStoneBorder      "blackStoneBorder"
  80. #define XtNblackStoneForeground  "blackStoneForeground"
  81. #define XtNblackStoneBackground  "blackStoneBackground"
  82. #define XtNwhiteStoneBorder      "whiteStoneBorder"
  83. #define XtNwhiteStoneForeground  "whiteStoneForeground"
  84. #define XtNwhiteStoneBackground  "whiteStoneBackground"
  85.  
  86. #define XtCAutoRedisplay         "AutoRedisplay"
  87. #define XtCDisplayCoordinates    "DisplayCoordinates"
  88. #define XtCSize                  "Size"
  89. #define XtCStipple               "Stipple"
  90.  
  91. #define XtEgbWhiteStone          "white"
  92. #define XtEgbBlackStone          "black"
  93. #define XtEgbGrayStone           "gray"
  94.  
  95. /* declare specific GobanWidget class and instance datatypes */
  96.  
  97. typedef struct _GobanClassRec*     GobanWidgetClass;
  98. typedef struct _GobanRec*     GobanWidget;
  99.  
  100. /* declare the class constant */
  101.  
  102. extern WidgetClass gobanWidgetClass;
  103.  
  104. /* cursors */
  105.  
  106. #define GbCGrayStone         256
  107. #define GbCBlackStone        257
  108. #define GbCWhiteStone        258
  109.  
  110. /* special marks */
  111.  
  112. #define GbMSquareMark        1
  113. #define GbMTriangleMark      2
  114. #define GbMVCrossMark        3
  115. #define GbMDCrossMark        4
  116. #define GbMDiamondMark       5
  117.  
  118. /* colors */
  119.  
  120. typedef enum { GbEmptyPoint, GbBlackStone, GbWhiteStone } GbPointState;
  121.  
  122. /* user functions */
  123.  
  124. #define GbRemoveMark(w,x,y)  GbSetMark (w, x, y, 0, 0)
  125.  
  126. extern void GbRedisplayBoard ( /* Widget w */ );
  127. extern void GbClearBoard     ( /* Widget w */ );
  128. extern void GbSetPoint       ( /* Widget w, Position x, Position y, GbPointState color */ );
  129. extern void GbSetNum         ( /* Widget w, Position x, Position y, int num   */ );
  130. extern void GbSetMark        ( /* Widget w, Position x, Position y, unsigned char mark1, unsigned char mark2 */ );
  131.  
  132. extern Boolean GbGetPositionFromStone ( /* Widget w, Position *x, Position *y */ );
  133. extern Boolean GbGetStoneFromPosition ( /* Widget w, Position *x, Position *y */ );
  134.  
  135. #endif /* _Goban_h */
  136.  
  137.