added BView class to handle drawing IPv4/IPv6 interface configuration options

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40457 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexander von Gluck IV
2011-02-12 00:18:44 +00:00
parent c335592329
commit 946b7d4387
4 changed files with 83 additions and 7 deletions
@@ -18,6 +18,7 @@ Addon Interfaces :
InterfacesListView.cpp
NetworkSettings.cpp
SettingsWindow.cpp
SettingsIfView.cpp
# from src/apps/networkstatus
RadioView.cpp
@@ -0,0 +1,44 @@
/*
* Copyright 2004-2011 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Alexander von Gluck, [email protected]
*/
#include "SettingsIfView.h"
#include "NetworkSettings.h"
#include <GroupLayout.h>
#include <GroupLayoutBuilder.h>
#include <StringView.h>
SettingsIfView::SettingsIfView(BRect frame, const char* name, int family,
NetworkSettings* settings)
:
BView(frame, name, B_FOLLOW_ALL_SIDES, 0),
fSettings(settings),
fFamily(family)
{
SetLayout(new BGroupLayout(B_VERTICAL));
// TODO : Draw address fields in a generic way
BStringView* address = new BStringView(Bounds(), "address",
fSettings->IP(family));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
.Add(address)
.AddGlue()
.SetInsets(10, 10, 10, 10)
);
}
SettingsIfView::~SettingsIfView()
{
}
@@ -0,0 +1,31 @@
/*
* Copyright 2004-2011 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Alexander von Gluck, [email protected]
*/
#ifndef SETTINGS_IFVIEW_H
#define SETTINGS_IFVIEW_H
#include "NetworkSettings.h"
#include <Screen.h>
#include <View.h>
class SettingsIfView : public BView {
public:
SettingsIfView(BRect frame, const char* name,
int family, NetworkSettings* settings);
virtual ~SettingsIfView();
private:
NetworkSettings* fSettings;
int fFamily;
};
#endif /* SETTINGS_IFVIEW_H */
@@ -8,6 +8,7 @@
#include "SettingsWindow.h"
#include "SettingsIfView.h"
#include <Application.h>
@@ -18,8 +19,8 @@
SettingsWindow::SettingsWindow(NetworkSettings* settings)
: BWindow(BRect(50, 50, 400, 302), "Interface Settings",
B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
| B_AUTO_UPDATE_SIZE_LIMITS, B_CURRENT_WORKSPACE)
B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE,
B_CURRENT_WORKSPACE)
{
fNetworkSettings = settings;
@@ -69,12 +70,11 @@ SettingsWindow::MessageReceived(BMessage* message)
status_t
SettingsWindow::_PopulateTabs()
{
// TODO : Temporary, just to get example data
BRect frame = fTabView->Bounds();
BView* view4 = new BView(frame, "net_settings_ipv4",
B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
BView* view6 = new BView(frame, "net_settings_ipv6",
B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
BView* view4 = new SettingsIfView(frame, "net_settings_ipv4",
AF_INET, fNetworkSettings);
BView* view6 = new SettingsIfView(frame, "net_settings_ipv6",
AF_INET6, fNetworkSettings);
BTab* tab4 = new BTab;
BTab* tab6 = new BTab;