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
This commit is contained in:
Alex Wilson
2011-06-24 18:14:38 +00:00
parent 8c5a0accf5
commit 0f4e8dfec6
3 changed files with 23 additions and 36 deletions
+6 -12
View File
@@ -9,6 +9,7 @@
#include <Alert.h> #include <Alert.h>
#include <Application.h> #include <Application.h>
#include <Catalog.h> #include <Catalog.h>
#include <LayoutBuilder.h>
#include <TextView.h> #include <TextView.h>
#include "DevicesView.h" #include "DevicesView.h"
@@ -44,20 +45,13 @@ DevicesApplication::DevicesApplication()
DevicesWindow::DevicesWindow() DevicesWindow::DevicesWindow()
: :
BWindow(BRect(50, 50, 750, 550), B_TRANSLATE_SYSTEM_NAME("Devices"), BWindow(BRect(50, 50, 750, 550), B_TRANSLATE_SYSTEM_NAME("Devices"),
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS
| B_AUTO_UPDATE_SIZE_LIMITS
| B_QUIT_ON_WINDOW_CLOSE) | B_QUIT_ON_WINDOW_CLOSE)
{ {
float minWidth; BLayoutBuilder::Group<>(this, B_VERTICAL)
float maxWidth; .SetInsets(0)
float minHeight; .Add(fDevicesView = new DevicesView());
float maxHeight; GetLayout()->SetExplicitMinSize(BSize(600, 300));
GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
minWidth = 600;
minHeight = 300;
SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight);
fDevicesView = new DevicesView(Bounds());
AddChild(fDevicesView);
} }
+12 -13
View File
@@ -9,7 +9,10 @@
#include <Application.h> #include <Application.h>
#include <Catalog.h> #include <Catalog.h>
#include <LayoutBuilder.h>
#include <MenuBar.h> #include <MenuBar.h>
#include <ScrollView.h>
#include <String.h>
#include <iostream> #include <iostream>
@@ -18,8 +21,9 @@
#undef B_TRANSLATE_CONTEXT #undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "DevicesView" #define B_TRANSLATE_CONTEXT "DevicesView"
DevicesView::DevicesView(const BRect& rect) DevicesView::DevicesView()
: BView(rect, "DevicesView", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS) :
BView("DevicesView", B_WILL_DRAW | B_FRAME_EVENTS)
{ {
CreateLayout(); CreateLayout();
RescanDevices(); RescanDevices();
@@ -30,8 +34,6 @@ DevicesView::DevicesView(const BRect& rect)
void void
DevicesView::CreateLayout() DevicesView::CreateLayout()
{ {
SetLayout(new BGroupLayout(B_VERTICAL));
BMenuBar* menuBar = new BMenuBar("menu"); BMenuBar* menuBar = new BMenuBar("menu");
BMenu* menu = new BMenu(B_TRANSLATE("Devices")); BMenu* menu = new BMenu(B_TRANSLATE("Devices"));
BMenuItem* item; BMenuItem* item;
@@ -90,18 +92,15 @@ DevicesView::CreateLayout()
fTabView->AddTab(fAttributesView, fDetailedTab); fTabView->AddTab(fAttributesView, fDetailedTab);
fDetailedTab->SetLabel(B_TRANSLATE("Detailed")); fDetailedTab->SetLabel(B_TRANSLATE("Detailed"));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 0) BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.Add(menuBar) .Add(menuBar)
.Add(BSplitLayoutBuilder(B_HORIZONTAL, 5) .AddSplit(B_HORIZONTAL)
.Add(BGroupLayoutBuilder(B_VERTICAL, 5) .SetInsets(B_USE_ITEM_INSETS)
.AddGroup(B_VERTICAL)
.Add(fOrderByMenu, 1) .Add(fOrderByMenu, 1)
.Add(scrollView, 2) .Add(scrollView, 2)
.TopView() .End()
) .Add(fTabView, 2);
.Add(fTabView, 2)
.SetInsets(5, 5, 5, 5)
).TopView()
);
} }
+1 -7
View File
@@ -9,16 +9,10 @@
#define DEVICESVIEW_H #define DEVICESVIEW_H
#include <GroupLayout.h>
#include <GroupLayoutBuilder.h>
#include <MenuField.h> #include <MenuField.h>
#include <MenuItem.h> #include <MenuItem.h>
#include <OutlineListView.h> #include <OutlineListView.h>
#include <PopUpMenu.h> #include <PopUpMenu.h>
#include <SplitLayoutBuilder.h>
#include <ScrollView.h>
#include <String.h>
#include <StringView.h>
#include <TabView.h> #include <TabView.h>
#include <View.h> #include <View.h>
@@ -50,7 +44,7 @@ typedef std::vector<Device*> Devices;
class DevicesView : public BView { class DevicesView : public BView {
public: public:
DevicesView(const BRect& r); DevicesView();
~DevicesView(); ~DevicesView();
virtual void CreateLayout(); virtual void CreateLayout();