diff --git a/headers/libs/print/libprint/StatusWindow.h b/headers/libs/print/libprint/StatusWindow.h index 6334310517..28516d755d 100644 --- a/headers/libs/print/libprint/StatusWindow.h +++ b/headers/libs/print/libprint/StatusWindow.h @@ -26,7 +26,6 @@ public: void SetPageCopies(uint32 copies); private: - BView* fStatusView; BStatusBar* fStatusBar; BButton* fCancelButton; BButton* fHideButton; diff --git a/src/libs/print/libprint/StatusWindow.cpp b/src/libs/print/libprint/StatusWindow.cpp index 358dd59aa7..450c32e4cf 100644 --- a/src/libs/print/libprint/StatusWindow.cpp +++ b/src/libs/print/libprint/StatusWindow.cpp @@ -7,10 +7,13 @@ */ #include "StatusWindow.h" + +#include +#include +#include #include #include #include -#include #include #include @@ -22,9 +25,11 @@ StatusWindow::StatusWindow(bool oddPages, bool evenPages, uint32 firstPage, uint32 numPages, uint32 numCopies, uint32 nup) : - BWindow(BRect(200, 200, 650, 270), + BWindow(BRect(200, 200, 250, 250), "Print Status", - B_DOCUMENT_WINDOW, B_NOT_RESIZABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE) + B_TITLED_WINDOW, + B_NOT_RESIZABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE + | B_AUTO_UPDATE_SIZE_LIMITS) { // oddPages - if true, only print odd numbered pages // evenPages - if true, only print even numbered pages @@ -33,30 +38,25 @@ StatusWindow::StatusWindow(bool oddPages, bool evenPages, uint32 firstPage, // used) // numCopies - total number of document copies - BRect frame = Frame(); - // the status view - frame.OffsetTo(B_ORIGIN); - fStatusView = new BView(frame, "Status View", B_FOLLOW_ALL, B_WILL_DRAW); - fStatusView->SetViewColor(216, 216, 216); - AddChild(fStatusView); - // the status bar - fStatusBar = new BStatusBar(BRect(10, 15, 245, 50), "Status Bar", "Page: "); - fStatusView->AddChild(fStatusBar); + fStatusBar = new BStatusBar("statusBar", "Page: "); // the cancel button - fHideButton = new BButton(BRect(260, 25, 330, 50), "Hide Button", - "Hide Status", new BMessage(HIDE_MSG)); - fHideButton->ResizeToPreferred(); - fStatusView->AddChild(fHideButton); + fHideButton = new BButton("hideButton", "Hide Status", + new BMessage(HIDE_MSG)); - fCancelButton = new BButton(BRect(260, 25, 330,50), "Cancel Button", - "Cancel", new BMessage(CANCEL_MSG)); - fCancelButton->ResizeToPreferred(); - fCancelButton->MoveBy(90,0); - - fStatusView->AddChild(fCancelButton); + fCancelButton = new BButton("cancelButton", "Cancel", + new BMessage(CANCEL_MSG)); + SetLayout(new BGroupLayout(B_VERTICAL)); + AddChild(BGroupLayoutBuilder(B_HORIZONTAL, 10) + .Add(fStatusBar) + .Add(fHideButton) + .Add(fCancelButton) + .SetInsets(10, 10, 10, 10) + ); + + fCancelled = false; // calculate the real number of pages @@ -114,6 +114,7 @@ StatusWindow::ResetStatusBar(void) { Lock(); fStatusBar->Reset("Page: "); + InvalidateLayout(true); Unlock(); } @@ -151,6 +152,8 @@ StatusWindow::UpdateStatusBar(uint32 page, uint32 copy) string1.String(), string3.String()); if (fStatusBar->MaxValue() == fStatusBar->CurrentValue()) fCancelButton->SetEnabled(false); + + InvalidateLayout(true); Unlock(); return fCancelled; } @@ -175,6 +178,7 @@ StatusWindow::MessageReceived(BMessage *message) fCancelled = true; fCancelButton->SetEnabled(false); fCancelButton->SetLabel("Job cancelled"); + InvalidateLayout(true); break; case HIDE_MSG: // 'HideButton' is pressed...