xref: /haiku/src/preferences/network/InterfaceListItem.h (revision 2864e4da5ef3d145809699fa82ec9066f30e0b34)
1 /*
2  * Copyright 2004-2015 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Alexander von Gluck, kallisti5@unixzen.com
7  *		Philippe Houdoin
8  *		Fredrik Modéen
9  *		John Scipione, jscipione@gmail.com
10  */
11 #ifndef INTERFACE_LIST_ITEM_H
12 #define INTERFACE_LIST_ITEM_H
13 
14 
15 #include <ListItem.h>
16 #include <NetworkInterface.h>
17 
18 
19 class BBitmap;
20 
21 
22 class InterfaceListItem : public BListItem {
23 public:
24 								InterfaceListItem(const char* name);
25 								~InterfaceListItem();
26 
27 			void				DrawItem(BView* owner,
28 									BRect bounds, bool complete);
29 			void				Update(BView* owner, const BFont* font);
30 
31 	inline	const char*			Name() { return fInterface.Name(); }
32 
33 private:
34 			void 				_Init();
35 			void				_PopulateBitmaps(const char* mediaType);
36 			void				_UpdateState();
37 			BBitmap*			_StateIcon() const;
38 			const char*			_StateText() const;
39 
40 private:
41 			BBitmap* 			fIcon;
42 			BBitmap*			fIconOffline;
43 			BBitmap*			fIconPending;
44 			BBitmap*			fIconOnline;
45 
46 			BNetworkInterface	fInterface;
47 				// Hardware Interface
48 
49 			float				fFirstLineOffset;
50 			float				fLineOffset;
51 
52 			BString				fDeviceName;
53 			bool				fDisabled;
54 			bool				fHasLink;
55 			bool				fConnecting;
56 			BString				fAddress[2];
57 };
58 
59 
60 #endif // INTERFACE_LIST_ITEM_H
61