1/* 2Open Tracker License 3 4Terms and Conditions 5 6Copyright (c) 1991-2000, Be Incorporated. All rights reserved. 7 8Permission is hereby granted, free of charge, to any person obtaining a copy of 9this software and associated documentation files (the "Software"), to deal in 10the Software without restriction, including without limitation the rights to 11use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12of the Software, and to permit persons to whom the Software is furnished to do 13so, subject to the following conditions: 14 15The above copyright notice and this permission notice applies to all licensees 16and shall be included in all copies or substantial portions of the Software. 17 18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY, 20FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 22AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION 23WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 25Except as contained in this notice, the name of Be Incorporated shall not be 26used in advertising or otherwise to promote the sale, use or other dealings in 27this Software without prior written authorization from Be Incorporated. 28 29Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks 30of Be Incorporated in the United States and other countries. Other brand product 31names are registered trademarks or trademarks of their respective holders. 32All rights reserved. 33*/ 34#ifndef _TRACKER_BITMAPS_H 35#define _TRACKER_BITMAPS_H 36 37 38#include <Locker.h> 39#include <Resources.h> 40#include <Mime.h> 41#include <image.h> 42 43#include "TrackerIcons.h" 44 45 46class BBitmap; 47 48namespace BPrivate { 49 50class BImageResources 51{ 52 // convenience class for accessing 53public: 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 88private: 89 image_id find_image(void* memAddr) const; 90 91 mutable BLocker fLock; 92 BResources fResources; 93}; 94 95 96extern 97#ifdef _IMPEXP_TRACKER 98_IMPEXP_TRACKER 99#endif 100BImageResources* GetTrackerResources(); 101 102 103} // namespace BPrivate 104 105using namespace BPrivate; 106 107 108#endif // _TRACKER_BITMAPS_H 109