From 8e52aee982f702b3fc21e6b073afc85498d2968d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 14 Oct 2009 12:12:52 +0000 Subject: [PATCH] * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33583 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/showimage/ProgressWindow.cpp | 14 ++++++++++---- src/apps/showimage/ProgressWindow.h | 22 ++++++++++++---------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/apps/showimage/ProgressWindow.cpp b/src/apps/showimage/ProgressWindow.cpp index 27bb2fc043..8cfc40d2c8 100644 --- a/src/apps/showimage/ProgressWindow.cpp +++ b/src/apps/showimage/ProgressWindow.cpp @@ -1,8 +1,9 @@ /* - * Copyright 2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2007-2009, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ + #include "ProgressWindow.h" #include @@ -18,7 +19,7 @@ static const uint32 kMsgShow = 'show'; -ProgressWindow::ProgressWindow(BWindow* referenceWindow) +ProgressWindow::ProgressWindow(BWindow* referenceWindow, bool center) : BWindow(BRect(0, 0, 250, 100), "Progress Monitor", B_MODAL_WINDOW_LOOK, B_FLOATING_APP_WINDOW_FEEL, @@ -40,8 +41,13 @@ ProgressWindow::ProgressWindow(BWindow* referenceWindow) view->AddChild(fStatusBar); BScreen screen(referenceWindow); - ResizeTo(Bounds().Width(), height + 9); - MoveTo(screen.Frame().left + 5, screen.Frame().bottom - Bounds().Height() - 5); + if (!center) { + ResizeTo(Bounds().Width(), height + 9); + // TODO: frame width! + MoveTo(screen.Frame().left + 5, + screen.Frame().bottom - Bounds().Height() - 5); + } else + CenterIn(screen.Frame()); Run(); } diff --git a/src/apps/showimage/ProgressWindow.h b/src/apps/showimage/ProgressWindow.h index 3bbf56db3b..12c8fd9af6 100644 --- a/src/apps/showimage/ProgressWindow.h +++ b/src/apps/showimage/ProgressWindow.h @@ -1,5 +1,5 @@ /* - * Copyright 2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2007-2009, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ #ifndef PROGRESS_WINDOW_H @@ -8,25 +8,27 @@ #include + class BMessageRunner; class BStatusBar; class ProgressWindow : public BWindow { public: - ProgressWindow(BWindow* referenceWindow); - virtual ~ProgressWindow(); + ProgressWindow(BWindow* referenceWindow, + bool center = false); + virtual ~ProgressWindow(); - virtual void MessageReceived(BMessage *message); + virtual void MessageReceived(BMessage* message); - void Start(); - void Stop(); + void Start(); + void Stop(); private: - BStatusBar* fStatusBar; - BMessageRunner* fRunner; - bool fRetrievedUpdate; - bool fRetrievedShow; + BStatusBar* fStatusBar; + BMessageRunner* fRunner; + bool fRetrievedUpdate; + bool fRetrievedShow; };