package daemon: ProblemWindow: Use a scroll view

This commit is contained in:
Ingo Weinhold 2013-09-11 04:53:06 +02:00
parent 88f12ad84f
commit b53a2e6af5
2 changed files with 20 additions and 4 deletions

View File

@ -1,7 +1,7 @@
SubDir HAIKU_TOP src servers package ;
UsePrivateSystemHeaders ;
UsePrivateHeaders app kernel shared ;
UsePrivateHeaders app interface kernel shared ;
Server package_daemon
:

View File

@ -10,6 +10,7 @@
#include <GroupView.h>
#include <LayoutBuilder.h>
#include <RadioButton.h>
#include <ScrollView.h>
#include <StringView.h>
#include <package/solver/Solver.h>
#include <package/solver/SolverPackage.h>
@ -18,6 +19,7 @@
#include <AutoLocker.h>
#include <package/manager/Exceptions.h>
#include <ViewPort.h>
using namespace BPackageKit;
@ -70,19 +72,33 @@ ProblemWindow::ProblemWindow()
if (fDoneSemaphore < 0)
throw std::bad_alloc();
BStringView* topTextView = NULL;
BViewPort* viewPort = NULL;
BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING)
.SetInsets(B_USE_SMALL_INSETS)
.Add(new BStringView(NULL,
.Add(topTextView = new BStringView(NULL,
"The following problems have been encountered. Please select a "
"solution for each:"))
// TODO: Use a scroll view!
.Add(fContainerView = new BGroupView(B_VERTICAL, 0))
.Add(new BScrollView(NULL, viewPort = new BViewPort(), 0, false, true))
.AddGroup(B_HORIZONTAL)
.Add(fCancelButton = new BButton("Cancel", new BMessage(B_CANCEL)))
.AddGlue()
.Add(fRetryButton = new BButton("Retry",
new BMessage(kRetryMessage)))
.End();
topTextView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
viewPort->SetChildView(fContainerView = new BGroupView(B_VERTICAL, 0));
// set small scroll step (large step will be set by the view port)
BFont font;
topTextView->GetFont(&font);
font_height fontHeight;
font.GetHeight(&fontHeight);
float smallStep = ceilf(fontHeight.ascent + fontHeight.descent);
viewPort->ScrollBar(B_VERTICAL)->SetSteps(smallStep, smallStep);
}