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 -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
DiskView::DiskView(const BRect& frame, uint32 resizeMode,
|
DiskView::DiskView(SpaceIDMap& spaceIDMap)
|
||||||
SpaceIDMap& spaceIDMap)
|
|
||||||
:
|
:
|
||||||
Inherited(frame, "diskview", resizeMode,
|
Inherited("diskview",
|
||||||
B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
|
B_SUPPORTS_LAYOUT | B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
|
||||||
fDiskCount(0),
|
fDiskCount(0),
|
||||||
fDisk(NULL),
|
fDisk(NULL),
|
||||||
fSpaceIDMap(spaceIDMap),
|
fSpaceIDMap(spaceIDMap),
|
||||||
@@ -469,6 +468,8 @@ DiskView::DiskView(const BRect& frame, uint32 resizeMode,
|
|||||||
BGroupLayout* layout = new BGroupLayout(B_HORIZONTAL, kLayoutInset);
|
BGroupLayout* layout = new BGroupLayout(B_HORIZONTAL, kLayoutInset);
|
||||||
SetLayout(layout);
|
SetLayout(layout);
|
||||||
|
|
||||||
|
SetExplicitMinSize(BSize(be_plain_font->Size() * 50 + 20, 140));
|
||||||
|
SetExplicitMaxSize(BSize(B_SIZE_UNSET, 140));
|
||||||
SetViewColor(B_TRANSPARENT_COLOR);
|
SetViewColor(B_TRANSPARENT_COLOR);
|
||||||
SetHighUIColor(B_PANEL_BACKGROUND_COLOR, B_DARKEN_2_TINT);
|
SetHighUIColor(B_PANEL_BACKGROUND_COLOR, B_DARKEN_2_TINT);
|
||||||
SetLowUIColor(B_PANEL_BACKGROUND_COLOR, 1.221f);
|
SetLowUIColor(B_PANEL_BACKGROUND_COLOR, 1.221f);
|
||||||
|
|||||||
@@ -15,13 +15,11 @@
|
|||||||
class DiskView : public BView {
|
class DiskView : public BView {
|
||||||
typedef BView Inherited;
|
typedef BView Inherited;
|
||||||
public:
|
public:
|
||||||
DiskView(const BRect& frame,
|
DiskView(SpaceIDMap& spaceIDMap);
|
||||||
uint32 resizeMode,
|
|
||||||
SpaceIDMap& spaceIDMap);
|
|
||||||
virtual ~DiskView();
|
virtual ~DiskView();
|
||||||
|
|
||||||
// BView interface
|
// BView interface
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
|
|
||||||
void SetDiskCount(int32 count);
|
void SetDiskCount(int32 count);
|
||||||
void SetDisk(BDiskDevice* disk,
|
void SetDisk(BDiskDevice* disk,
|
||||||
|
|||||||
@@ -206,12 +206,12 @@ private:
|
|||||||
MainWindow::MainWindow()
|
MainWindow::MainWindow()
|
||||||
:
|
:
|
||||||
BWindow(BRect(50, 50, 600, 500), B_TRANSLATE_SYSTEM_NAME("DriveSetup"),
|
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),
|
fCurrentDisk(NULL),
|
||||||
fCurrentPartitionID(-1),
|
fCurrentPartitionID(-1),
|
||||||
fSpaceIDMap()
|
fSpaceIDMap()
|
||||||
{
|
{
|
||||||
fMenuBar = new BMenuBar(Bounds(), "root menu");
|
fMenuBar = new BMenuBar("root menu");
|
||||||
|
|
||||||
// create all the menu items
|
// create all the menu items
|
||||||
fWipeMenuItem = new BMenuItem(B_TRANSLATE("Wipe (not implemented)"),
|
fWipeMenuItem = new BMenuItem(B_TRANSLATE("Wipe (not implemented)"),
|
||||||
@@ -281,6 +281,9 @@ MainWindow::MainWindow()
|
|||||||
fPartitionMenu->AddItem(fOpenDiskProbeMenuItem);
|
fPartitionMenu->AddItem(fOpenDiskProbeMenuItem);
|
||||||
fMenuBar->AddItem(fPartitionMenu);
|
fMenuBar->AddItem(fPartitionMenu);
|
||||||
|
|
||||||
|
BGroupLayout* layout = new BGroupLayout(B_VERTICAL, 0);
|
||||||
|
layout->SetInsets(-1, 0, -1, -1);
|
||||||
|
SetLayout(layout);
|
||||||
AddChild(fMenuBar);
|
AddChild(fMenuBar);
|
||||||
|
|
||||||
// Partition / Drives context menu
|
// Partition / Drives context menu
|
||||||
@@ -312,18 +315,11 @@ MainWindow::MainWindow()
|
|||||||
fContextMenu->SetTargetForItems(this);
|
fContextMenu->SetTargetForItems(this);
|
||||||
|
|
||||||
// add DiskView
|
// add DiskView
|
||||||
BRect r(Bounds());
|
fDiskView = new DiskView(fSpaceIDMap);
|
||||||
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);
|
|
||||||
AddChild(fDiskView);
|
AddChild(fDiskView);
|
||||||
|
|
||||||
// add PartitionListView
|
// add PartitionListView
|
||||||
r.top = r.bottom + 2;
|
fListView = new PartitionListView();
|
||||||
r.bottom = Bounds().bottom;
|
|
||||||
r.InsetBy(-1, -1);
|
|
||||||
fListView = new PartitionListView(r, B_FOLLOW_ALL);
|
|
||||||
AddChild(fListView);
|
AddChild(fListView);
|
||||||
|
|
||||||
// configure PartitionListView
|
// configure PartitionListView
|
||||||
|
|||||||
@@ -412,8 +412,8 @@ PartitionListRow::DevicePath()
|
|||||||
// #pragma mark - PartitionListView
|
// #pragma mark - PartitionListView
|
||||||
|
|
||||||
|
|
||||||
PartitionListView::PartitionListView(const BRect& frame, uint32 resizeMode)
|
PartitionListView::PartitionListView()
|
||||||
: Inherited(frame, "partitionlist", resizeMode, 0, B_NO_BORDER, true)
|
: Inherited("partitionlist", B_SUPPORTS_LAYOUT, B_NO_BORDER, true)
|
||||||
{
|
{
|
||||||
AddColumn(new PartitionColumn(B_TRANSLATE("Device"), 150, 50, 500,
|
AddColumn(new PartitionColumn(B_TRANSLATE("Device"), 150, 50, 500,
|
||||||
B_TRUNCATE_MIDDLE), kDeviceColumn);
|
B_TRUNCATE_MIDDLE), kDeviceColumn);
|
||||||
|
|||||||
@@ -91,8 +91,7 @@ private:
|
|||||||
class PartitionListView : public BColumnListView {
|
class PartitionListView : public BColumnListView {
|
||||||
typedef BColumnListView Inherited;
|
typedef BColumnListView Inherited;
|
||||||
public:
|
public:
|
||||||
PartitionListView(const BRect& frame,
|
PartitionListView();
|
||||||
uint32 resizeMode);
|
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user