xref: /haiku/src/tests/add-ons/print/ppd/ui/PPDConfigView.h (revision 4420c1ceffd7f2246e4303d59cf02ed122980e9d)
1*4420c1ceSMichael Pfeiffer /*
2*4420c1ceSMichael Pfeiffer  * Copyright 2008, Haiku.
3*4420c1ceSMichael Pfeiffer  * Distributed under the terms of the MIT license.
4*4420c1ceSMichael Pfeiffer  *
5*4420c1ceSMichael Pfeiffer  * Authors:
6*4420c1ceSMichael Pfeiffer  *		Michael Pfeiffer <laplace@users.sourceforge.net>
7*4420c1ceSMichael Pfeiffer  */
8*4420c1ceSMichael Pfeiffer 
9*4420c1ceSMichael Pfeiffer #ifndef _PPD_CONFIG_VIEW_H
10*4420c1ceSMichael Pfeiffer #define _PPD_CONFIG_VIEW_H
11*4420c1ceSMichael Pfeiffer 
12*4420c1ceSMichael Pfeiffer #include "PPD.h"
13*4420c1ceSMichael Pfeiffer 
14*4420c1ceSMichael Pfeiffer #include <View.h>
15*4420c1ceSMichael Pfeiffer #include <ListItem.h>
16*4420c1ceSMichael Pfeiffer #include <OutlineListView.h>
17*4420c1ceSMichael Pfeiffer 
18*4420c1ceSMichael Pfeiffer class CategoryItem : public BStringItem
19*4420c1ceSMichael Pfeiffer {
20*4420c1ceSMichael Pfeiffer private:
21*4420c1ceSMichael Pfeiffer 	Statement* fStatement;
22*4420c1ceSMichael Pfeiffer 
23*4420c1ceSMichael Pfeiffer public:
CategoryItem(const char * text,Statement * statement,uint32 level)24*4420c1ceSMichael Pfeiffer 	CategoryItem(const char* text, Statement* statement, uint32 level)
25*4420c1ceSMichael Pfeiffer 		: BStringItem(text, level)
26*4420c1ceSMichael Pfeiffer 		, fStatement(statement)
27*4420c1ceSMichael Pfeiffer 	{
28*4420c1ceSMichael Pfeiffer 	}
29*4420c1ceSMichael Pfeiffer 
GetStatement()30*4420c1ceSMichael Pfeiffer 	Statement* GetStatement() { return fStatement; }
31*4420c1ceSMichael Pfeiffer };
32*4420c1ceSMichael Pfeiffer 
33*4420c1ceSMichael Pfeiffer class PPDConfigView : public BView {
34*4420c1ceSMichael Pfeiffer private:
35*4420c1ceSMichael Pfeiffer 	PPD* fPPD;
36*4420c1ceSMichael Pfeiffer 
37*4420c1ceSMichael Pfeiffer 	BView*            fDetails;
38*4420c1ceSMichael Pfeiffer 	BMessage          fSettings;
39*4420c1ceSMichael Pfeiffer 
40*4420c1ceSMichael Pfeiffer 	void SetupSettings(const BMessage& settings);
41*4420c1ceSMichael Pfeiffer 
42*4420c1ceSMichael Pfeiffer 	void BooleanChanged(BMessage* msg);
43*4420c1ceSMichael Pfeiffer 	void StringChanged(BMessage* msg);
44*4420c1ceSMichael Pfeiffer 
45*4420c1ceSMichael Pfeiffer public:
46*4420c1ceSMichael Pfeiffer 	PPDConfigView(BRect rect, const char *name, uint32 resizeMask, uint32 flags);
47*4420c1ceSMichael Pfeiffer 
48*4420c1ceSMichael Pfeiffer 	// The view has to be attached to a window when this
49*4420c1ceSMichael Pfeiffer 	// method is called.
50*4420c1ceSMichael Pfeiffer 	void Set(const char* ppdFile, const BMessage& settings);
51*4420c1ceSMichael Pfeiffer 	const BMessage& GetSettings();
52*4420c1ceSMichael Pfeiffer 
53*4420c1ceSMichael Pfeiffer 	void FillCategories();
54*4420c1ceSMichael Pfeiffer 	void FillDetails(Statement* statement);
55*4420c1ceSMichael Pfeiffer 	void MessageReceived(BMessage* msg);
56*4420c1ceSMichael Pfeiffer };
57*4420c1ceSMichael Pfeiffer #endif
58