2 * Copyright 2004-2015 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 #ifndef _NETWORK_SETTINGS_ADD_ON_H
7 #define _NETWORK_SETTINGS_ADD_ON_H
12 #include <Resources.h>
17 class BNetworkAddress
;
20 namespace BNetworkKit
{
23 enum BNetworkSettingsType
{
24 B_NETWORK_SETTINGS_TYPE_INTERFACE
= 'intf',
25 B_NETWORK_SETTINGS_TYPE_SERVICE
= 'serv',
26 B_NETWORK_SETTINGS_TYPE_DIAL_UP
= 'dial',
27 B_NETWORK_SETTINGS_TYPE_VPN
= 'vpnc',
28 B_NETWORK_SETTINGS_TYPE_OTHER
= 'othr'
31 class BNetworkProfile
;
32 class BNetworkSettings
;
35 class BNetworkConfigurationListener
{
37 virtual void ConfigurationUpdated(
38 const BMessage
& message
) = 0;
42 class BNetworkSettingsListener
{
44 virtual void SettingsUpdated(uint32 type
) = 0;
48 class BNetworkSettingsItem
: public BNetworkConfigurationListener
,
49 BNetworkSettingsListener
{
51 BNetworkSettingsItem();
52 virtual ~BNetworkSettingsItem();
54 virtual BNetworkSettingsType
56 virtual BListItem
* ListItem() = 0;
57 virtual BView
* View() = 0;
59 virtual status_t
ProfileChanged(
60 const BNetworkProfile
* newProfile
);
61 const BNetworkProfile
*
64 virtual status_t
Revert() = 0;
65 virtual bool IsRevertable() = 0;
67 virtual void SettingsUpdated(uint32 type
);
68 virtual void ConfigurationUpdated(const BMessage
& message
);
70 virtual void NotifySettingsUpdated();
73 const BNetworkProfile
*
78 class BNetworkSettingsInterfaceItem
: public BNetworkSettingsItem
{
80 BNetworkSettingsInterfaceItem(
81 const char* interface
);
82 virtual ~BNetworkSettingsInterfaceItem();
84 virtual BNetworkSettingsType
86 const char* Interface() const;
89 const char* fInterface
;
93 class BNetworkInterfaceListItem
: public BListItem
,
94 public BNetworkConfigurationListener
{
96 BNetworkInterfaceListItem(int family
,
97 const char* interface
, const char* label
,
98 BNetworkSettings
& settings
);
99 ~BNetworkInterfaceListItem();
101 const char* Label() const;
103 virtual void DrawItem(BView
* owner
,
104 BRect bounds
, bool complete
);
105 virtual void Update(BView
* owner
, const BFont
* font
);
107 virtual void ConfigurationUpdated(const BMessage
& message
);
110 BFont
_AddressFont();
114 BNetworkSettings
& fSettings
;
116 const char* fInterface
;
125 class BNetworkSettingsAddOn
{
127 BNetworkSettingsAddOn(image_id image
,
128 BNetworkSettings
& settings
);
129 virtual ~BNetworkSettingsAddOn();
131 virtual BNetworkSettingsInterfaceItem
*
132 CreateNextInterfaceItem(uint32
& cookie
,
133 const char* interface
);
134 virtual BNetworkSettingsItem
*
135 CreateNextItem(uint32
& cookie
);
138 BResources
* Resources();
139 BNetworkSettings
& Settings();
143 BResources
* fResources
;
144 BNetworkSettings
& fSettings
;
148 // Your add-on needs to export this hook in order to be picked up
149 extern "C" BNetworkSettingsAddOn
* instantiate_network_settings_add_on(
150 image_id image
, BNetworkSettings
& settings
);
153 } // namespace BNetworkKit
156 #endif // _NETWORK_SETTINGS_ADD_ON_H