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 Development Framework / ODFDev / ODF / OS / FWGraphx / SLIcon.cpp < prev    next >
Encoding:
Text File  |  1996-09-17  |  6.6 KB  |  219 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                SLIcon.cpp
  4. //    Release Version:    $ ODF 2 $
  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. //----------------------------------------------------------------------------------------
  33. //    FW_PrivIcon_CreateFromPlatformIcon
  34. //----------------------------------------------------------------------------------------
  35.  
  36. FW_HIcon SL_API FW_PrivIcon_CreateFromPlatformIcon(FW_PlatformIcon     hIcon,
  37.                                                     FW_PlatformError*     error)
  38. {
  39.     FW_ERR_TRY
  40.     {
  41.         return FW_NEW(FW_CPrivIconRep, (hIcon));
  42.     }
  43.     FW_ERR_CATCH
  44.     return 0;    
  45. }
  46.  
  47. //----------------------------------------------------------------------------------------
  48. //    FW_PrivIcon_CreateFromResource
  49. //----------------------------------------------------------------------------------------
  50.  
  51. FW_HIcon SL_API FW_PrivIcon_CreateFromResource(FW_OResourceFile*     resourceFile,
  52.                                                 FW_ResourceID         resID,
  53.                                                 short                 size,
  54.                                                 FW_PlatformError*     error)
  55. {
  56.     FW_ERR_TRY
  57.     {
  58.         return FW_NEW(FW_CPrivIconRep, (resourceFile, resID, size));
  59.     }
  60.     FW_ERR_CATCH
  61.     return 0;    
  62. }
  63.  
  64. //----------------------------------------------------------------------------------------
  65. //    FW_PrivIcon_Copy
  66. //----------------------------------------------------------------------------------------
  67.  
  68. FW_HIcon SL_API FW_PrivIcon_Copy(FW_HIcon icon, FW_PlatformError* error)
  69. {
  70.     FW_ERR_TRY
  71.     {
  72.         return FW_NEW(FW_CPrivIconRep, (*icon));
  73.     }
  74.     FW_ERR_CATCH
  75.     return 0;    
  76. }
  77.  
  78. //----------------------------------------------------------------------------------------
  79. //    FW_PrivIcon_Acquire
  80. //----------------------------------------------------------------------------------------
  81.  
  82. void SL_API    FW_PrivIcon_Acquire(FW_HIcon icon)
  83. {
  84.     // No try block necessary - Do not throw
  85.     icon->Acquire();
  86. }
  87.  
  88. //----------------------------------------------------------------------------------------
  89. //    FW_PrivIcon_GetRefCount
  90. //----------------------------------------------------------------------------------------
  91.  
  92. long SL_API FW_PrivIcon_GetRefCount(FW_HIcon icon)
  93. {
  94.     // No try block necessary - Do not throw
  95.     return icon->GetRefCount();
  96. }
  97.  
  98. //----------------------------------------------------------------------------------------
  99. //    FW_PrivIcon_Release
  100. //----------------------------------------------------------------------------------------
  101.  
  102. void SL_API    FW_PrivIcon_Release(FW_HIcon icon)
  103. {
  104.     // No try block necessary - Do not throw
  105.     icon->Release();
  106. }
  107.  
  108. //----------------------------------------------------------------------------------------
  109. //    FW_PrivIcon_IsEqual
  110. //----------------------------------------------------------------------------------------
  111.  
  112. FW_Boolean SL_API FW_PrivIcon_IsEqual(FW_HIcon icon, FW_HIcon icon2)
  113. {
  114.     // No try block necessary - Do not throw
  115.     return icon->IsEqual(icon2);
  116. }
  117.  
  118. //----------------------------------------------------------------------------------------
  119. //    FW_PrivIcon_GetPlatformIcon
  120. //----------------------------------------------------------------------------------------
  121.  
  122. FW_PlatformIcon SL_API FW_PrivIcon_GetPlatformIcon(FW_HIcon icon)
  123. {
  124.     // No try block necessary - Do not throw
  125.     return icon->GetPlatformIcon();
  126. }
  127.  
  128. //----------------------------------------------------------------------------------------
  129. //    FW_PrivIcon_OrphanPlatformIcon
  130. //----------------------------------------------------------------------------------------
  131.  
  132. FW_PlatformIcon SL_API FW_PrivIcon_OrphanPlatformIcon(FW_HIcon icon)
  133. {
  134.     // No try block necessary - Do not throw
  135.     return icon->OrphanPlatformIcon();
  136. }
  137.  
  138. //----------------------------------------------------------------------------------------
  139. //    FW_PrivIcon_IsPlatformIconOrphan
  140. //----------------------------------------------------------------------------------------
  141.  
  142. FW_Boolean SL_API FW_PrivIcon_IsPlatformIconOrphan(FW_HIcon icon)
  143. {
  144.     // No try block necessary - Do not throw
  145.     return icon->IsPlatformIconOrphan();
  146. }
  147.  
  148. //----------------------------------------------------------------------------------------
  149. //    FW_PrivIcon_SetPlatformIcon
  150. //----------------------------------------------------------------------------------------
  151.  
  152. FW_PlatformError SL_API    FW_PrivIcon_SetPlatformIcon(FW_HIcon icon, FW_PlatformIcon newIcon)
  153. {
  154.     // No try block necessary - Do not throw
  155.     icon->SetPlatformIcon(newIcon);
  156.     return FW_xNoError;
  157. }
  158.  
  159. //----------------------------------------------------------------------------------------
  160. //    FW_PrivIcon_AdoptPlatformIcon
  161. //----------------------------------------------------------------------------------------
  162.  
  163. FW_PlatformError SL_API    FW_PrivIcon_AdoptPlatformIcon(FW_HIcon icon, FW_PlatformIcon newIcon)
  164. {
  165.     // No try block necessary - Do not throw
  166.     icon->AdoptPlatformIcon(newIcon);
  167.     return FW_xNoError;
  168. }
  169.     
  170. //----------------------------------------------------------------------------------------
  171. //    FW_PrivIcon_GetIconSize
  172. //----------------------------------------------------------------------------------------
  173.  
  174. void SL_API    FW_PrivIcon_GetIconSize(FW_HIcon icon, FW_SPoint& size)
  175. {
  176.     // No try block necessary - Do not throw
  177.     icon->GetIconSize(size);
  178. }
  179.  
  180. //----------------------------------------------------------------------------------------
  181. //    FW_PrivIcon_GetIconSizeGC
  182. //----------------------------------------------------------------------------------------
  183.  
  184. void SL_API    FW_PrivIcon_GetIconSizeGC(Environment* ev, FW_HIcon icon, FW_SGraphicContext& gc, FW_SPoint& size)
  185. {
  186.     // No try block necessary - Do not throw
  187.     icon->GetIconSize(ev, gc, size);
  188. }
  189.  
  190. //----------------------------------------------------------------------------------------
  191. //    FW_PrivIcon_Read
  192. //----------------------------------------------------------------------------------------
  193.  
  194. FW_HIcon SL_API    FW_PrivIcon_Read(FW_HReadableStream hStream, FW_PlatformError* error)
  195. {
  196.     FW_ERR_TRY
  197.     {
  198.         FW_CReadableStream stream(hStream);
  199.         return FW_NEW(FW_CPrivIconRep, (stream));
  200.     }
  201.     FW_ERR_CATCH
  202.     return 0;    
  203. }
  204.  
  205. //----------------------------------------------------------------------------------------
  206. //    FW_PrivIcon_Write
  207. //----------------------------------------------------------------------------------------
  208.  
  209. void SL_API    FW_PrivIcon_Write(FW_HIcon icon, FW_HWritableStream hStream, FW_PlatformError* error)
  210. {
  211.     FW_ERR_TRY
  212.     {
  213.         FW_CWritableStream stream(hStream);
  214.         icon->Write(stream);
  215.     }
  216.     FW_ERR_CATCH
  217. }
  218.  
  219.