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),
|
||||
fFamily(family)
|
||||
{
|
||||
float textControlW;
|
||||
float textControlH;
|
||||
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
|
||||
// TODO : Draw address fields in a generic way
|
||||
BStringView* address = new BStringView(Bounds(), "address",
|
||||
fSettings->IP(family));
|
||||
// Create our controls
|
||||
fAddressField = new BTextControl(frame, "address", "IP Address:",
|
||||
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)
|
||||
.Add(address)
|
||||
.Add(fAddressField)
|
||||
.Add(fNetmaskField)
|
||||
.AddGlue()
|
||||
.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 <View.h>
|
||||
#include <TextControl.h>
|
||||
|
||||
|
||||
class InterfaceAddressView : public BView {
|
||||
@@ -23,8 +24,13 @@ public:
|
||||
virtual ~InterfaceAddressView();
|
||||
|
||||
private:
|
||||
status_t _RevertFields();
|
||||
NetworkSettings* fSettings;
|
||||
int fFamily;
|
||||
|
||||
BTextControl* fAddressField;
|
||||
BTextControl* fNetmaskField;
|
||||
BTextControl* fGatewayField;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
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_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE,
|
||||
B_CURRENT_WORKSPACE)
|
||||
|
||||
Reference in New Issue
Block a user