xref: /haiku/src/preferences/network/ServiceListItem.h (revision ee834bb870869ca58fa6ba3f057bc9bd44b2fdf9)
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 	virtual	void				DrawItem(BView* owner,
29 									BRect bounds, bool complete);
30 	virtual	void				Update(BView* owner, const BFont* font);
31 
32 	inline	const char*			Name() const { return fName; }
33 
34 	virtual	void				SettingsUpdated(uint32 type);
35 
36 protected:
37 	virtual	bool				IsEnabled();
38 
39 private:
40 			const char*			fName;
41 			const char*			fLabel;
42 			const BNetworkSettings&
43 								fSettings;
44 
45 			BView*				fOwner;
46 			float				fLineOffset;
47 			bool				fEnabled;
48 };
49 
50 
51 #endif // SERVICE_LIST_ITEM_H
52