* Use Layout API.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39197 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -26,7 +26,6 @@ public:
|
|||||||
void SetPageCopies(uint32 copies);
|
void SetPageCopies(uint32 copies);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BView* fStatusView;
|
|
||||||
BStatusBar* fStatusBar;
|
BStatusBar* fStatusBar;
|
||||||
BButton* fCancelButton;
|
BButton* fCancelButton;
|
||||||
BButton* fHideButton;
|
BButton* fHideButton;
|
||||||
|
|||||||
@@ -7,10 +7,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "StatusWindow.h"
|
#include "StatusWindow.h"
|
||||||
|
|
||||||
|
#include <Button.h>
|
||||||
|
#include <GroupLayout.h>
|
||||||
|
#include <GroupLayoutBuilder.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
#include <StatusBar.h>
|
#include <StatusBar.h>
|
||||||
#include <Button.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
|
|
||||||
@@ -22,9 +25,11 @@
|
|||||||
StatusWindow::StatusWindow(bool oddPages, bool evenPages, uint32 firstPage,
|
StatusWindow::StatusWindow(bool oddPages, bool evenPages, uint32 firstPage,
|
||||||
uint32 numPages, uint32 numCopies, uint32 nup)
|
uint32 numPages, uint32 numCopies, uint32 nup)
|
||||||
:
|
:
|
||||||
BWindow(BRect(200, 200, 650, 270),
|
BWindow(BRect(200, 200, 250, 250),
|
||||||
"Print Status",
|
"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
|
// oddPages - if true, only print odd numbered pages
|
||||||
// evenPages - if true, only print even numbered pages
|
// evenPages - if true, only print even numbered pages
|
||||||
@@ -33,30 +38,25 @@ StatusWindow::StatusWindow(bool oddPages, bool evenPages, uint32 firstPage,
|
|||||||
// used)
|
// used)
|
||||||
// numCopies - total number of document copies
|
// 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
|
// the status bar
|
||||||
fStatusBar = new BStatusBar(BRect(10, 15, 245, 50), "Status Bar", "Page: ");
|
fStatusBar = new BStatusBar("statusBar", "Page: ");
|
||||||
fStatusView->AddChild(fStatusBar);
|
|
||||||
|
|
||||||
// the cancel button
|
// the cancel button
|
||||||
fHideButton = new BButton(BRect(260, 25, 330, 50), "Hide Button",
|
fHideButton = new BButton("hideButton", "Hide Status",
|
||||||
"Hide Status", new BMessage(HIDE_MSG));
|
new BMessage(HIDE_MSG));
|
||||||
fHideButton->ResizeToPreferred();
|
|
||||||
fStatusView->AddChild(fHideButton);
|
|
||||||
|
|
||||||
fCancelButton = new BButton(BRect(260, 25, 330,50), "Cancel Button",
|
fCancelButton = new BButton("cancelButton", "Cancel",
|
||||||
"Cancel", new BMessage(CANCEL_MSG));
|
new BMessage(CANCEL_MSG));
|
||||||
fCancelButton->ResizeToPreferred();
|
|
||||||
fCancelButton->MoveBy(90,0);
|
|
||||||
|
|
||||||
fStatusView->AddChild(fCancelButton);
|
|
||||||
|
|
||||||
|
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||||
|
AddChild(BGroupLayoutBuilder(B_HORIZONTAL, 10)
|
||||||
|
.Add(fStatusBar)
|
||||||
|
.Add(fHideButton)
|
||||||
|
.Add(fCancelButton)
|
||||||
|
.SetInsets(10, 10, 10, 10)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
fCancelled = false;
|
fCancelled = false;
|
||||||
|
|
||||||
// calculate the real number of pages
|
// calculate the real number of pages
|
||||||
@@ -114,6 +114,7 @@ StatusWindow::ResetStatusBar(void)
|
|||||||
{
|
{
|
||||||
Lock();
|
Lock();
|
||||||
fStatusBar->Reset("Page: ");
|
fStatusBar->Reset("Page: ");
|
||||||
|
InvalidateLayout(true);
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,6 +152,8 @@ StatusWindow::UpdateStatusBar(uint32 page, uint32 copy)
|
|||||||
string1.String(), string3.String());
|
string1.String(), string3.String());
|
||||||
if (fStatusBar->MaxValue() == fStatusBar->CurrentValue())
|
if (fStatusBar->MaxValue() == fStatusBar->CurrentValue())
|
||||||
fCancelButton->SetEnabled(false);
|
fCancelButton->SetEnabled(false);
|
||||||
|
|
||||||
|
InvalidateLayout(true);
|
||||||
Unlock();
|
Unlock();
|
||||||
return fCancelled;
|
return fCancelled;
|
||||||
}
|
}
|
||||||
@@ -175,6 +178,7 @@ StatusWindow::MessageReceived(BMessage *message)
|
|||||||
fCancelled = true;
|
fCancelled = true;
|
||||||
fCancelButton->SetEnabled(false);
|
fCancelButton->SetEnabled(false);
|
||||||
fCancelButton->SetLabel("Job cancelled");
|
fCancelButton->SetLabel("Job cancelled");
|
||||||
|
InvalidateLayout(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HIDE_MSG: // 'HideButton' is pressed...
|
case HIDE_MSG: // 'HideButton' is pressed...
|
||||||
|
|||||||
Reference in New Issue
Block a user