home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc™ Source Code / Utilities / WinUtils.cpp < prev   
Encoding:
C/C++ Source or Header  |  1996-08-28  |  3.7 KB  |  167 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        WinUtils.cpp
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Owned by:    Reggie Adkins
  7.  
  8.     Copyright:    © 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <2>     5/23/96    RA        1294562:    EndGetWindowProperties shouldn't
  13.                                     null source frame field ; calls ODRelease
  14.                                     instead of ODReleaseObject
  15.  
  16.     To Do:
  17. */
  18.  
  19. /*
  20.     File:        WinUtils.cpp
  21.  
  22.     Contains:    Implementation of window utilities
  23.  
  24.     Owned by:    Richard Rodseth
  25.  
  26.     Copyright:    © 1995 - 1996 by Apple Computer, Inc., all rights reserved.
  27.  
  28.     
  29. */
  30.  
  31. #ifndef _ALTPOINT_
  32. #include "AltPoint.h"
  33. #endif
  34.  
  35. #ifndef _WINUTILS_
  36. #include "WinUtils.h"
  37. #endif
  38.  
  39. #ifndef SOM_ODDraft_xh
  40. #include "Draft.xh"
  41. #endif
  42.  
  43. #ifndef _ODUTILS_
  44. #include "ODUtils.h"
  45. #endif
  46.  
  47. #ifndef SOM_ODFrame_xh
  48. #include "Frame.xh"
  49. #endif
  50.  
  51. #ifndef _PASCLSTR_
  52. #include "PasclStr.h"
  53. #endif
  54.  
  55. #ifndef _EXCEPT_
  56. #include <Except.h>
  57. #endif
  58.  
  59. #ifndef _ODDEBUG_
  60. #include "ODDebug.h"
  61. #endif
  62.  
  63. #ifndef _ODMEMORY_
  64. #include <ODMemory.h>
  65. #endif
  66.  
  67. #ifndef SOM_ODStorageUnit_xh
  68. #include <StorageU.xh>
  69. #endif
  70.  
  71. #ifndef SOM_ODStorageUnitView_xh
  72. #include <SUView.xh>
  73. #endif
  74.  
  75. #ifndef _STDTYPIO_
  76. #include "StdTypIO.h"
  77. #endif
  78.  
  79. #ifndef _TEMPOBJ_
  80. #include <TempObj.h>
  81. #endif
  82.  
  83. #ifndef _STORUTIL_
  84. #include <StorUtil.h>
  85. #endif
  86.  
  87. #ifndef SOM_Module_OpenDoc_StdTypes_defined
  88. #include <StdTypes.xh>
  89. #endif
  90.  
  91. #ifndef SOM_Module_OpenDoc_StdProps_defined
  92. #include <StdProps.xh>
  93. #endif
  94.  
  95.  
  96. ODBoolean BeginGetWindowProperties(Environment* ev, ODFrame* frame, WindowProperties* properties)
  97. {
  98.     ASSERT(frame != kODNULL, kODErrInvalidFrame);
  99.         
  100.     ODBoolean propsExist = kODFalse;
  101.         
  102.     ODStorageUnit* frameSU = frame->GetStorageUnit(ev);
  103.     ODStorageUnit* windowPropsSU = kODNULL;
  104.     
  105.     ODID id = ODGetStrongSURefProp(ev, frameSU, kODPropWindowProperties, kODStrongStorageUnitRef);
  106.  
  107.     if (id != 0)
  108.     {
  109.         TRY
  110.         TempODStorageUnit windowPropsSU = frameSU->GetDraft(ev)->AcquireStorageUnit(ev,id);
  111.         if (windowPropsSU)
  112.         {
  113.             propsExist = kODTrue;
  114.             
  115.             ODRect odRect;
  116.             ODGetRectProp(ev, windowPropsSU, kODPropWindowRect, kODRect, &odRect);
  117.             odRect.AsQDRect(properties->boundsRect);        
  118.             
  119.             properties->title[0] = 0;
  120.             ODIText* iText = ODGetITextProp(ev, windowPropsSU, kODPropWindowTitle, kODMacIText, kODNULL);
  121.             if (iText)
  122.                 IntlToPStr(iText, &(properties->title[0])); 
  123.                                     //  No error checking is done for
  124.                                     //  strings longer than 255 chars. 
  125.             DisposeIText(iText);
  126.             
  127.             properties->procID = ODGetSShortProp(ev, 
  128.                 windowPropsSU, kODPropWindowProcID, kODSShort);
  129.             
  130.             properties->wasVisible = ODGetBooleanProp(ev, 
  131.                 windowPropsSU, kODPropWindowIsVisible, kODBoolean);
  132.             properties->hasCloseBox = ODGetBooleanProp(ev, 
  133.                 windowPropsSU, kODPropWindowHasCloseBox, kODBoolean);
  134.             properties->shouldShowLinks = ODGetBooleanProp(ev, 
  135.                 windowPropsSU, kODPropShouldShowLinks, kODBoolean);
  136.             
  137.             properties->refCon = ODGetSLongProp(ev, 
  138.                 windowPropsSU, kODPropWindowRefCon, kODSLong);
  139.             properties->isResizable = ODGetBooleanProp(ev, 
  140.                 windowPropsSU, kODPropWindowIsResizable, kODBoolean);
  141.             properties->isFloating = ODGetBooleanProp(ev, 
  142.                 windowPropsSU, kODPropWindowIsFloating, kODBoolean);
  143.             properties->isRootWindow = ODGetBooleanProp(ev, 
  144.                 windowPropsSU, kODPropWindowIsRootWindow, kODBoolean);
  145.             
  146.             properties->sourceFrame = kODNULL;
  147.             ODID id = ODGetStrongSURefProp(ev, 
  148.                 windowPropsSU, kODPropSourceFrame, kODStrongStorageUnitRef);
  149.             if (id != 0)
  150.             {
  151.                 properties->sourceFrame = windowPropsSU->GetDraft(ev)->AcquireFrame(ev,id);
  152.             }
  153.         }
  154.         CATCH_ALL
  155.             WARN("Frame has kODPropWindowProperties, but unable to retrieve ID for strong suref in it.");
  156.         ENDTRY
  157.     }
  158.     return propsExist;
  159. }
  160.  
  161. void EndGetWindowProperties(Environment* ev, WindowProperties* properties)
  162. {
  163.     if (properties)
  164.         ODRelease(ev, properties->sourceFrame); 
  165. }
  166.  
  167.