home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 2.ddi / OWLSRC.EXE / CSCAPE / SOURCE / WINOBJ.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-07  |  7.5 KB  |  225 lines

  1. /*
  2.     winobj.h
  3.  
  4.     % Window object definitions for basic window types
  5.  
  6.     11/28/88  by Ted.
  7.  
  8.     OWL 1.1
  9.     Copyright (c) 1988, 1989 by Oakland Group, Inc.
  10.     ALL RIGHTS RESERVED.
  11.  
  12.     Revision History:
  13.     -----------------
  14.      3/11/88 Ted    Hacked.
  15.      8/15/88 jmd    preened
  16.     10/31/88 ted:    Removed linked window support.
  17.     11/04/88 ted:    Added new border object.
  18.     11/17/88 ted:    Added Mouse support.
  19.      2/12/88 ted:    Fixed up mouse support for new current window cases
  20.      3/23/89 Ted    Merged with windecl.h in converting win's to pure obj's
  21.      3/23/89 Ted    Extracted wmgr_struct to wmgrdecl.h
  22.      4/14/89 ted    Added CHILDCLOSE msg.
  23.      4/21/89 ted    Renamed xd elements box and border to wbox and bord for Unix.
  24.      5/11/89 ted    Added win parent clip flag.
  25.      6/26/89 ted    Moved nextwin out of goresult_struc into wmgr.
  26.      7/10/89 ted    Moved nextwin to window structure from wmgr.
  27.      7/12/89 ted    Converted '_func' prototypes from typedef to macro.
  28.      7/25/89 ted    Added explode function.
  29.      8/08/89 jmd    Made new messages (setsize, etc.).
  30.      8/10/89 jmd    Killed bob, added new messages to windows.
  31.      8/11/89 jmd    Added new bob class
  32.      8/16/89 ted    removed GETEXPLODE, SETEXPLODE messages
  33.      8/16/89 ted    added resize and nullfont flags.
  34. */
  35.  
  36. #ifndef OAK_WINOBJ
  37. #define OAK_WINOBJ
  38.  
  39. /* ** #include "commnobj.h"  Note: always included in Oakland code. */
  40. #include "winfsym.h"        /* for WIN_FSYM_COUNT */
  41.  
  42. /* -------------------------------------------------------------------------- */
  43. extern class_func        (win_Class);
  44.  
  45. extern class_func        (npwin_Class);
  46. extern class_func        (blwin_Class);
  47.  
  48. #define win_Do(win, msg, indata, outdata)            \
  49.     ((win != NULL) ? obj_Do(win, msg, indata, outdata) : FALSE)
  50.  
  51. /* -------------------------------------------------------------------------- */
  52. /* Message data types */
  53.  
  54. typedef struct {
  55.     opbox        *boxp;
  56.     ofont_type     font;
  57.     obj_type     list;
  58. } winopendata_struct;
  59.  
  60. /* InPos query message data structure */
  61.  
  62. typedef struct {
  63.     win_type     win;
  64.     opbox         inbox;                /* box for win contents field relative to window */
  65. } inposdata_struct;
  66.  
  67. /* WINM_SETFLDPOS msg */
  68. typedef struct {
  69.  
  70.     ocbox       *ocboxp;              /* pointer to position box */
  71.     int            pref;                /* prefered box search direction */
  72.  
  73. } winsfp_struct;
  74.  
  75. /* Bit masks for PAINTREQ message ***/
  76.  
  77. #define    WPD_SENTER        0x01        
  78. #define    WPD_BORDER        0x02
  79. #define    WPD_TEXT          0x04
  80. #define    WPD_FIELDS        0x08
  81.  
  82. /* -------------------------------------------------------------------------- */
  83. /* Data types */
  84.  
  85. #define mouhandler_func(fname)        unsigned fname(_arg3(win_type win, int msg, mev_struct *mev))
  86. typedef mouhandler_func ((*mouhandler_fptr));    /* note: change in win struct too */
  87.  
  88. #define exp_fptr    class_fptr
  89.  
  90. /* The bob public data structure */
  91.  
  92. typedef struct {
  93.     common_xd    cd;                    /* common object xdata */
  94.  
  95.     obj_type    parent;                /* parent object (if any) */
  96.     unsigned    depend:1;            /* are we dependent? */
  97.  
  98. } bob_xd;
  99.  
  100. #define bob_getxd(bob)                ((bob_xd *) obj_getxd(bob))
  101.  
  102. /* The window public data structure */
  103.  
  104. typedef struct {
  105.     bob_xd        cd;                     /* bob object xdata */
  106.  
  107.     unsigned    employed:1;         /* the employed flag */
  108.     win_type    above;                /* the window above */
  109.     win_type    below;                /* the window below */
  110.  
  111.     opbox            wbox;                 /* the outer edges of the window */
  112.     opbox        inbox;                /* the inside of the border (relative) */
  113.     obj_type    bord;                /* the attached border object, if any */
  114.     opcoord        shadowx;              /* x size of window shadow */
  115.     opcoord        shadowy;              /* y size of window shadow */
  116.     byte        shadowattr;            /* color attribute of shadow */
  117.  
  118.     ofont_type     font;
  119.     unsigned    nullfont:1;            /* flag whether win has null font. for use */
  120.                                     /* in allocating new fonts after disp mode change */
  121.     byte         attribute;            /* Default window foreground/background color */
  122.     opcoord           cursx;                /* Text cursor x position within window */
  123.     opcoord           cursy;                /* Text cursor y position within window */
  124.     cursortype     curstype;            /* cursor type for this window */
  125.  
  126.     win_type    nextwin;            /* Window to "go" after currently "going" win returns */
  127.     mouhandler_fptr mouhandler;        /* pointer to a mouse handler function */
  128.     unsigned    debounced:1;        /* debouncing flag for use by mouse handler */
  129.  
  130.     unsigned    charsize:1;            /* flag for whether window must lock to char size */
  131.     unsigned    resize:1;            /* resize strategy flag: when display size changes, */
  132.                                     /* make window size change proportionally */
  133.                                     /* (using nearest font available) or: */
  134.                                     /* keep font and window size */
  135.  
  136.     exp_fptr    explode;            /* Window explode function */
  137.  
  138.     int            idmgr;                /* the id of the dmgr this win belongs to */
  139.  
  140.     short        handles[WIN_FSYM_COUNT];    /* LNF function name handles */
  141.  
  142. } win_xd;
  143.  
  144. #define win_GetId(win)                obj_GetId(win)
  145.  
  146. typedef win_xd npwin_xd;
  147. typedef win_xd blwin_xd;
  148.  
  149. /* win messages */
  150.  
  151. #define WINM_ISAVE        (OBJM_LASTMSG + 0)        /* Initial Screen Image Save */
  152. #define WINM_PAINT        (OBJM_LASTMSG + 1)
  153. #define WINM_SAVE        (OBJM_LASTMSG + 2)
  154. #define WINM_SHADOW     (OBJM_LASTMSG + 3)        /* Shadow paint message */
  155. #define WINM_SHADOWSAVE    (OBJM_LASTMSG + 4)        /* Shadow paint message */
  156. #define WINM_DRAWCURSOR    (OBJM_LASTMSG + 5)
  157. #define WINM_STARTCUR    (OBJM_LASTMSG + 6)
  158. #define WINM_STOPCUR    (OBJM_LASTMSG + 7)
  159. #define WINM_SCROLL        (OBJM_LASTMSG + 8)
  160. #define WINM_CLEAR        (OBJM_LASTMSG + 9)
  161. #define WINM_SETFONT    (OBJM_LASTMSG + 10)
  162. #define WINM_SHOWCURS    (OBJM_LASTMSG + 11)
  163. #define WINM_HIDECURS    (OBJM_LASTMSG + 12)
  164. #define WINM_EXPLODE    (OBJM_LASTMSG + 13)
  165. #define WINM_GETINPOS    (OBJM_LASTMSG + 14)       /* get size & pos of contents */
  166. #define WINM_SCROLLREQ    (OBJM_LASTMSG + 15)
  167. #define WINM_SETSIZE    (OBJM_LASTMSG + 16)
  168. #define WINM_SETPOS        (OBJM_LASTMSG + 17)
  169. #define WINM_PUTUNDER    (OBJM_LASTMSG + 18)
  170. #define WINM_UNEMPLOY     (OBJM_LASTMSG + 19)        /* Unemploy a window */
  171. #define WINM_ICONREQ    (OBJM_LASTMSG + 20)
  172. #define WINM_CHILDCLOSE (OBJM_LASTMSG + 21)        /* Notification that a child window is closing itself */
  173. #define WINM_GO            (OBJM_LASTMSG + 22)
  174.  
  175. /* messages used by LNF */
  176. #define WINM_LNFGETGO     (OBJM_LASTMSG + 23)
  177. #define WINM_LNFSETGO     (OBJM_LASTMSG + 24)
  178. #define WINM_LNFRESET     (OBJM_LASTMSG + 25)
  179.  
  180. #define WINM_GOREQ        (OBJM_LASTMSG + 26)
  181. #define WINM_PAINTREQ     (OBJM_LASTMSG + 27)
  182. #define WINM_GETFLDPOS     (OBJM_LASTMSG + 28)
  183. #define WINM_SETFLDPOS     (OBJM_LASTMSG + 29)
  184.  
  185. #define WINM_LASTMSG    (OBJM_LASTMSG + 100)
  186.  
  187. /*** bob macros ***/
  188.  
  189. #define bob_Do(bob, msg, indata, outdata)     obj_Do(bob, msg, indata, outdata)
  190.  
  191. #define bob_GetParent(bob)            (bob_getxd(bob)->parent)
  192. #define bob_IsDepend(bob)            ((boolean) bob_getxd(bob)->depend)
  193.  
  194. #define bob_SetParent(bob, parnt)    (bob_getxd(bob)->parent = (parnt))
  195. #define bob_SetDepend(bob, d)          (bob_getxd(bob)->depend = (d))
  196.  
  197. #define    bob_IsWin(bob)                obj_Who(bob, ID_WIN)
  198.  
  199. #define BOB_DEPENDENT        TRUE
  200. #define BOB_INDEPENDENT        FALSE
  201.  
  202. typedef obj_type    bob_type;
  203.  
  204. #define win_CreateBob(win, flag)    (win_SetParentClip(win, flag), (win))
  205.  
  206. #define bob_Repaint(bob)            win_Do(bob, WINM_PAINTREQ, NULL, NULL);
  207. #define bob_Pop(bob)                win_UnEmploy(bob)
  208. #define bob_SetPosition(bob, row, col)     (bord_SetPosition(bob, row, col))
  209.  
  210. /*** bob functions ***/
  211. extern     int        bob_Go(_arg1(bob_type));
  212. extern     void    bob_GetSize(_arg3(bob_type, int *, int *));
  213. extern     void    bob_GetPosition(_arg3(bob_type, int *, int *));
  214.  
  215. /* -------------------------------------------------------------------------- */
  216. /* Request func */
  217.  
  218. #define win_MouseInit()         bord_MouseInit()
  219. extern classinit_func        (win_LoadInit);
  220. extern classinit_func        (win_SaveInit);
  221.  
  222. /* -------------------------------------------------------------------------- */
  223. #endif
  224.  
  225.