1 /* 2 Open Tracker License 3 4 Terms and Conditions 5 6 Copyright (c) 1991-2000, Be Incorporated. All rights reserved. 7 8 Permission is hereby granted, free of charge, to any person obtaining a copy of 9 this software and associated documentation files (the "Software"), to deal in 10 the Software without restriction, including without limitation the rights to 11 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 of the Software, and to permit persons to whom the Software is furnished to do 13 so, subject to the following conditions: 14 15 The above copyright notice and this permission notice applies to all licensees 16 and shall be included in all copies or substantial portions of the Software. 17 18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY, 20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 22 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION 23 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 25 Except as contained in this notice, the name of Be Incorporated shall not be 26 used in advertising or otherwise to promote the sale, use or other dealings in 27 this Software without prior written authorization from Be Incorporated. 28 29 Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks 30 of Be Incorporated in the United States and other countries. Other brand product 31 names are registered trademarks or trademarks of their respective holders. 32 All rights reserved. 33 */ 34 35 #ifndef __BITS__ 36 #define __BITS__ 37 38 39 #include <Locker.h> 40 #include <Resources.h> 41 #include <Mime.h> 42 #include <image.h> 43 44 #include "TrackerIcons.h" 45 46 class BBitmap; 47 48 namespace BPrivate { 49 50 class BImageResources 51 { 52 // convenience class for accessing 53 public: 54 BImageResources(void *memAddr); 55 ~BImageResources(); 56 57 BResources *ViewResources(); 58 const BResources *ViewResources() const; 59 60 status_t FinishResources(BResources *) const; 61 62 const void *LoadResource(type_code type, int32 id, 63 size_t *outSize) const; 64 const void *LoadResource(type_code type, const char *name, 65 size_t *outSize) const; 66 // load a resource from the Tracker executable, just like the 67 // corresponding functions in BResources. These methods are 68 // thread-safe. 69 70 status_t GetIconResource(int32 id, icon_size size, BBitmap *dest) const; 71 // this is a wrapper around LoadResource(), for retrieving 72 // B_LARGE_ICON and B_MINI_ICON ('ICON' and 'MICN' respectively) 73 // resources. this does sanity checking on the found data, 74 // and if all is okay blasts it into the 'dest' bitmap. 75 76 status_t GetIconResource(int32 id, const uint8** iconData, 77 size_t* iconSize) const; 78 // this is a wrapper around LoadResource(), for retrieving 79 // the vector icon data 80 81 status_t GetBitmapResource(type_code type, int32 id, BBitmap **out) const; 82 // this is a wrapper around LoadResource(), for retrieving 83 // arbitrary bitmaps. the resource with the given type and 84 // id is looked up, and a BBitmap created from it and returned 85 // in <out>. currently it can only create bitmaps from data 86 // that is an archived bitmap object. 87 88 private: 89 image_id find_image(void *memAddr) const; 90 91 mutable BLocker fLock; 92 BResources fResources; 93 }; 94 95 96 97 extern 98 #ifdef _IMPEXP_TRACKER 99 _IMPEXP_TRACKER 100 #endif 101 BImageResources* GetTrackerResources(); 102 103 } // namespace BPrivate 104 105 using namespace BPrivate; 106 107 #endif // __BITS__ 108