2 * Copyright 2010, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 #include "MediaIcons.h"
8 #include <Application.h>
10 #include <Resources.h>
13 #include "IconHandles.h"
16 const BRect
MediaIcons::sBounds(0, 0, 15, 15);
19 MediaIcons::IconSet::IconSet()
21 inputIcon(MediaIcons::sBounds
, B_CMAP8
),
22 outputIcon(MediaIcons::sBounds
, B_CMAP8
)
28 MediaIcons::MediaIcons()
30 devicesIcon(sBounds
, B_CMAP8
),
31 mixerIcon(sBounds
, B_CMAP8
)
34 be_app
->GetAppInfo(&info
);
35 BFile
executableFile(&info
.ref
, B_READ_ONLY
);
36 BResources
resources(&executableFile
);
37 resources
.PreloadResourceType(B_COLOR_8_BIT_TYPE
);
39 _LoadBitmap(&resources
, devices_icon
, &devicesIcon
);
40 _LoadBitmap(&resources
, mixer_icon
, &mixerIcon
);
41 _LoadBitmap(&resources
, tv_icon
, &videoIcons
.outputIcon
);
42 _LoadBitmap(&resources
, cam_icon
, &videoIcons
.inputIcon
);
43 _LoadBitmap(&resources
, mic_icon
, &audioIcons
.inputIcon
);
44 _LoadBitmap(&resources
, speaker_icon
, &audioIcons
.outputIcon
);
49 MediaIcons::_LoadBitmap(BResources
* resources
, int32 id
, BBitmap
* bitmap
)
52 const void* bits
= resources
->LoadResource(B_COLOR_8_BIT_TYPE
, id
, &size
);
53 bitmap
->SetBits(bits
, size
, 0, B_CMAP8
);
58 MediaIcons::IconRectAt(const BPoint
& topLeft
)
60 return BRect(sBounds
).OffsetToSelf(topLeft
);