* some code formating, no functional change
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25301 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
ea035707b3
commit
9ec99c6e2f
@ -1,8 +1,8 @@
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Printers Preference Application.
|
// Printers Preference Application.
|
||||||
//
|
//
|
||||||
// This application and all source files used in its construction, except
|
// This application and all source files used in its construction, except
|
||||||
// where noted, are licensed under the MIT License, and have been written
|
// where noted, are licensed under the MIT License, and have been written
|
||||||
// and are:
|
// and are:
|
||||||
//
|
//
|
||||||
// Copyright (c) 2001-2003 OpenBeOS Project
|
// Copyright (c) 2001-2003 OpenBeOS Project
|
||||||
@ -10,93 +10,112 @@
|
|||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
// to deal in the Software without restriction, including without limitation
|
// to deal in the Software without restriction, including without limitation
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
//
|
//
|
||||||
// The above copyright notice and this permission notice shall be included
|
// The above copyright notice and this permission notice shall be included
|
||||||
// in all copies or substantial portions of the Software.
|
// in all copies or substantial portions of the Software.
|
||||||
//
|
//
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#include "JobListView.h"
|
#include "JobListView.h"
|
||||||
#include "pr_server.h"
|
|
||||||
|
|
||||||
#include "Messages.h"
|
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "Jobs.h"
|
#include "Jobs.h"
|
||||||
|
#include "Messages.h"
|
||||||
|
#include "pr_server.h"
|
||||||
#include "SpoolFolder.h"
|
#include "SpoolFolder.h"
|
||||||
|
|
||||||
#include <Messenger.h>
|
|
||||||
#include <Bitmap.h>
|
|
||||||
#include <String.h>
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
|
#include <Bitmap.h>
|
||||||
|
#include <Messenger.h>
|
||||||
#include <Mime.h>
|
#include <Mime.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -- JobListView
|
||||||
|
|
||||||
|
|
||||||
JobListView::JobListView(BRect frame)
|
JobListView::JobListView(BRect frame)
|
||||||
: Inherited(frame, "jobs_list", B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL)
|
: Inherited(frame, "jobs_list", B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void JobListView::AttachedToWindow()
|
|
||||||
|
void
|
||||||
|
JobListView::AttachedToWindow()
|
||||||
{
|
{
|
||||||
Inherited::AttachedToWindow();
|
Inherited::AttachedToWindow();
|
||||||
|
|
||||||
SetSelectionMessage(new BMessage(kMsgJobSelected));
|
SetSelectionMessage(new BMessage(kMsgJobSelected));
|
||||||
SetTarget(Window());
|
SetTarget(Window());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void JobListView::SetSpoolFolder(SpoolFolder* folder)
|
void
|
||||||
|
JobListView::SetSpoolFolder(SpoolFolder* folder)
|
||||||
{
|
{
|
||||||
BPath path;
|
BPath path;
|
||||||
|
|
||||||
// clear list
|
// clear list
|
||||||
const BListItem** items = Items();
|
const BListItem** items = Items();
|
||||||
for (int i = CountItems() - 1; i >= 0; i --) {
|
for (int i = CountItems() - 1; i >= 0; i --) {
|
||||||
delete items[i];
|
delete items[i];
|
||||||
}
|
}
|
||||||
MakeEmpty();
|
MakeEmpty();
|
||||||
if (folder == NULL) return;
|
|
||||||
|
if (folder == NULL)
|
||||||
// Find directory containing printer definition nodes
|
return;
|
||||||
|
|
||||||
|
// Find directory containing printer definition nodes
|
||||||
for (int32 i = 0; i < folder->CountJobs(); i ++) {
|
for (int32 i = 0; i < folder->CountJobs(); i ++) {
|
||||||
Job* job = folder->JobAt(i);
|
Job* job = folder->JobAt(i);
|
||||||
AddJob(job);
|
AddJob(job);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JobItem* JobListView::Find(Job* job)
|
|
||||||
|
JobItem*
|
||||||
|
JobListView::Find(Job* job)
|
||||||
{
|
{
|
||||||
const int32 n = CountItems();
|
const int32 n = CountItems();
|
||||||
for (int32 i = 0; i < n; i ++) {
|
for (int32 i = 0; i < n; i ++) {
|
||||||
JobItem* item = dynamic_cast<JobItem*>(ItemAt(i));
|
JobItem* item = dynamic_cast<JobItem*>(ItemAt(i));
|
||||||
if (item && item->GetJob() == job) return item;
|
if (item && item->GetJob() == job)
|
||||||
|
return item;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
JobItem* JobListView::SelectedItem() {
|
|
||||||
|
JobItem*
|
||||||
|
JobListView::SelectedItem()
|
||||||
|
{
|
||||||
BListItem* item = ItemAt(CurrentSelection());
|
BListItem* item = ItemAt(CurrentSelection());
|
||||||
return dynamic_cast<JobItem*>(item);
|
return dynamic_cast<JobItem*>(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JobListView::AddJob(Job* job)
|
|
||||||
|
void
|
||||||
|
JobListView::AddJob(Job* job)
|
||||||
{
|
{
|
||||||
JobItem* item = new JobItem(job);
|
JobItem* item = new JobItem(job);
|
||||||
AddItem(item);
|
AddItem(item);
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void JobListView::RemoveJob(Job* job)
|
|
||||||
|
void
|
||||||
|
JobListView::RemoveJob(Job* job)
|
||||||
{
|
{
|
||||||
JobItem* item = Find(job);
|
JobItem* item = Find(job);
|
||||||
if (item) {
|
if (item) {
|
||||||
@ -106,7 +125,9 @@ void JobListView::RemoveJob(Job* job)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JobListView::UpdateJob(Job* job)
|
|
||||||
|
void
|
||||||
|
JobListView::UpdateJob(Job* job)
|
||||||
{
|
{
|
||||||
JobItem* item = Find(job);
|
JobItem* item = Find(job);
|
||||||
if (item) {
|
if (item) {
|
||||||
@ -115,17 +136,21 @@ void JobListView::UpdateJob(Job* job)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JobListView::RestartJob()
|
|
||||||
|
void
|
||||||
|
JobListView::RestartJob()
|
||||||
{
|
{
|
||||||
JobItem* item = SelectedItem();
|
JobItem* item = SelectedItem();
|
||||||
if (item && item->GetJob()->Status() == kFailed) {
|
if (item && item->GetJob()->Status() == kFailed) {
|
||||||
// setting the state changes the file attribute and
|
// setting the state changes the file attribute and
|
||||||
// we will receive a notification from SpoolFolder
|
// we will receive a notification from SpoolFolder
|
||||||
item->GetJob()->SetStatus(kWaiting);
|
item->GetJob()->SetStatus(kWaiting);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JobListView::CancelJob()
|
|
||||||
|
void
|
||||||
|
JobListView::CancelJob()
|
||||||
{
|
{
|
||||||
JobItem* item = SelectedItem();
|
JobItem* item = SelectedItem();
|
||||||
if (item && item->GetJob()->Status() != kProcessing) {
|
if (item && item->GetJob()->Status() != kProcessing) {
|
||||||
@ -135,7 +160,8 @@ void JobListView::CancelJob()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Implementation of JobItem
|
// #pragma mark -- JobItem
|
||||||
|
|
||||||
|
|
||||||
JobItem::JobItem(Job* job)
|
JobItem::JobItem(Job* job)
|
||||||
: BListItem(0, false)
|
: BListItem(0, false)
|
||||||
@ -143,78 +169,100 @@ JobItem::JobItem(Job* job)
|
|||||||
, fIcon(NULL)
|
, fIcon(NULL)
|
||||||
{
|
{
|
||||||
fJob->Acquire();
|
fJob->Acquire();
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
JobItem::~JobItem() {
|
|
||||||
|
JobItem::~JobItem()
|
||||||
|
{
|
||||||
fJob->Release();
|
fJob->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void JobItem::Update()
|
|
||||||
|
void
|
||||||
|
JobItem::Update()
|
||||||
{
|
{
|
||||||
BNode node(&fJob->EntryRef());
|
BNode node(&fJob->EntryRef());
|
||||||
if (node.InitCheck() != B_OK) return;
|
if (node.InitCheck() != B_OK)
|
||||||
|
return;
|
||||||
|
|
||||||
node.ReadAttrString(PSRV_SPOOL_ATTR_DESCRIPTION, &fName);
|
node.ReadAttrString(PSRV_SPOOL_ATTR_DESCRIPTION, &fName);
|
||||||
|
|
||||||
BString mimeType;
|
BString mimeType;
|
||||||
node.ReadAttrString(PSRV_SPOOL_ATTR_MIMETYPE, &mimeType);
|
node.ReadAttrString(PSRV_SPOOL_ATTR_MIMETYPE, &mimeType);
|
||||||
|
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
if (fIcon == NULL && be_roster->FindApp(mimeType.String(), &ref) == B_OK) {
|
if (fIcon == NULL && be_roster->FindApp(mimeType.String(), &ref) == B_OK) {
|
||||||
fIcon = new BBitmap(BRect(0,0,B_MINI_ICON-1,B_MINI_ICON-1), B_CMAP8);
|
fIcon = new BBitmap(BRect(0, 0, B_MINI_ICON - 1, B_MINI_ICON - 1), B_CMAP8);
|
||||||
BMimeType type(mimeType.String());
|
BMimeType type(mimeType.String());
|
||||||
if (type.GetIcon(fIcon, B_MINI_ICON) != B_OK) {
|
if (type.GetIcon(fIcon, B_MINI_ICON) != B_OK) {
|
||||||
delete fIcon; fIcon = NULL;
|
delete fIcon;
|
||||||
|
fIcon = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fPages = "";
|
||||||
int32 pages;
|
int32 pages;
|
||||||
fPages = ""; fSize = ""; fStatus = "";
|
if (node.ReadAttr(PSRV_SPOOL_ATTR_PAGECOUNT,
|
||||||
|
B_INT32_TYPE, 0, &pages, sizeof(pages)) == sizeof(pages)) {
|
||||||
if (node.ReadAttr(PSRV_SPOOL_ATTR_PAGECOUNT, B_INT32_TYPE, 0, &pages, sizeof(pages)) == sizeof(pages)) {
|
|
||||||
fPages << pages;
|
fPages << pages;
|
||||||
if (pages > 1) fPages << " pages.";
|
if (pages > 1)
|
||||||
else fPages << " page.";
|
fPages << " pages.";
|
||||||
|
else
|
||||||
|
fPages << " page.";
|
||||||
} else {
|
} else {
|
||||||
fPages = "??? pages.";
|
fPages = "??? pages.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fSize = "";
|
||||||
off_t size;
|
off_t size;
|
||||||
if (node.GetSize(&size) == B_OK) {
|
if (node.GetSize(&size) == B_OK) {
|
||||||
char buffer[80];
|
char buffer[80];
|
||||||
sprintf(buffer, "%.2f KB", size / 1024.0);
|
sprintf(buffer, "%.2f KB", size / 1024.0);
|
||||||
fSize = buffer;
|
fSize = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (fJob->Status()) {
|
|
||||||
case kWaiting: fStatus = "Waiting";
|
|
||||||
break;
|
|
||||||
case kProcessing: fStatus = "Processing";
|
|
||||||
break;
|
|
||||||
case kFailed: fStatus = "Failed";
|
|
||||||
break;
|
|
||||||
case kCompleted: fStatus = "Completed";
|
|
||||||
break;
|
|
||||||
default: fStatus = "Unkown status";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void JobItem::Update(BView *owner, const BFont *font)
|
fStatus = "";
|
||||||
{
|
switch (fJob->Status()) {
|
||||||
BListItem::Update(owner, font);
|
case kWaiting:
|
||||||
|
fStatus = "Waiting";
|
||||||
font_height height;
|
break;
|
||||||
font->GetHeight(&height);
|
|
||||||
|
case kProcessing:
|
||||||
SetHeight( (height.ascent+height.descent+height.leading) * 2.0 +4 );
|
fStatus = "Processing";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kFailed:
|
||||||
|
fStatus = "Failed";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kCompleted:
|
||||||
|
fStatus = "Completed";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
fStatus = "Unkown status";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JobItem::DrawItem(BView *owner, BRect, bool complete)
|
|
||||||
|
void
|
||||||
|
JobItem::Update(BView *owner, const BFont *font)
|
||||||
|
{
|
||||||
|
BListItem::Update(owner, font);
|
||||||
|
|
||||||
|
font_height height;
|
||||||
|
font->GetHeight(&height);
|
||||||
|
|
||||||
|
SetHeight((height.ascent + height.descent + height.leading) * 2.0 + 4.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
JobItem::DrawItem(BView *owner, BRect, bool complete)
|
||||||
{
|
{
|
||||||
BListView* list = dynamic_cast<BListView*>(owner);
|
BListView* list = dynamic_cast<BListView*>(owner);
|
||||||
if (list)
|
if (list) {
|
||||||
{
|
|
||||||
font_height height;
|
font_height height;
|
||||||
BFont font;
|
BFont font;
|
||||||
owner->GetFont(&font);
|
owner->GetFont(&font);
|
||||||
@ -222,46 +270,46 @@ void JobItem::DrawItem(BView *owner, BRect, bool complete)
|
|||||||
float fntheight = height.ascent+height.descent+height.leading;
|
float fntheight = height.ascent+height.descent+height.leading;
|
||||||
|
|
||||||
BRect bounds = list->ItemFrame(list->IndexOf(this));
|
BRect bounds = list->ItemFrame(list->IndexOf(this));
|
||||||
|
|
||||||
rgb_color color = owner->ViewColor();
|
rgb_color color = owner->ViewColor();
|
||||||
if ( IsSelected() )
|
if (IsSelected())
|
||||||
color = tint_color(color, B_HIGHLIGHT_BACKGROUND_TINT);
|
color = tint_color(color, B_HIGHLIGHT_BACKGROUND_TINT);
|
||||||
|
|
||||||
rgb_color oldviewcolor = owner->ViewColor();
|
rgb_color oldviewcolor = owner->ViewColor();
|
||||||
rgb_color oldlowcolor = owner->LowColor();
|
rgb_color oldlowcolor = owner->LowColor();
|
||||||
rgb_color oldcolor = owner->HighColor();
|
rgb_color oldcolor = owner->HighColor();
|
||||||
owner->SetViewColor( color );
|
owner->SetViewColor(color);
|
||||||
owner->SetHighColor( color );
|
owner->SetHighColor(color);
|
||||||
owner->SetLowColor( color );
|
owner->SetLowColor(color);
|
||||||
owner->FillRect(bounds);
|
owner->FillRect(bounds);
|
||||||
owner->SetLowColor( oldlowcolor );
|
owner->SetLowColor(oldlowcolor);
|
||||||
owner->SetHighColor( oldcolor );
|
owner->SetHighColor(oldcolor);
|
||||||
|
|
||||||
BPoint iconPt(bounds.LeftTop() + BPoint(2, 2));
|
BPoint iconPt(bounds.LeftTop() + BPoint(2, 2));
|
||||||
BPoint leftTop(bounds.LeftTop() + BPoint(12+B_MINI_ICON, 2));
|
BPoint leftTop(bounds.LeftTop() + BPoint(12 + B_MINI_ICON, 2));
|
||||||
BPoint namePt(leftTop + BPoint(0, fntheight));
|
BPoint namePt(leftTop + BPoint(0, fntheight));
|
||||||
BPoint statusPt(leftTop + BPoint(0, fntheight*2));
|
BPoint statusPt(leftTop + BPoint(0, fntheight*2));
|
||||||
|
|
||||||
float width = owner->StringWidth(fPages.String());
|
float width = owner->StringWidth(fPages.String());
|
||||||
BPoint pagePt(bounds.RightTop() + BPoint(-width-32, fntheight));
|
BPoint pagePt(bounds.RightTop() + BPoint(-width - 32, fntheight));
|
||||||
width = owner->StringWidth(fSize.String());
|
width = owner->StringWidth(fSize.String());
|
||||||
BPoint sizePt(bounds.RightTop() + BPoint(-width-32, fntheight*2));
|
BPoint sizePt(bounds.RightTop() + BPoint(-width - 32, fntheight * 2));
|
||||||
|
|
||||||
drawing_mode mode = owner->DrawingMode();
|
drawing_mode mode = owner->DrawingMode();
|
||||||
owner->SetDrawingMode(B_OP_OVER);
|
owner->SetDrawingMode(B_OP_OVER);
|
||||||
|
|
||||||
if (fIcon) owner->DrawBitmap(fIcon, iconPt);
|
if (fIcon)
|
||||||
|
owner->DrawBitmap(fIcon, iconPt);
|
||||||
// left of item
|
|
||||||
|
// left of item
|
||||||
owner->DrawString(fName.String(), fName.Length(), namePt);
|
owner->DrawString(fName.String(), fName.Length(), namePt);
|
||||||
owner->DrawString(fStatus.String(), fStatus.Length(), statusPt);
|
owner->DrawString(fStatus.String(), fStatus.Length(), statusPt);
|
||||||
|
|
||||||
// right of item
|
// right of item
|
||||||
owner->DrawString(fPages.String(), fPages.Length(), pagePt);
|
owner->DrawString(fPages.String(), fPages.Length(), pagePt);
|
||||||
owner->DrawString(fSize.String(), fSize.Length(), sizePt);
|
owner->DrawString(fSize.String(), fSize.Length(), sizePt);
|
||||||
|
|
||||||
owner->SetDrawingMode(mode);
|
|
||||||
|
|
||||||
|
owner->SetDrawingMode(mode);
|
||||||
owner->SetViewColor(oldviewcolor);
|
owner->SetViewColor(oldviewcolor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Printers Preference Application.
|
// Printers Preference Application.
|
||||||
//
|
//
|
||||||
// This application and all source files used in its construction, except
|
// This application and all source files used in its construction, except
|
||||||
// where noted, are licensed under the MIT License, and have been written
|
// where noted, are licensed under the MIT License, and have been written
|
||||||
// and are:
|
// and are:
|
||||||
//
|
//
|
||||||
// Copyright (c) 2001-2003 OpenBeOS Project
|
// Copyright (c) 2001-2003 OpenBeOS Project
|
||||||
@ -10,18 +10,18 @@
|
|||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
// to deal in the Software without restriction, including without limitation
|
// to deal in the Software without restriction, including without limitation
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
//
|
//
|
||||||
// The above copyright notice and this permission notice shall be included
|
// The above copyright notice and this permission notice shall be included
|
||||||
// in all copies or substantial portions of the Software.
|
// in all copies or substantial portions of the Software.
|
||||||
//
|
//
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -29,38 +29,40 @@
|
|||||||
#ifndef JOBLISTVIEW_H
|
#ifndef JOBLISTVIEW_H
|
||||||
#define JOBLISTVIEW_H
|
#define JOBLISTVIEW_H
|
||||||
|
|
||||||
#include <Messenger.h>
|
|
||||||
#include <ListView.h>
|
#include <ListView.h>
|
||||||
|
#include <ListItem.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
#include "Jobs.h"
|
|
||||||
|
|
||||||
|
class BBitmap;
|
||||||
|
class Job;
|
||||||
class JobItem;
|
class JobItem;
|
||||||
class JobListView;
|
|
||||||
class SpoolFolder;
|
class SpoolFolder;
|
||||||
|
|
||||||
|
|
||||||
class JobListView : public BListView
|
class JobListView : public BListView
|
||||||
{
|
{
|
||||||
typedef BListView Inherited;
|
typedef BListView Inherited;
|
||||||
private:
|
|
||||||
JobItem* Find(Job* job);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
JobListView(BRect frame);
|
JobListView(BRect frame);
|
||||||
void AttachedToWindow();
|
void AttachedToWindow();
|
||||||
void SetSpoolFolder(SpoolFolder* folder);
|
void SetSpoolFolder(SpoolFolder* folder);
|
||||||
|
|
||||||
void AddJob(Job* job);
|
void AddJob(Job* job);
|
||||||
void RemoveJob(Job* job);
|
void RemoveJob(Job* job);
|
||||||
void UpdateJob(Job* job);
|
void UpdateJob(Job* job);
|
||||||
|
|
||||||
JobItem* SelectedItem();
|
JobItem* SelectedItem();
|
||||||
|
|
||||||
void RestartJob();
|
void RestartJob();
|
||||||
void CancelJob();
|
void CancelJob();
|
||||||
|
|
||||||
|
private:
|
||||||
|
JobItem* Find(Job* job);
|
||||||
};
|
};
|
||||||
|
|
||||||
class BBitmap;
|
|
||||||
class JobItem : public BListItem
|
class JobItem : public BListItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -68,18 +70,19 @@ public:
|
|||||||
~JobItem();
|
~JobItem();
|
||||||
|
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
void Update(BView *owner, const BFont *font);
|
void Update(BView *owner, const BFont *font);
|
||||||
void DrawItem(BView *owner, BRect bounds, bool complete);
|
void DrawItem(BView *owner, BRect bounds, bool complete);
|
||||||
|
|
||||||
Job* GetJob() { return fJob; }
|
Job* GetJob() { return fJob; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Job* fJob;
|
||||||
Job* fJob;
|
BBitmap* fIcon;
|
||||||
BBitmap* fIcon;
|
BString fName;
|
||||||
BString fName, fPages;
|
BString fPages;
|
||||||
BString fStatus, fSize;
|
BString fStatus;
|
||||||
|
BString fSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user