docs/ikteam: Delete most files.
[haiku.git] / src / preferences / media / MediaIcons.cpp
blob984ce9b4fd8682cd24a17b2e5e10bb2b67439e7b
1 /*
2 * Copyright 2010, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
6 #include "MediaIcons.h"
8 #include <Application.h>
9 #include <File.h>
10 #include <Resources.h>
11 #include <Roster.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)
33 app_info info;
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);
48 void
49 MediaIcons::_LoadBitmap(BResources* resources, int32 id, BBitmap* bitmap)
51 size_t size;
52 const void* bits = resources->LoadResource(B_COLOR_8_BIT_TYPE, id, &size);
53 bitmap->SetBits(bits, size, 0, B_CMAP8);
57 BRect
58 MediaIcons::IconRectAt(const BPoint& topLeft)
60 return BRect(sBounds).OffsetToSelf(topLeft);