added BTextControls for IP address and Netmask configuration
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40500 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -21,18 +21,33 @@ InterfaceAddressView::InterfaceAddressView(BRect frame, const char* name,
|
|||||||
fSettings(settings),
|
fSettings(settings),
|
||||||
fFamily(family)
|
fFamily(family)
|
||||||
{
|
{
|
||||||
|
float textControlW;
|
||||||
|
float textControlH;
|
||||||
|
|
||||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||||
|
|
||||||
// TODO : Draw address fields in a generic way
|
// Create our controls
|
||||||
BStringView* address = new BStringView(Bounds(), "address",
|
fAddressField = new BTextControl(frame, "address", "IP Address:",
|
||||||
fSettings->IP(family));
|
NULL, NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
|
||||||
|
fNetmaskField = new BTextControl(frame, "netmask", "Netmask:",
|
||||||
|
NULL, NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
|
||||||
|
|
||||||
|
fAddressField->GetPreferredSize(&textControlW, &textControlH);
|
||||||
|
float labelSize = ( textControlW + 50 )
|
||||||
|
- fAddressField->StringWidth("XXX.XXX.XXX.XXX");
|
||||||
|
|
||||||
|
_RevertFields();
|
||||||
|
// Do the initial field population
|
||||||
|
|
||||||
|
fAddressField->SetDivider(labelSize);
|
||||||
|
fNetmaskField->SetDivider(labelSize);
|
||||||
|
|
||||||
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
|
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
|
||||||
.Add(address)
|
.Add(fAddressField)
|
||||||
|
.Add(fNetmaskField)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
.SetInsets(10, 10, 10, 10)
|
.SetInsets(10, 10, 10, 10)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -42,3 +57,12 @@ InterfaceAddressView::~InterfaceAddressView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
InterfaceAddressView::_RevertFields()
|
||||||
|
{
|
||||||
|
// Populate address fields with current settings
|
||||||
|
fAddressField->SetText(fSettings->IP(fFamily));
|
||||||
|
fNetmaskField->SetText(fSettings->Netmask(fFamily));
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
#include <TextControl.h>
|
||||||
|
|
||||||
|
|
||||||
class InterfaceAddressView : public BView {
|
class InterfaceAddressView : public BView {
|
||||||
@@ -23,8 +24,13 @@ public:
|
|||||||
virtual ~InterfaceAddressView();
|
virtual ~InterfaceAddressView();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
status_t _RevertFields();
|
||||||
NetworkSettings* fSettings;
|
NetworkSettings* fSettings;
|
||||||
int fFamily;
|
int fFamily;
|
||||||
|
|
||||||
|
BTextControl* fAddressField;
|
||||||
|
BTextControl* fNetmaskField;
|
||||||
|
BTextControl* fGatewayField;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
|
|
||||||
InterfaceWindow::InterfaceWindow(NetworkSettings* settings)
|
InterfaceWindow::InterfaceWindow(NetworkSettings* settings)
|
||||||
: BWindow(BRect(50, 50, 400, 302), "Interface Settings",
|
: BWindow(BRect(50, 50, 370, 350), "Interface Settings",
|
||||||
B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
|
B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
|
||||||
B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE,
|
B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE,
|
||||||
B_CURRENT_WORKSPACE)
|
B_CURRENT_WORKSPACE)
|
||||||
|
|||||||
Reference in New Issue
Block a user