xref: /haiku/src/preferences/network/ServiceListItem.h (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 /*
2  * Copyright 2015 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Axel Dörfler, <axeld@pinc-software.de>
7  */
8 #ifndef SERVICE_LIST_ITEM_H
9 #define SERVICE_LIST_ITEM_H
10 
11 
12 #include <ListItem.h>
13 #include <NetworkSettings.h>
14 #include <NetworkSettingsAddOn.h>
15 
16 
17 using namespace BNetworkKit;
18 
19 
20 class ServiceListItem : public BListItem,
21 	public BNetworkKit::BNetworkSettingsListener {
22 public:
23 								ServiceListItem(const char* name,
24 									const char* label,
25 									const BNetworkSettings& settings);
26 	virtual						~ServiceListItem();
27 
28 			const char*			Label() const { return fLabel; }
29 
30 	virtual	void				DrawItem(BView* owner,
31 									BRect bounds, bool complete);
32 	virtual	void				Update(BView* owner, const BFont* font);
33 
34 	inline	const char*			Name() const { return fName; }
35 
36 	virtual	void				SettingsUpdated(uint32 type);
37 
38 protected:
39 	virtual	bool				IsEnabled();
40 
41 private:
42 			const char*			fName;
43 			const char*			fLabel;
44 			const BNetworkSettings&
45 								fSettings;
46 
47 			BView*				fOwner;
48 			float				fLineOffset;
49 			bool				fEnabled;
50 };
51 
52 
53 #endif // SERVICE_LIST_ITEM_H
54