From 0f4e8dfec64b333093f876f7005d514230b8014b Mon Sep 17 00:00:00 2001 From: Alex Wilson Date: Fri, 24 Jun 2011 18:14:38 +0000 Subject: [PATCH] Replace use of old layout-builder classes with new ones in devices app. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42303 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/devices/DevicesApplication.cpp | 20 ++++++---------- src/apps/devices/DevicesView.cpp | 31 ++++++++++++------------- src/apps/devices/DevicesView.h | 8 +------ 3 files changed, 23 insertions(+), 36 deletions(-) diff --git a/src/apps/devices/DevicesApplication.cpp b/src/apps/devices/DevicesApplication.cpp index 1cecd334d6..3849026422 100644 --- a/src/apps/devices/DevicesApplication.cpp +++ b/src/apps/devices/DevicesApplication.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "DevicesView.h" @@ -44,20 +45,13 @@ DevicesApplication::DevicesApplication() DevicesWindow::DevicesWindow() : BWindow(BRect(50, 50, 750, 550), B_TRANSLATE_SYSTEM_NAME("Devices"), - B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS - | B_AUTO_UPDATE_SIZE_LIMITS - | B_QUIT_ON_WINDOW_CLOSE) + B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS + | B_QUIT_ON_WINDOW_CLOSE) { - float minWidth; - float maxWidth; - float minHeight; - float maxHeight; - GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight); - minWidth = 600; - minHeight = 300; - SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight); - fDevicesView = new DevicesView(Bounds()); - AddChild(fDevicesView); + BLayoutBuilder::Group<>(this, B_VERTICAL) + .SetInsets(0) + .Add(fDevicesView = new DevicesView()); + GetLayout()->SetExplicitMinSize(BSize(600, 300)); } diff --git a/src/apps/devices/DevicesView.cpp b/src/apps/devices/DevicesView.cpp index 442be43e04..bd3582d1b9 100644 --- a/src/apps/devices/DevicesView.cpp +++ b/src/apps/devices/DevicesView.cpp @@ -9,7 +9,10 @@ #include #include +#include #include +#include +#include #include @@ -18,8 +21,9 @@ #undef B_TRANSLATE_CONTEXT #define B_TRANSLATE_CONTEXT "DevicesView" -DevicesView::DevicesView(const BRect& rect) - : BView(rect, "DevicesView", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS) +DevicesView::DevicesView() + : + BView("DevicesView", B_WILL_DRAW | B_FRAME_EVENTS) { CreateLayout(); RescanDevices(); @@ -30,8 +34,6 @@ DevicesView::DevicesView(const BRect& rect) void DevicesView::CreateLayout() { - SetLayout(new BGroupLayout(B_VERTICAL)); - BMenuBar* menuBar = new BMenuBar("menu"); BMenu* menu = new BMenu(B_TRANSLATE("Devices")); BMenuItem* item; @@ -90,18 +92,15 @@ DevicesView::CreateLayout() fTabView->AddTab(fAttributesView, fDetailedTab); fDetailedTab->SetLabel(B_TRANSLATE("Detailed")); - AddChild(BGroupLayoutBuilder(B_VERTICAL, 0) - .Add(menuBar) - .Add(BSplitLayoutBuilder(B_HORIZONTAL, 5) - .Add(BGroupLayoutBuilder(B_VERTICAL, 5) - .Add(fOrderByMenu, 1) - .Add(scrollView, 2) - .TopView() - ) - .Add(fTabView, 2) - .SetInsets(5, 5, 5, 5) - ).TopView() - ); + BLayoutBuilder::Group<>(this, B_VERTICAL, 0) + .Add(menuBar) + .AddSplit(B_HORIZONTAL) + .SetInsets(B_USE_ITEM_INSETS) + .AddGroup(B_VERTICAL) + .Add(fOrderByMenu, 1) + .Add(scrollView, 2) + .End() + .Add(fTabView, 2); } diff --git a/src/apps/devices/DevicesView.h b/src/apps/devices/DevicesView.h index 4730e1cfe4..c71d5e05bc 100644 --- a/src/apps/devices/DevicesView.h +++ b/src/apps/devices/DevicesView.h @@ -9,16 +9,10 @@ #define DEVICESVIEW_H -#include -#include #include #include #include #include -#include -#include -#include -#include #include #include @@ -50,7 +44,7 @@ typedef std::vector Devices; class DevicesView : public BView { public: - DevicesView(const BRect& r); + DevicesView(); ~DevicesView(); virtual void CreateLayout();