Improve layouting of Expander
Especially actually hide the content's scroll view, which otherwise would peak out if the B_USE_WINDOW_SPACING would ever be increased.
This commit is contained in:
parent
744a39273b
commit
c8325bb7d7
@ -21,6 +21,7 @@
|
||||
#include <Path.h>
|
||||
#include <RadioButton.h>
|
||||
#include <Screen.h>
|
||||
#include <SeparatorView.h>
|
||||
#include <StringView.h>
|
||||
#include <TextControl.h>
|
||||
|
||||
@ -51,13 +52,6 @@ ExpanderPreferences::ExpanderPreferences(BMessage* settings)
|
||||
{
|
||||
const float kSpacing = be_control_look->DefaultItemSpacing();
|
||||
|
||||
BBox* settingsBox = new BBox(B_PLAIN_BORDER, NULL);
|
||||
BGroupLayout* settingsLayout = new BGroupLayout(B_VERTICAL, kSpacing / 2);
|
||||
settingsBox->SetLayout(settingsLayout);
|
||||
BBox* buttonBox = new BBox(B_PLAIN_BORDER, NULL);
|
||||
BGroupLayout* buttonLayout = new BGroupLayout(B_HORIZONTAL, kSpacing / 2);
|
||||
buttonBox->SetLayout(buttonLayout);
|
||||
|
||||
BStringView* expansionLabel = new BStringView("stringViewExpansion",
|
||||
B_TRANSLATE("Expansion"));
|
||||
expansionLabel->SetFont(be_bold_font);
|
||||
@ -103,54 +97,50 @@ ExpanderPreferences::ExpanderPreferences(BMessage* settings)
|
||||
|
||||
// Build the layout
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||
.AddGroup(settingsLayout)
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.Add(expansionLabel)
|
||||
.AddGlue()
|
||||
.End()
|
||||
.AddGroup(B_VERTICAL, 0)
|
||||
.SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING,
|
||||
B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING)
|
||||
.Add(expansionLabel)
|
||||
.AddGroup(B_VERTICAL, 0)
|
||||
.Add(fAutoExpand)
|
||||
.Add(fCloseWindow)
|
||||
.SetInsets(kSpacing, 0, 0, 0)
|
||||
.End()
|
||||
.AddGroup(B_HORIZONTAL, 0)
|
||||
.Add(destinationLabel)
|
||||
.AddGlue()
|
||||
.SetInsets(0, kSpacing, 0, 0)
|
||||
.End()
|
||||
.SetInsets(B_USE_SMALL_SPACING, B_USE_SMALL_SPACING, 0,
|
||||
B_USE_ITEM_SPACING)
|
||||
.End()
|
||||
.Add(destinationLabel)
|
||||
.AddGroup(B_VERTICAL, 0)
|
||||
.Add(fLeaveDest)
|
||||
.Add(fSameDest)
|
||||
.Add(fDestUse)
|
||||
.AddGroup(B_HORIZONTAL, 0)
|
||||
.Add(fDestText, 0.8)
|
||||
.AddStrut(be_control_look->DefaultLabelSpacing())
|
||||
.AddStrut(B_USE_ITEM_SPACING)
|
||||
.Add(fSelect, 0.2)
|
||||
.SetInsets(kSpacing * 2, 0, kSpacing / 2, 0)
|
||||
.End()
|
||||
.SetInsets(kSpacing, 0, 0, 0)
|
||||
.End()
|
||||
.AddGroup(B_HORIZONTAL, 0)
|
||||
.Add(otherLabel)
|
||||
.SetInsets(kSpacing * 2, 0, 0, 0)
|
||||
.End()
|
||||
.AddGlue()
|
||||
.SetInsets(0, kSpacing / 2, 0, 0)
|
||||
.End()
|
||||
.SetInsets(B_USE_SMALL_SPACING, B_USE_SMALL_SPACING, 0,
|
||||
B_USE_ITEM_SPACING)
|
||||
.End()
|
||||
.Add(otherLabel)
|
||||
.AddGroup(B_VERTICAL, 0)
|
||||
.Add(fOpenDest)
|
||||
.Add(fAutoShow)
|
||||
.SetInsets(kSpacing, 0, 0, 0)
|
||||
.End()
|
||||
.SetInsets(kSpacing, kSpacing, kSpacing, kSpacing)
|
||||
.End()
|
||||
.AddGroup(buttonLayout)
|
||||
.AddGroup(B_HORIZONTAL, kSpacing)
|
||||
.AddGlue()
|
||||
.Add(cancel)
|
||||
.Add(okbutton)
|
||||
.SetInsets(B_USE_SMALL_SPACING, B_USE_SMALL_SPACING, 0, 0)
|
||||
.End()
|
||||
.End()
|
||||
.SetInsets(kSpacing, kSpacing, kSpacing, kSpacing)
|
||||
.Add(new BSeparatorView(B_HORIZONTAL))
|
||||
.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
|
||||
.SetInsets(0, B_USE_DEFAULT_SPACING,
|
||||
B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING)
|
||||
.AddGlue()
|
||||
.Add(cancel)
|
||||
.Add(okbutton)
|
||||
.End();
|
||||
|
||||
|
||||
fDestText->SetExplicitAlignment(
|
||||
BAlignment(B_ALIGN_HORIZONTAL_UNSET, B_ALIGN_VERTICAL_CENTER));
|
||||
|
||||
|
@ -102,35 +102,33 @@ ExpanderWindow::ExpanderWindow(BRect frame, const entry_ref* ref,
|
||||
|
||||
const float spacing = be_control_look->DefaultItemSpacing();
|
||||
BGroupLayout* pathLayout;
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 0.0)
|
||||
.SetInsets(0.0)
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||
.Add(fBar)
|
||||
.AddGroup(B_VERTICAL, spacing)
|
||||
.AddGroup(B_HORIZONTAL, spacing)
|
||||
.AddGroup(B_VERTICAL, 5.0)
|
||||
.Add(fSourceButton)
|
||||
.Add(fDestButton)
|
||||
.Add(fExpandButton)
|
||||
.AddGroup(B_VERTICAL, B_USE_ITEM_SPACING)
|
||||
.AddGroup(B_HORIZONTAL, B_USE_ITEM_SPACING)
|
||||
.Add(fSourceButton)
|
||||
.Add(fSourceText = new BTextControl(NULL, NULL,
|
||||
new BMessage(MSG_SOURCETEXT)))
|
||||
.End()
|
||||
.AddGroup(B_VERTICAL, spacing)
|
||||
.Add(fSourceText = new BTextControl(NULL, NULL,
|
||||
new BMessage(MSG_SOURCETEXT)))
|
||||
.Add(fDestText = new BTextControl(NULL, NULL,
|
||||
new BMessage(MSG_DESTTEXT)))
|
||||
.AddGroup(B_HORIZONTAL, spacing)
|
||||
.GetLayout(&pathLayout)
|
||||
.Add(fShowContents = new BCheckBox(
|
||||
B_TRANSLATE("Show contents"),
|
||||
new BMessage(MSG_SHOWCONTENTS)))
|
||||
.Add(fStatusView = new BStringView(NULL,
|
||||
statusPlaceholderString))
|
||||
.AddGroup(B_HORIZONTAL, B_USE_ITEM_SPACING)
|
||||
.Add(fDestButton)
|
||||
.Add(fDestText = new BTextControl(NULL, NULL,
|
||||
new BMessage(MSG_DESTTEXT)))
|
||||
.End()
|
||||
.AddGroup(B_HORIZONTAL, B_USE_ITEM_SPACING)
|
||||
.Add(fExpandButton)
|
||||
.AddGroup(B_HORIZONTAL, B_USE_ITEM_SPACING)
|
||||
.GetLayout(&pathLayout)
|
||||
.Add(fShowContents = new BCheckBox(
|
||||
B_TRANSLATE("Show contents"),
|
||||
new BMessage(MSG_SHOWCONTENTS)))
|
||||
.Add(fStatusView = new BStringView(NULL,
|
||||
statusPlaceholderString))
|
||||
.End()
|
||||
.End()
|
||||
.End()
|
||||
.Add(fScrollView)
|
||||
.SetInsets(spacing, spacing, spacing, spacing)
|
||||
.End()
|
||||
.End();
|
||||
.SetInsets(B_USE_WINDOW_SPACING)
|
||||
.End();
|
||||
|
||||
pathLayout->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
|
||||
size = GetLayout()->View()->PreferredSize();
|
||||
@ -141,6 +139,8 @@ ExpanderWindow::ExpanderWindow(BRect frame, const entry_ref* ref,
|
||||
SetZoomLimits(Bounds().Width(), fSizeLimit);
|
||||
fPreviousHeight = -1;
|
||||
|
||||
fScrollView->Hide();
|
||||
|
||||
Show();
|
||||
}
|
||||
|
||||
@ -309,9 +309,12 @@ ExpanderWindow::MessageReceived(BMessage* message)
|
||||
if (fListingStarted)
|
||||
StopListing();
|
||||
|
||||
fScrollView->Hide();
|
||||
_UpdateWindowSize(false);
|
||||
} else
|
||||
} else {
|
||||
fScrollView->Show();
|
||||
StartListing();
|
||||
}
|
||||
break;
|
||||
|
||||
case MSG_SOURCETEXT:
|
||||
|
Loading…
Reference in New Issue
Block a user