display cleanup to NetworkSetupWindow; revamped NetworkInterface addon to use GroupLayoutBuilder to properly render listview; remove lots of single character vars

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40368 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexander von Gluck IV
2011-02-07 06:48:37 +00:00
parent 52cca4eef5
commit 7d4120244e
2 changed files with 31 additions and 33 deletions
@@ -10,6 +10,7 @@
* Fredrik Modéen
* Hugo Santos
* Philippe Saint-Pierre
* Alexander von Gluck, [email protected]
*/
@@ -19,8 +20,10 @@
#include <stdio.h>
#include <ScrollView.h>
#include <Alert.h>
#include <GroupLayout.h>
#include <GroupLayoutBuilder.h>
#include <ScrollView.h>
NetworkSetupAddOn*
@@ -58,46 +61,40 @@ InterfacesAddOn::Name()
BView*
InterfacesAddOn::CreateView(BRect *bounds)
{
float w, h;
BRect r = *bounds;
BRect intViewRect = *bounds;
#define H_MARGIN 10
#define V_MARGIN 10
#define SMALL_MARGIN 3
if (r.Width() < 100 || r.Height() < 100)
r.Set(0, 0, 100, 100);
ResizeTo(r.Width(), r.Height());
BRect rlv = r;
rlv.bottom -= 72;
rlv.InsetBy(2, 2);
rlv.right -= B_V_SCROLL_BAR_WIDTH;
fListview = new InterfacesListView(rlv, "interfaces", B_FOLLOW_ALL_SIDES);
// Construct the ListView
fListview = new InterfacesListView(intViewRect,
"interfaces", B_FOLLOW_ALL_SIDES);
fListview->SetSelectionMessage(new BMessage(INTERFACE_SELECTED_MSG));
fListview->SetInvocationMessage(new BMessage(CONFIGURE_INTERFACE_MSG));
AddChild(new BScrollView(NULL, fListview, B_FOLLOW_ALL_SIDES, B_WILL_DRAW
| B_FRAME_EVENTS, false, true));
r.top = r.bottom - 60;
fConfigure = new BButton(r, "configure", "Configure" B_UTF8_ELLIPSIS,
new BMessage(CONFIGURE_INTERFACE_MSG), B_FOLLOW_BOTTOM | B_FOLLOW_LEFT);
BScrollView* scrollView = new BScrollView(NULL, fListview,
B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS, false, true);
// Construct the BButtons
fConfigure = new BButton(intViewRect, "configure",
"Configure" B_UTF8_ELLIPSIS, new BMessage(CONFIGURE_INTERFACE_MSG));
fConfigure->GetPreferredSize(&w, &h);
fConfigure->ResizeToPreferred();
fConfigure->SetEnabled(false);
AddChild(fConfigure);
r.left += w + SMALL_MARGIN;
fOnOff = new BButton(intViewRect, "onoff", "Disable",
new BMessage(ONOFF_INTERFACE_MSG));
fOnOff = new BButton(r, "onoff", "Disable",
new BMessage(ONOFF_INTERFACE_MSG),
B_FOLLOW_BOTTOM | B_FOLLOW_LEFT);
fOnOff->GetPreferredSize(&w, &h);
fOnOff->ResizeToPreferred();
fOnOff->Hide();
AddChild(fOnOff);
// Build the layout
SetLayout(new BGroupLayout(B_VERTICAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
.Add(scrollView)
.AddGroup(B_HORIZONTAL, 5)
.Add(fConfigure)
.Add(fOnOff)
.AddGlue()
.End()
.SetInsets(10, 10, 10, 10)
);
*bounds = Bounds();
return this;
@@ -71,6 +71,7 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
.Add(fPanel)
.Add(bottomDivider)
.AddGroup(B_HORIZONTAL, 5)
.AddGlue()
.Add(fRevertButton)
.Add(fApplyButton)
.End()
@@ -221,7 +222,7 @@ NetworkSetupWindow::_BuildShowTabView(int32 msg_what)
if (!search_paths)
return;
fMinAddonViewRect.Set(0, 0, 350, 200); // Minimum size
fMinAddonViewRect.Set(0, 0, 375, 225); // Minimum size
search_paths = strdup(search_paths);
char* next_path_token;