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