Small autosizing enhancement.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9318 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
e35b498755
commit
6e177b5562
@ -4,8 +4,8 @@
|
||||
|
||||
#include "NetworkSetupWindow.h"
|
||||
|
||||
#define SOFTWARE_EDITOR "obos"
|
||||
#define SOFTWARE_NAME "Network Setup"
|
||||
#define SOFTWARE_EDITOR "Haiku"
|
||||
#define SOFTWARE_NAME "Network Settings"
|
||||
#define SOFTWARE_VERSION_LABEL "0.1.0 alpha"
|
||||
|
||||
const char * APPLICATION_SIGNATURE = "application/x-vnd." SOFTWARE_EDITOR "-" SOFTWARE_NAME;
|
||||
|
@ -26,6 +26,7 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
|
||||
BCheckBox *check;
|
||||
BRect r;
|
||||
float x, w, h;
|
||||
float size, min_size = 360;
|
||||
|
||||
// TODO: cleanup this mess!
|
||||
|
||||
@ -59,6 +60,8 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
|
||||
menu_field->ResizeToPreferred();
|
||||
menu_field->GetPreferredSize(&w, &h);
|
||||
|
||||
size = w;
|
||||
|
||||
button = new BButton(r, "manage_profiles", MANAGE_PROFILES_LABEL,
|
||||
new BMessage(MANAGE_PROFILES_MSG),
|
||||
B_FOLLOW_TOP | B_FOLLOW_RIGHT);
|
||||
@ -67,6 +70,10 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
|
||||
button->MoveTo(r.right - w, r.top);
|
||||
top_box->AddChild(button);
|
||||
|
||||
size += SMALL_MARGIN + w;
|
||||
|
||||
min_size = max_c(min_size, (H_MARGIN + size + H_MARGIN));
|
||||
|
||||
r.top += h + V_MARGIN;
|
||||
|
||||
// ---- Separator line between Profiles section and Settings section
|
||||
@ -90,6 +97,9 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
|
||||
menu_field->ResizeToPreferred();
|
||||
menu_field->GetPreferredSize(&w, &h);
|
||||
r.top += h+1 + V_MARGIN;
|
||||
|
||||
min_size = max_c(min_size, (H_MARGIN + w + H_MARGIN));
|
||||
|
||||
|
||||
r = fMinAddonViewRect.OffsetByCopy(H_MARGIN, r.top);
|
||||
fPanel = new BBox(r, "showview_box", B_FOLLOW_NONE,
|
||||
@ -118,6 +128,8 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
|
||||
check->SetValue(B_CONTROL_ON);
|
||||
check->MoveTo(H_MARGIN, r.top);
|
||||
bottom_box->AddChild(check);
|
||||
|
||||
size = w;
|
||||
|
||||
button = new BButton(r, "apply_now", APPLY_NOW_LABEL,
|
||||
new BMessage(APPLY_NOW_MSG),
|
||||
@ -130,6 +142,8 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
|
||||
|
||||
fApplyNowButton = button;
|
||||
|
||||
size += SMALL_MARGIN + w;
|
||||
|
||||
button = new BButton(r, "revert", REVERT_LABEL,
|
||||
new BMessage(REVERT_MSG),
|
||||
B_FOLLOW_TOP | B_FOLLOW_RIGHT);
|
||||
@ -140,22 +154,29 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
|
||||
|
||||
fRevertButton = button;
|
||||
fRevertButton->SetEnabled(false);
|
||||
|
||||
size += SMALL_MARGIN + w;
|
||||
|
||||
min_size = max_c(min_size, (H_MARGIN + size + H_MARGIN));
|
||||
|
||||
r.bottom = r.top + h;
|
||||
r.InsetBy(-H_MARGIN, -V_MARGIN);
|
||||
bottom_box->ResizeTo(Bounds().Width(), r.Height());
|
||||
|
||||
// Set default/minimal window size
|
||||
bottom_box->ResizeTo(Bounds().Width(), r.Height());
|
||||
|
||||
// Resize window to enclose top and bottom boxes
|
||||
ResizeTo(Bounds().Width(), bottom_box->Frame().bottom);
|
||||
SetSizeLimits(Bounds().Width(), 20000, Bounds().Height(), 20000);
|
||||
|
||||
// Enable boxes resizing modes
|
||||
top_box->SetResizingMode(B_FOLLOW_ALL);
|
||||
fPanel->SetResizingMode(B_FOLLOW_ALL);
|
||||
bottom_box->SetResizingMode(B_FOLLOW_BOTTOM | B_FOLLOW_LEFT_RIGHT);
|
||||
|
||||
// Set default/minimal window size
|
||||
ResizeTo(min_size, Bounds().Height());
|
||||
SetSizeLimits(min_size, 20000, Bounds().Height(), 20000);
|
||||
|
||||
fAddonView = NULL;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -359,7 +380,8 @@ void NetworkSetupWindow::BuildShowMenu
|
||||
path.Append(search_path + 3);
|
||||
} else {
|
||||
path.SetTo(search_path);
|
||||
path.Append("boneyard");
|
||||
path.Append("network_setup");
|
||||
// path.Append("boneyard");
|
||||
};
|
||||
|
||||
search_path = strtok_r(NULL, ":", &next_path_token);
|
||||
|
Loading…
Reference in New Issue
Block a user