Assorted whitespace cleanup and typo fixes.
[haiku.git] / src / kits / tracker / Bitmaps.h
blob0c1adb95a897f783a08593334fa91a256ebbc4fe
1 /*
2 Open Tracker License
4 Terms and Conditions
6 Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
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:
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.
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.
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.
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.
34 #ifndef _TRACKER_BITMAPS_H
35 #define _TRACKER_BITMAPS_H
38 #include <Locker.h>
39 #include <Resources.h>
40 #include <Mime.h>
41 #include <image.h>
43 #include "TrackerIcons.h"
46 class BBitmap;
48 namespace BPrivate {
50 class BImageResources
52 // convenience class for accessing
53 public:
54 BImageResources(void* memAddr);
55 ~BImageResources();
57 BResources* ViewResources();
58 const BResources* ViewResources() const;
60 status_t FinishResources(BResources*) const;
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.
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.
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
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.
88 private:
89 image_id find_image(void* memAddr) const;
91 mutable BLocker fLock;
92 BResources fResources;
96 extern
97 #ifdef _IMPEXP_TRACKER
98 _IMPEXP_TRACKER
99 #endif
100 BImageResources* GetTrackerResources();
103 } // namespace BPrivate
105 using namespace BPrivate;
108 #endif // _TRACKER_BITMAPS_H