Author: axeld Date: 2009-10-14 14:12:52 +0200 (Wed, 14 Oct 2009) New Revision: 33583 Changeset: http://dev.haiku-os.org/changeset/33583/haiku Modified: haiku/trunk/src/apps/showimage/ProgressWindow.cpp haiku/trunk/src/apps/showimage/ProgressWindow.h Log: * Minor cleanup. Modified: haiku/trunk/src/apps/showimage/ProgressWindow.cpp =================================================================== --- haiku/trunk/src/apps/showimage/ProgressWindow.cpp 2009-10-14 11:05:30 UTC (rev 33582) +++ haiku/trunk/src/apps/showimage/ProgressWindow.cpp 2009-10-14 12:12:52 UTC (rev 33583) @@ -1,8 +1,9 @@ /* - * Copyright 2007, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights reserved. + * Copyright 2007-2009, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx * Distributed under the terms of the MIT License. */ + #include "ProgressWindow.h" #include <stdio.h> @@ -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 @@ 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(); } Modified: haiku/trunk/src/apps/showimage/ProgressWindow.h =================================================================== --- haiku/trunk/src/apps/showimage/ProgressWindow.h 2009-10-14 11:05:30 UTC (rev 33582) +++ haiku/trunk/src/apps/showimage/ProgressWindow.h 2009-10-14 12:12:52 UTC (rev 33583) @@ -1,5 +1,5 @@ /* - * Copyright 2007, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights reserved. + * Copyright 2007-2009, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx * Distributed under the terms of the MIT License. */ #ifndef PROGRESS_WINDOW_H @@ -8,25 +8,27 @@ #include <Window.h> + 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; };