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_VIEW_H 9 #define SERVICE_VIEW_H 10 11 12 #include <NetworkSettings.h> 13 #include <GroupView.h> 14 15 16 using namespace BNetworkKit; 17 18 class BButton; 19 20 21 class ServiceView : public BGroupView { 22 public: 23 ServiceView(const char* name, 24 const char* executable, const char* title, 25 const char* description, 26 BNetworkSettings& settings); 27 virtual ~ServiceView(); 28 29 bool IsRevertable() const; 30 status_t Revert(); 31 32 void SettingsUpdated(uint32 which); 33 34 virtual void AttachedToWindow(); 35 virtual void MessageReceived(BMessage* message); 36 37 protected: 38 virtual bool IsEnabled() const; 39 virtual void Enable(); 40 virtual void Disable(); 41 42 private: 43 void _Toggle(); 44 void _UpdateEnableButton(); 45 46 protected: 47 const char* fName; 48 const char* fExecutable; 49 BNetworkSettings& fSettings; 50 BButton* fEnableButton; 51 bool fWasEnabled; 52 }; 53 54 55 #endif // SERVICE_VIEW_H 56