xref: /haiku/src/preferences/bluetooth/BluetoothDeviceView.h (revision 0562493379cd52eb7103531f895f10bb8e77c085)
1 /*
2  * Copyright 2008-09, Oliver Ruiz Dorantes, <oliver.ruiz.dorantes_at_gmail.com>
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef BLUETOOTHDEVICEVIEW_H_
6 #define BLUETOOTHDEVICEVIEW_H_
7 
8 #include <View.h>
9 #include <Message.h>
10 #include <Invoker.h>
11 #include <Box.h>
12 #include <Bitmap.h>
13 
14 #include <bluetooth/BluetoothDevice.h>
15 
16 
17 class BStringView;
18 class BitmapView;
19 
20 class BluetoothDeviceView : public BView
21 {
22 public:
23 	BluetoothDeviceView(BRect frame, BluetoothDevice* bDevice,
24 		uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
25 		uint32 flags = B_WILL_DRAW);
26 	~BluetoothDeviceView(void);
27 
28 			void SetBluetoothDevice(BluetoothDevice* bdev);
29 
30 	virtual void MessageReceived(BMessage *msg);
31 	virtual void SetTarget(BHandler *tgt);
32 	virtual void SetEnabled(bool value);
33 
34 protected:
35 	BluetoothDevice*	fDevice;
36 
37 	BStringView*		fName;
38 	BStringView*		fBdaddr;
39 	BStringView*		fClassService;
40 	BStringView*		fClass;
41 
42 	BStringView*		fHCIVersionProperties;
43 	BStringView*		fLMPVersionProperties;
44 	BStringView*		fManufacturerProperties;
45 
46 	BStringView*		fBuffersProperties;
47 
48 	BitmapView*			fIcon;
49 
50 };
51 
52 
53 class BitmapView : public BView
54 {
55 	public:
56 		BitmapView(BBitmap *bitmap) : BView(bitmap->Bounds(), NULL,
57 			B_FOLLOW_NONE, B_WILL_DRAW)
58 		{
59 			fBitmap = bitmap;
60 
61 			SetDrawingMode(B_OP_ALPHA);
62 			SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
63 		}
64 
65 		~BitmapView()
66 		{
67 			delete fBitmap;
68 		}
69 
70 		virtual void AttachedToWindow()
71 		{
72 			//SetViewColor(Parent()->ViewColor());
73 
74 			//MoveTo((Parent()->Bounds().Width() - Bounds().Width()) / 2,	Frame().top);
75 		}
76 
77 		virtual void Draw(BRect updateRect)
78 		{
79 			DrawBitmap(fBitmap, updateRect, updateRect);
80 		}
81 
82 	private:
83 		BBitmap *fBitmap;
84 };
85 
86 
87 
88 
89 #endif
90