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