DriveSetup: convert main view to use layouts
Change-Id: I92f3c7e3b4fb6babfa0688524d549e254f1ecebc Reviewed-on: https://review.haiku-os.org/c/haiku/+/9703 Tested-by: Commit checker robot <[email protected]> Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
@@ -456,11 +456,10 @@ public:
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
DiskView::DiskView(const BRect& frame, uint32 resizeMode,
|
||||
SpaceIDMap& spaceIDMap)
|
||||
DiskView::DiskView(SpaceIDMap& spaceIDMap)
|
||||
:
|
||||
Inherited(frame, "diskview", resizeMode,
|
||||
B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
|
||||
Inherited("diskview",
|
||||
B_SUPPORTS_LAYOUT | B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
|
||||
fDiskCount(0),
|
||||
fDisk(NULL),
|
||||
fSpaceIDMap(spaceIDMap),
|
||||
@@ -469,6 +468,8 @@ DiskView::DiskView(const BRect& frame, uint32 resizeMode,
|
||||
BGroupLayout* layout = new BGroupLayout(B_HORIZONTAL, kLayoutInset);
|
||||
SetLayout(layout);
|
||||
|
||||
SetExplicitMinSize(BSize(be_plain_font->Size() * 50 + 20, 140));
|
||||
SetExplicitMaxSize(BSize(B_SIZE_UNSET, 140));
|
||||
SetViewColor(B_TRANSPARENT_COLOR);
|
||||
SetHighUIColor(B_PANEL_BACKGROUND_COLOR, B_DARKEN_2_TINT);
|
||||
SetLowUIColor(B_PANEL_BACKGROUND_COLOR, 1.221f);
|
||||
|
||||
@@ -15,13 +15,11 @@
|
||||
class DiskView : public BView {
|
||||
typedef BView Inherited;
|
||||
public:
|
||||
DiskView(const BRect& frame,
|
||||
uint32 resizeMode,
|
||||
SpaceIDMap& spaceIDMap);
|
||||
DiskView(SpaceIDMap& spaceIDMap);
|
||||
virtual ~DiskView();
|
||||
|
||||
// BView interface
|
||||
virtual void Draw(BRect updateRect);
|
||||
virtual void Draw(BRect updateRect);
|
||||
|
||||
void SetDiskCount(int32 count);
|
||||
void SetDisk(BDiskDevice* disk,
|
||||
|
||||
@@ -206,12 +206,12 @@ private:
|
||||
MainWindow::MainWindow()
|
||||
:
|
||||
BWindow(BRect(50, 50, 600, 500), B_TRANSLATE_SYSTEM_NAME("DriveSetup"),
|
||||
B_DOCUMENT_WINDOW, B_ASYNCHRONOUS_CONTROLS),
|
||||
B_DOCUMENT_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS),
|
||||
fCurrentDisk(NULL),
|
||||
fCurrentPartitionID(-1),
|
||||
fSpaceIDMap()
|
||||
{
|
||||
fMenuBar = new BMenuBar(Bounds(), "root menu");
|
||||
fMenuBar = new BMenuBar("root menu");
|
||||
|
||||
// create all the menu items
|
||||
fWipeMenuItem = new BMenuItem(B_TRANSLATE("Wipe (not implemented)"),
|
||||
@@ -281,6 +281,9 @@ MainWindow::MainWindow()
|
||||
fPartitionMenu->AddItem(fOpenDiskProbeMenuItem);
|
||||
fMenuBar->AddItem(fPartitionMenu);
|
||||
|
||||
BGroupLayout* layout = new BGroupLayout(B_VERTICAL, 0);
|
||||
layout->SetInsets(-1, 0, -1, -1);
|
||||
SetLayout(layout);
|
||||
AddChild(fMenuBar);
|
||||
|
||||
// Partition / Drives context menu
|
||||
@@ -312,18 +315,11 @@ MainWindow::MainWindow()
|
||||
fContextMenu->SetTargetForItems(this);
|
||||
|
||||
// add DiskView
|
||||
BRect r(Bounds());
|
||||
r.top = fMenuBar->Frame().bottom + 1;
|
||||
r.bottom = floorf(r.top + r.Height() * 0.33);
|
||||
fDiskView = new DiskView(r, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
|
||||
fSpaceIDMap);
|
||||
fDiskView = new DiskView(fSpaceIDMap);
|
||||
AddChild(fDiskView);
|
||||
|
||||
// add PartitionListView
|
||||
r.top = r.bottom + 2;
|
||||
r.bottom = Bounds().bottom;
|
||||
r.InsetBy(-1, -1);
|
||||
fListView = new PartitionListView(r, B_FOLLOW_ALL);
|
||||
fListView = new PartitionListView();
|
||||
AddChild(fListView);
|
||||
|
||||
// configure PartitionListView
|
||||
|
||||
@@ -412,8 +412,8 @@ PartitionListRow::DevicePath()
|
||||
// #pragma mark - PartitionListView
|
||||
|
||||
|
||||
PartitionListView::PartitionListView(const BRect& frame, uint32 resizeMode)
|
||||
: Inherited(frame, "partitionlist", resizeMode, 0, B_NO_BORDER, true)
|
||||
PartitionListView::PartitionListView()
|
||||
: Inherited("partitionlist", B_SUPPORTS_LAYOUT, B_NO_BORDER, true)
|
||||
{
|
||||
AddColumn(new PartitionColumn(B_TRANSLATE("Device"), 150, 50, 500,
|
||||
B_TRUNCATE_MIDDLE), kDeviceColumn);
|
||||
|
||||
@@ -91,8 +91,7 @@ private:
|
||||
class PartitionListView : public BColumnListView {
|
||||
typedef BColumnListView Inherited;
|
||||
public:
|
||||
PartitionListView(const BRect& frame,
|
||||
uint32 resizeMode);
|
||||
PartitionListView();
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user