xref: /haiku/src/preferences/printers/JobListView.h (revision 71452e98334eaac603bf542d159e24788a46bebb)
1 /*
2  * Copyright 2001-2010, Haiku.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Michael Pfeiffer
7  */
8 #ifndef _JOB_LISTVIEW_H
9 #define _JOB_LISTVIEW_H
10 
11 
12 #include <Bitmap.h>
13 #include <ListItem.h>
14 #include <ListView.h>
15 #include <String.h>
16 
17 
18 class Job;
19 class JobItem;
20 class SpoolFolder;
21 
22 
23 class JobListView : public BListView {
24 	typedef BListView Inherited;
25 public:
26 								JobListView(BRect frame);
27 								~JobListView();
28 
29 			void				AttachedToWindow();
30 			void				SetSpoolFolder(SpoolFolder* folder);
31 
32 			void				AddJob(Job* job);
33 			void				RemoveJob(Job* job);
34 			void				UpdateJob(Job* job);
35 
36 			JobItem* 			SelectedItem() const;
37 
38 			void				RestartJob();
39 			void				CancelJob();
40 
41 private:
42 			JobItem* 			FindJob(Job* job) const;
43 };
44 
45 
46 class JobItem : public BListItem {
47 public:
48 								JobItem(Job* job);
49 								~JobItem();
50 
51 			void				Update();
52 
53 			void				Update(BView *owner, const BFont *font);
54 			void				DrawItem(BView *owner, BRect bounds,
55 									bool complete);
56 
57 			Job* 				GetJob() const { return fJob; }
58 
59 private:
60 			Job*				fJob;
61 			BBitmap*			fIcon;
62 			BString				fName;
63 			BString				fPages;
64 			BString				fStatus;
65 			BString				fSize;
66 };
67 
68 #endif // _JOB_LISTVIEW_H
69