1*b63e3a34SAlex Wilson /* 2*b63e3a34SAlex Wilson * Copyright 2010, Haiku, Inc. All rights reserved. 3*b63e3a34SAlex Wilson * Distributed under the terms of the MIT License. 4*b63e3a34SAlex Wilson */ 5*b63e3a34SAlex Wilson 6*b63e3a34SAlex Wilson #include "MediaIcons.h" 7*b63e3a34SAlex Wilson 8*b63e3a34SAlex Wilson #include <Application.h> 9*b63e3a34SAlex Wilson #include <File.h> 10*b63e3a34SAlex Wilson #include <Resources.h> 11*b63e3a34SAlex Wilson #include <Roster.h> 12*b63e3a34SAlex Wilson 13*b63e3a34SAlex Wilson #include "IconHandles.h" 14*b63e3a34SAlex Wilson 15*b63e3a34SAlex Wilson 16*b63e3a34SAlex Wilson const BRect MediaIcons::sBounds(0, 0, 15, 15); 17*b63e3a34SAlex Wilson 18*b63e3a34SAlex Wilson MediaIcons::MediaIcons() 19*b63e3a34SAlex Wilson : 20*b63e3a34SAlex Wilson devicesIcon(sBounds, B_CMAP8), 21*b63e3a34SAlex Wilson mixerIcon(sBounds, B_CMAP8), 22*b63e3a34SAlex Wilson tvIcon(sBounds, B_CMAP8), 23*b63e3a34SAlex Wilson camIcon(sBounds, B_CMAP8), 24*b63e3a34SAlex Wilson micIcon(sBounds, B_CMAP8), 25*b63e3a34SAlex Wilson speakerIcon(sBounds, B_CMAP8) 26*b63e3a34SAlex Wilson { 27*b63e3a34SAlex Wilson app_info info; 28*b63e3a34SAlex Wilson be_app->GetAppInfo(&info); 29*b63e3a34SAlex Wilson BFile executableFile(&info.ref, B_READ_ONLY); 30*b63e3a34SAlex Wilson BResources resources(&executableFile); 31*b63e3a34SAlex Wilson resources.PreloadResourceType(B_COLOR_8_BIT_TYPE); 32*b63e3a34SAlex Wilson 33*b63e3a34SAlex Wilson _LoadBitmap(&resources, devices_icon, &devicesIcon); 34*b63e3a34SAlex Wilson _LoadBitmap(&resources, mixer_icon, &mixerIcon); 35*b63e3a34SAlex Wilson _LoadBitmap(&resources, tv_icon, &tvIcon); 36*b63e3a34SAlex Wilson _LoadBitmap(&resources, cam_icon, &camIcon); 37*b63e3a34SAlex Wilson _LoadBitmap(&resources, mic_icon, &micIcon); 38*b63e3a34SAlex Wilson _LoadBitmap(&resources, speaker_icon, &speakerIcon); 39*b63e3a34SAlex Wilson } 40*b63e3a34SAlex Wilson 41*b63e3a34SAlex Wilson 42*b63e3a34SAlex Wilson void 43*b63e3a34SAlex Wilson MediaIcons::_LoadBitmap(BResources* resources, int32 id, BBitmap* bitmap) 44*b63e3a34SAlex Wilson { 45*b63e3a34SAlex Wilson size_t size; 46*b63e3a34SAlex Wilson const void* bits = resources->LoadResource(B_COLOR_8_BIT_TYPE, id, &size); 47*b63e3a34SAlex Wilson bitmap->SetBits(bits, size, 0, B_CMAP8); 48*b63e3a34SAlex Wilson } 49*b63e3a34SAlex Wilson 50*b63e3a34SAlex Wilson 51*b63e3a34SAlex Wilson BRect 52*b63e3a34SAlex Wilson MediaIcons::IconRectAt(const BPoint& topLeft) 53*b63e3a34SAlex Wilson { 54*b63e3a34SAlex Wilson return BRect(sBounds).OffsetToSelf(topLeft); 55*b63e3a34SAlex Wilson } 56