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#include <NetworkSettingsAddOn.h>
18
19
20enum BNetworkInterfaceType {
21	B_NETWORK_INTERFACE_TYPE_WIFI = 'wifi',
22	B_NETWORK_INTERFACE_TYPE_ETHERNET = 'ethr',
23	B_NETWORK_INTERFACE_TYPE_DIAL_UP = 'dial',
24	B_NETWORK_INTERFACE_TYPE_VPN = 'nvpn',
25	B_NETWORK_INTERFACE_TYPE_OTHER = 'othe',
26};
27
28
29class BBitmap;
30
31
32class InterfaceListItem : public BListItem,
33	public BNetworkKit::BNetworkConfigurationListener {
34public:
35								InterfaceListItem(const char* name,
36									BNetworkInterfaceType type);
37								~InterfaceListItem();
38
39			void				DrawItem(BView* owner,
40									BRect bounds, bool complete);
41			void				Update(BView* owner, const BFont* font);
42
43	inline	const char*			Name() const { return fInterface.Name(); }
44
45	virtual	void				ConfigurationUpdated(const BMessage& message);
46
47private:
48			void 				_Init();
49			void				_PopulateBitmaps(const char* mediaType);
50			void				_UpdateState();
51			BBitmap*			_StateIcon() const;
52			const char*			_StateText() const;
53
54private:
55			BNetworkInterfaceType fType;
56
57			BBitmap* 			fIcon;
58			BBitmap*			fIconOffline;
59			BBitmap*			fIconPending;
60			BBitmap*			fIconOnline;
61
62			BNetworkInterface	fInterface;
63				// Hardware Interface
64
65			float				fFirstLineOffset;
66			float				fLineOffset;
67
68			BString				fDeviceName;
69			bool				fDisabled;
70			bool				fHasLink;
71			bool				fConnecting;
72			BString				fSubtitle;
73};
74
75
76#endif // INTERFACE_LIST_ITEM_H
77