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