1 /* 2 * Copyright 2010, Axel Dörfler, axeld@pinc-software.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include "WirelessNetworkMenuItem.h" 8 9 #include "RadioView.h" 10 11 12 WirelessNetworkMenuItem::WirelessNetworkMenuItem(const char* name, 13 int32 signalQuality, bool encrypted, BMessage* message) 14 : 15 BMenuItem(name, message), 16 fQuality(signalQuality), 17 fIsEncrypted(encrypted) 18 { 19 } 20 21 22 WirelessNetworkMenuItem::~WirelessNetworkMenuItem() 23 { 24 } 25 26 27 void 28 WirelessNetworkMenuItem::SetSignalQuality(int32 quality) 29 { 30 fQuality = quality; 31 } 32 33 34 void 35 WirelessNetworkMenuItem::DrawContent() 36 { 37 DrawRadioIcon(); 38 BMenuItem::DrawContent(); 39 } 40 41 42 void 43 WirelessNetworkMenuItem::Highlight(bool isHighlighted) 44 { 45 BMenuItem::Highlight(isHighlighted); 46 } 47 48 49 void 50 WirelessNetworkMenuItem::GetContentSize(float* width, float* height) 51 { 52 BMenuItem::GetContentSize(width, height); 53 *width += *height + 4; 54 } 55 56 57 void 58 WirelessNetworkMenuItem::DrawRadioIcon() 59 { 60 BRect bounds = Frame(); 61 bounds.left = bounds.right - 4 - bounds.Height(); 62 bounds.right -= 4; 63 bounds.bottom -= 2; 64 65 RadioView::Draw(Menu(), bounds, fQuality, RadioView::DefaultMax()); 66 } 67