PackageInstaller: Cleanup PackageWindow

* Also center main package installation window on screen.
This commit is contained in:
Stephan Aßmus
2014-02-16 12:12:23 +01:00
parent ef18b77adc
commit 2a7d988dc5
3 changed files with 18 additions and 23 deletions
+7 -11
View File
@@ -11,34 +11,30 @@
#include <Application.h> #include <Application.h>
#include <Catalog.h> #include <Catalog.h>
#include <GroupLayout.h>
#include <Locale.h> #include "PackageView.h"
#undef B_TRANSLATION_CONTEXT #undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "PackageWindow" #define B_TRANSLATION_CONTEXT "PackageWindow"
PackageWindow::PackageWindow(const entry_ref *ref) PackageWindow::PackageWindow(const entry_ref* ref)
: :
BWindow(BRect(100, 100, 600, 300), BWindow(BRect(100, 100, 600, 300),
B_TRANSLATE_SYSTEM_NAME("PackageInstaller"), B_TRANSLATE_SYSTEM_NAME("PackageInstaller"),
B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE) B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE)
{ {
//SetLayout(new BGroupLayout(B_HORIZONTAL)); PackageView* view = new PackageView(Bounds(), ref);
AddChild(view);
fBackground = new PackageView(Bounds(), ref); ResizeTo(Bounds().Width(), view->Bounds().Height());
AddChild(fBackground); CenterOnScreen();
ResizeTo(Bounds().Width(), fBackground->Bounds().Height());
} }
PackageWindow::~PackageWindow() PackageWindow::~PackageWindow()
{ {
RemoveChild(fBackground);
delete fBackground;
} }
+10 -12
View File
@@ -5,28 +5,26 @@
* Author: * Author:
* Łukasz 'Sil2100' Zemczak <[email protected]> * Łukasz 'Sil2100' Zemczak <[email protected]>
*/ */
#ifndef PACKAGEWINDOW_H #ifndef PACKAGE_WINDOW_H
#define PACKAGEWINDOW_H #define PACKAGE_WINDOW_H
#include "PackageView.h"
#include <Window.h> #include <Window.h>
#include <Entry.h>
struct entry_ref;
const uint32 P_WINDOW_QUIT = 'PiWq'; const uint32 P_WINDOW_QUIT = 'PiWq';
class PackageWindow : public BWindow { class PackageWindow : public BWindow {
public: public:
PackageWindow(const entry_ref *refs); PackageWindow(const entry_ref* ref);
virtual ~PackageWindow(); virtual ~PackageWindow();
virtual void Quit(); virtual void Quit();
private:
PackageView *fBackground;
}; };
#endif #endif // PACKAGE_WINDOW_H
+1
View File
@@ -17,6 +17,7 @@
#include <FilePanel.h> #include <FilePanel.h>
#include <List.h> #include <List.h>
#include <Locale.h> #include <Locale.h>
#include <Path.h>
#include <TextView.h> #include <TextView.h>
#include <stdio.h> #include <stdio.h>