home *** CD-ROM | disk | FTP | other *** search
/ Point Programming 1 / PPROG1.ISO / c / fli106c / examples / piece.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-25  |  3.7 KB  |  150 lines

  1. //
  2. // The Fusion Library Interface for DOS
  3. // Version 1.01
  4. // Copyright (C) 1990, 1991
  5. // Software Dimensions
  6. //
  7. // Dialog Development System
  8. //
  9.  
  10. //-------------------------------------------------------------------------
  11. //
  12. // Main Handler for objects and elements
  13. //
  14. //-------------------------------------------------------------------------
  15.  
  16. class PieceHandler
  17. {
  18. public:
  19.     enum
  20.     {
  21.  
  22.     // Objects
  23.  
  24.     Box = 0,
  25.         FilledBox,
  26.         HorizontalLine,
  27.         VerticalLine,
  28.         Shadow,
  29.         EraseArea,
  30.     ColorizeArea,
  31.     __DUMMY__=50,
  32.  
  33.     // Elements
  34.  
  35.     Character,
  36.     Integer,
  37.     Long,
  38.     Float,
  39.     Double,
  40.     Bcd,
  41.     VRadio,
  42.     HRadio,
  43.     Check,
  44.     Push,
  45.     PickGeneric,
  46.     __DUMMY2__=100,
  47.  
  48.     // Non Classifiable
  49.  
  50.     GroupHeading
  51.   } LayOut;
  52.  
  53.   // For objects and elements
  54.  
  55.   int X, Y;                   // Location of object
  56.   int PromptX, PromptY;       // Location of prompter
  57.   int Width, Height;          // Width / Height of object
  58.   int Color;                  // Color of object
  59.  
  60.   // For character elements
  61.  
  62.   int MaskCharacter;          // For QUICK masks
  63.   int MaskWidth;
  64.   int ScrollWidth;            // Actual scroll width
  65.   int Focus_Reset;            // Is it focused or reset?
  66.  
  67.   // These are only allocated if necessary
  68.  
  69.   char *Mask;                 // Mask for characters/numerics   [50 wide]
  70.   char *Variable;             // Variable to store result in    [50 wide]
  71.   char *Prompter;             // Prompter for element           [50 wide]
  72.   char *HotKey;               // Hot key to jump to element     [30 wide]
  73.   char **Elements;            // List of radio buttons          [10 @ 50 wide]
  74.   char *Help;                 // Help for element               [65 wide]
  75.   char *DerivedClass;         // Name of element derived class  [50 wide]
  76.   char *Text;                 // Text for button or check box   [50 wide]
  77.   char *Constant;             // for push buttons               [50 wide]
  78.  
  79.   // For elements only
  80.  
  81.   int GroupCode;              // What group does this belong to?
  82.   int HelpId;                 // Help screen id code
  83.   int ToBeDerived;            // Is class derived
  84.  
  85.   BlazeClass *Blaze;          // Pointer to Blaze for inside of window
  86.  
  87.     virtual void DrawFigure() = 0;
  88.   virtual void Size(int,int);
  89.   PieceHandler(BlazeClass *_Blaze=0) : Blaze(_Blaze) { }
  90.   virtual ~PieceHandler();
  91. };
  92.  
  93. //-------------------------------------------------------------------------
  94. //
  95. // Macro to derive a class for objects
  96. //
  97. //-------------------------------------------------------------------------
  98.  
  99. #define Fig(A) \
  100. class A : public PieceHandler \
  101. { \
  102.     public: \
  103.     A(BlazeClass *_Blaze_,int X=0,int Y=0,int Width=0,int Height=0,int Color=0); \
  104.     A(PieceHandler &Object); \
  105.     void DrawFigure(); \
  106.     void Size(int,int); \
  107. };
  108.  
  109. //-------------------------------------------------------------------------
  110. //
  111. // Macro to derive a class for elements
  112. //
  113. //-------------------------------------------------------------------------
  114.  
  115. #define Elem(A) \
  116. class A : public PieceHandler \
  117. { \
  118.     public: \
  119.     A(BlazeClass *_Blaze_,int X=0,int Y=0,int Width=0,int Height=0,int Color=0); \
  120.     A(PieceHandler &Object); \
  121.     void DrawFigure(); \
  122. };
  123.  
  124. //-------------------------------------------------------------------------
  125. //
  126. // Derive and create classes for both elements and objects
  127. //
  128. //-------------------------------------------------------------------------
  129.  
  130. Fig(Box);
  131. Fig(FilledBox);
  132. Fig(HorizontalLine);
  133. Fig(VerticalLine);
  134. Fig(Shadow);
  135. Fig(EraseArea);
  136. Fig(ColorizeArea);
  137.  
  138. Elem(Character);
  139. Elem(Integer);
  140. Elem(Long);
  141. Elem(Float);
  142. Elem(Double);
  143. Elem(Bcd);
  144. Elem(VRadio);
  145. Elem(HRadio);
  146. Elem(Check);
  147. Elem(Push);
  148. Elem(GroupHeading);
  149. Elem(PickGeneric);
  150.