home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Sources / SLIcon.cpp < prev    next >
Encoding:
Text File  |  1996-04-25  |  3.4 KB  |  169 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                SLIcon.cpp
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "FWOS.hpp"
  11.  
  12. #ifndef SLICON_H
  13. #include "SLIcon.h"
  14. #endif
  15.  
  16. #ifndef PRICON_H
  17. #include "PRIcon.h"
  18. #endif
  19.  
  20. #ifndef FWODEXCE_H
  21. #include "FWODExce.h"
  22. #endif
  23.  
  24. #ifndef FWSTRMRW_H
  25. #include "FWStrmRW.h"
  26. #endif
  27.  
  28. #ifdef FW_BUILD_MAC
  29. #pragma segment FWGraphics_Icon
  30. #endif
  31.  
  32. // Creation
  33.  
  34. FW_HIcon            SL_API    FW_PrivIcon_CreateFromPlatformIcon(
  35.                                 FW_PlatformIcon     hIcon,
  36.                                 FW_PlatformError*     error)
  37. {
  38.     FW_ERR_TRY
  39.     {
  40.         return FW_NEW(FW_CPrivIconRep, (hIcon));
  41.     }
  42.     FW_ERR_CATCH
  43.     return 0;    
  44. }
  45.  
  46. FW_HIcon            SL_API    FW_PrivIcon_CreateFromResource(
  47.                                 FW_OResourceFile*     resourceFile,
  48.                                 FW_ResourceId         resId,
  49.                                 short                 size,
  50.                                 FW_PlatformError*     error)
  51. {
  52.     FW_ERR_TRY
  53.     {
  54.         return FW_NEW(FW_CPrivIconRep, (resourceFile, resId, size));
  55.     }
  56.     FW_ERR_CATCH
  57.     return 0;    
  58. }
  59.  
  60. FW_HIcon            SL_API    FW_PrivIcon_Copy(FW_HIcon icon, FW_PlatformError* error)
  61. {
  62.     FW_ERR_TRY
  63.     {
  64.         return FW_NEW(FW_CPrivIconRep, (*icon));
  65.     }
  66.     FW_ERR_CATCH
  67.     return 0;    
  68. }
  69.  
  70. // Reference counting
  71.  
  72. void                SL_API    FW_PrivIcon_Acquire(FW_HIcon icon)
  73. {
  74.     // No try block necessary - Do not throw
  75.     icon->Acquire();
  76. }
  77.  
  78. long                SL_API    FW_PrivIcon_GetRefCount(FW_HIcon icon)
  79. {
  80.     // No try block necessary - Do not throw
  81.     return icon->GetRefCount();
  82. }
  83.  
  84. void                SL_API    FW_PrivIcon_Release(FW_HIcon icon)
  85. {
  86.     // No try block necessary - Do not throw
  87.     icon->Release();
  88. }
  89.  
  90. // Comparison
  91.  
  92. FW_Boolean            SL_API    FW_PrivIcon_IsEqual(FW_HIcon icon, FW_HIcon icon2)
  93. {
  94.     // No try block necessary - Do not throw
  95.     return icon->IsEqual(icon2);
  96. }
  97.  
  98. // Get, Set, Adopt and Orphan
  99.  
  100. FW_PlatformIcon        SL_API    FW_PrivIcon_GetPlatformIcon(FW_HIcon icon)
  101. {
  102.     // No try block necessary - Do not throw
  103.     return icon->GetPlatformIcon();
  104. }
  105.  
  106. FW_PlatformIcon        SL_API    FW_PrivIcon_OrphanPlatformIcon(FW_HIcon icon)
  107. {
  108.     // No try block necessary - Do not throw
  109.     return icon->OrphanPlatformIcon();
  110. }
  111.  
  112. FW_Boolean            SL_API    FW_PrivIcon_IsPlatformIconOrphan(FW_HIcon icon)
  113. {
  114.     // No try block necessary - Do not throw
  115.     return icon->IsPlatformIconOrphan();
  116. }
  117.  
  118. FW_PlatformError    SL_API    FW_PrivIcon_SetPlatformIcon(FW_HIcon icon, FW_PlatformIcon newIcon)
  119. {
  120.     // No try block necessary - Do not throw
  121.     icon->SetPlatformIcon(newIcon);
  122.     return FW_xNoError;
  123. }
  124.  
  125. FW_PlatformError    SL_API    FW_PrivIcon_AdoptPlatformIcon(FW_HIcon icon, FW_PlatformIcon newIcon)
  126. {
  127.     // No try block necessary - Do not throw
  128.     icon->AdoptPlatformIcon(newIcon);
  129.     return FW_xNoError;
  130. }
  131.     
  132. // Size
  133.  
  134. void                SL_API    FW_PrivIcon_GetIconSize(FW_HIcon icon, FW_SPoint& size)
  135. {
  136.     // No try block necessary - Do not throw
  137.     icon->GetIconSize(size);
  138. }
  139.  
  140. void    SL_API    FW_PrivIcon_GetIconSizeGC(Environment* ev, FW_HIcon icon, FW_SGraphicContext& gc, FW_SPoint& size)
  141. {
  142.     // No try block necessary - Do not throw
  143.     icon->GetIconSize(ev, gc, size);
  144. }
  145.  
  146. // Streaming
  147.  
  148. FW_HIcon            SL_API    FW_PrivIcon_Read(FW_HReadableStream hStream, FW_PlatformError* error)
  149. {
  150.     FW_ERR_TRY
  151.     {
  152.         FW_CReadableStream stream(hStream);
  153.         return FW_NEW(FW_CPrivIconRep, (stream));
  154.     }
  155.     FW_ERR_CATCH
  156.     return 0;    
  157. }
  158.  
  159. void                SL_API    FW_PrivIcon_Write(FW_HIcon icon, FW_HWritableStream hStream, FW_PlatformError* error)
  160. {
  161.     FW_ERR_TRY
  162.     {
  163.         FW_CWritableStream stream(hStream);
  164.         icon->Write(stream);
  165.     }
  166.     FW_ERR_CATCH
  167. }
  168.  
  169.