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

  1. /*
  2.     winopen.c    1/20/88
  3.  
  4.     % Spiffy windowing routines.
  5.     by John Cooke and Joe DeSantis.
  6.     Hacked up royally by Ted.
  7.  
  8.     OWL 1.1
  9.     Copyright (c) 1988, by Oakland Group, Inc.
  10.     ALL RIGHTS RESERVED.
  11.  
  12.     Revision History:
  13.     -----------------
  14.      3/10/88 Ted    rewrote for the window function/data pointer concept.
  15.                     All 'iwind's removed to higher level text-window objects
  16.      3/22/88 Ted    Installed linked windows handling
  17.      5/18/88 Ted    Added wmgr struct and disp_ calls
  18.      6/16/88 Ted    revised to have inheritance and class factory functions.
  19.      8/10/88 jmd    Added new object stuff
  20.      8/13/88 jmd    Made win_GetAttr and win_SetAttr functions
  21.      8/15/88 jmd    added winopen_struct, data arg to dwin_Open 
  22.      8/17/88 jmd      (undid above), removed  eNOMEM
  23.      9/12/88 jmd    Added in and out data to objects
  24.     10/30/88 Ted    Removed employ/unemploy to their own file.
  25.     10/31/88 Ted    Removed linking.
  26.     11/20/88 jmd    changed win_Do(GET_ID) to obj_GetID()
  27.     11/29/88 Ted    instituted dwmgr_ funtion names
  28.     12/09/88 ted    Added ddisp_Cache/Flush calls for mouse.
  29.     12/11/88 ted    Added dhard_Claim/Release calls for reentrancy.
  30.      3/24/89 ted    Moved wmgr_Init/Wrapup from win.c to wmgrinit.c.
  31.      3/24/89 ted    Made win's pure objects. Eliminated win_CreateWin,
  32.                      wmgr_Destroy win by folding them into win_Class.
  33.      3/24/89 ted    Renamed from win.c.
  34.      3/24/89 ted    Changed order of args to win_Open and win_PixOpen.
  35.      5/31/89 jmd     Removed win_Paint from win_SetAttr
  36.      8/12/89 jdc    Removed win_Close (now obj_Close)
  37.      8/12/89 ted    Moved win_SetShadow in here.
  38.      8/18/89 ted    Added win_OpenRaw.
  39. */
  40.  
  41. #include "oakhead.h"
  42. #include "disppriv.h"
  43.  
  44. /* -------------------------------------------------------------------------- */
  45.  
  46. win_type win_Open(winclass, cboxp)
  47.     class_fptr winclass;        /* pointer to window's dispatch function */
  48.     ocbox *cboxp;
  49. {
  50. /*
  51.     Open a window in character box coordinates.
  52. */
  53.     opbox box;
  54.     ofont_type font;
  55.  
  56.     font = disp_GetDefFont();
  57.  
  58.     ocbox_pixcoords(cboxp, font, &box);
  59.     return (win_PixOpen(winclass, &box, font));
  60. }
  61. /* -------------------------------------------------------------------------- */
  62.  
  63. win_type win_PixOpen(winclass, boxp, font)
  64.     class_fptr winclass;        /* pointer to window's dispatch function */
  65.     opbox *boxp;
  66.     ofont_type font;
  67. /*
  68.     Open a new window in pixel coordinates, with a font spec,
  69.     and add it to the unemployed window list.
  70. */
  71. {
  72.     winopendata_struct wod;
  73.  
  74.     wod.boxp = boxp;
  75.     wod.font = font;
  76.     wod.list = curr_wmgr->unemployedhead;
  77.  
  78.     return(win_OpenRaw(winclass, &wod));
  79. }
  80. /* -------------------------------------------------------------------------- */
  81.  
  82. win_type win_OpenRaw(winclass, wodp)
  83.     class_fptr winclass;        /* pointer to window's dispatch function */
  84.     winopendata_struct *wodp;
  85. {
  86.     win_type win;
  87.  
  88.     owl_Assert(disp_Ok(), OE_WO_DISP);
  89.  
  90.     hard_Claim();        /* Here for re-entrancy protection */
  91.  
  92.     /* Initialize the new window object */
  93.     if ((win = obj_Open(winclass, NULL)) != NULL) {
  94.         if (!win_Do(win, OBJM_INIT, wodp, NULL)) {
  95.             obj_Close(win);
  96.             win = NULL;
  97.         }
  98.     }
  99.     hard_Release();
  100.  
  101.     return(win);
  102. }
  103. /* -------------------------------------------------------------------------- */
  104.  
  105. void win_SetAttr(win, attr)
  106.     win_type win;
  107.     byte attr;
  108. /*
  109.     Sets the background attribute of win to attr.
  110. */
  111. {
  112.     win_setattribute(win, attr);
  113. }
  114. /* -------------------------------------------------------------------------- */
  115.  
  116. void win_SetShadow(win, csize)
  117.     win_type win;
  118.     int csize;
  119. /*
  120.     Set the csize of the window's shadow (in characters)
  121. */
  122. {
  123.     win_SetPixShadow(win, 
  124.         csize * win_GetFontWidth(win), 
  125.         csize * win_GetFontHeight(win));
  126. }
  127. /* -------------------------------------------------------------------------- */
  128.  
  129.