1*f0c31011SIngo Weinhold /* 2*f0c31011SIngo Weinhold * Copyright 2013, Haiku, Inc. All Rights Reserved. 3*f0c31011SIngo Weinhold * Distributed under the terms of the MIT License. 4*f0c31011SIngo Weinhold */ 5*f0c31011SIngo Weinhold #ifndef _INTERFACE__ICON_H_ 6*f0c31011SIngo Weinhold #define _INTERFACE__ICON_H_ 7*f0c31011SIngo Weinhold 8*f0c31011SIngo Weinhold 9*f0c31011SIngo Weinhold #include <InterfaceDefs.h> 10*f0c31011SIngo Weinhold #include <ObjectList.h> 11*f0c31011SIngo Weinhold #include <Rect.h> 12*f0c31011SIngo Weinhold 13*f0c31011SIngo Weinhold 14*f0c31011SIngo Weinhold class BBitmap; 15*f0c31011SIngo Weinhold 16*f0c31011SIngo Weinhold 17*f0c31011SIngo Weinhold namespace BPrivate { 18*f0c31011SIngo Weinhold 19*f0c31011SIngo Weinhold 20*f0c31011SIngo Weinhold class BIcon { 21*f0c31011SIngo Weinhold public: 22*f0c31011SIngo Weinhold BIcon(); 23*f0c31011SIngo Weinhold ~BIcon(); 24*f0c31011SIngo Weinhold 25*f0c31011SIngo Weinhold status_t SetTo(const BBitmap* bitmap, uint32 flags = 0); 26*f0c31011SIngo Weinhold 27*f0c31011SIngo Weinhold bool SetBitmap(BBitmap* bitmap, uint32 which); 28*f0c31011SIngo Weinhold BBitmap* Bitmap(uint32 which) const; 29*f0c31011SIngo Weinhold 30*f0c31011SIngo Weinhold status_t SetExternalBitmap(const BBitmap* bitmap, 31*f0c31011SIngo Weinhold uint32 which, uint32 flags); 32*f0c31011SIngo Weinhold 33*f0c31011SIngo Weinhold BBitmap* CreateBitmap(const BRect& bounds, 34*f0c31011SIngo Weinhold color_space colorSpace, uint32 which); 35*f0c31011SIngo Weinhold BBitmap* CopyBitmap(const BBitmap& bitmapToClone, 36*f0c31011SIngo Weinhold uint32 which); 37*f0c31011SIngo Weinhold void DeleteBitmaps(); 38*f0c31011SIngo Weinhold 39*f0c31011SIngo Weinhold // convenience methods for icon owners 40*f0c31011SIngo Weinhold static status_t UpdateIcon(const BBitmap* bitmap, uint32 flags, 41*f0c31011SIngo Weinhold BIcon*& _icon); 42*f0c31011SIngo Weinhold static status_t SetIconBitmap(const BBitmap* bitmap, 43*f0c31011SIngo Weinhold uint32 which, uint32 flags, BIcon*& _icon); 44*f0c31011SIngo Weinhold 45*f0c31011SIngo Weinhold private: 46*f0c31011SIngo Weinhold typedef BObjectList<BBitmap> BitmapList; 47*f0c31011SIngo Weinhold 48*f0c31011SIngo Weinhold private: 49*f0c31011SIngo Weinhold static BBitmap* _ConvertToRGB32(const BBitmap* bitmap, 50*f0c31011SIngo Weinhold bool noAppServerLink = false); 51*f0c31011SIngo Weinhold static status_t _TrimBitmap(const BBitmap* bitmap, 52*f0c31011SIngo Weinhold bool keepAspect, BBitmap*& _trimmedBitmap); 53*f0c31011SIngo Weinhold status_t _MakeBitmaps(const BBitmap* bitmap, 54*f0c31011SIngo Weinhold uint32 flags); 55*f0c31011SIngo Weinhold 56*f0c31011SIngo Weinhold private: 57*f0c31011SIngo Weinhold BitmapList fEnabledBitmaps; 58*f0c31011SIngo Weinhold BitmapList fDisabledBitmaps; 59*f0c31011SIngo Weinhold }; 60*f0c31011SIngo Weinhold 61*f0c31011SIngo Weinhold 62*f0c31011SIngo Weinhold } // namespace BPrivate 63*f0c31011SIngo Weinhold 64*f0c31011SIngo Weinhold 65*f0c31011SIngo Weinhold using BPrivate::BIcon; 66*f0c31011SIngo Weinhold 67*f0c31011SIngo Weinhold 68*f0c31011SIngo Weinhold #endif // _INTERFACE__ICON_H_ 69