xref: /haiku/src/preferences/filetypes/FileTypesWindow.h (revision d3d8b26997fac34a84981e6d2b649521de2cc45a)
1 /*
2  * Copyright 2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef FILE_TYPES_WINDOW_H
6 #define FILE_TYPES_WINDOW_H
7 
8 
9 #include <Alert.h>
10 #include <Mime.h>
11 #include <Window.h>
12 
13 class BBox;
14 class BButton;
15 class BListView;
16 class BMenuField;
17 class BMimeType;
18 class BOutlineListView;
19 class BTextControl;
20 
21 class AttributeListView;
22 class TypeIconView;
23 class MimeTypeListView;
24 class StringView;
25 
26 
27 class FileTypesWindow : public BWindow {
28 	public:
29 		FileTypesWindow(BRect frame);
30 		virtual ~FileTypesWindow();
31 
32 		virtual void MessageReceived(BMessage* message);
33 		virtual bool QuitRequested();
34 
35 		void PlaceSubWindow(BWindow* window);
36 
37 	private:
38 		void _ShowSnifferRule(bool show);
39 		void _UpdateExtensions(BMimeType* type);
40 		void _AdoptPreferredApplication(BMessage* message, bool sameAs);
41 		void _UpdatePreferredApps(BMimeType* type);
42 		void _UpdateIcon(BMimeType* type);
43 		void _SetType(BMimeType* type, int32 forceUpdate = 0);
44 
45 	private:
46 		BMimeType		fCurrentType;
47 
48 		MimeTypeListView* fTypeListView;
49 		BButton*		fRemoveTypeButton;
50 
51 		BBox*			fIconBox;
52 		TypeIconView*	fIconView;
53 
54 		BBox*			fRecognitionBox;
55 		StringView*		fExtensionLabel;
56 		BListView*		fExtensionListView;
57 		BButton*		fAddExtensionButton;
58 		BButton*		fRemoveExtensionButton;
59 		BTextControl*	fRuleControl;
60 
61 		BBox*			fDescriptionBox;
62 		StringView*		fInternalNameView;
63 		BTextControl*	fTypeNameControl;
64 		BTextControl*	fDescriptionControl;
65 
66 		BBox*			fPreferredBox;
67 		BMenuField*		fPreferredField;
68 		BButton*		fSelectButton;
69 		BButton*		fSameAsButton;
70 
71 		BBox*			fAttributeBox;
72 		AttributeListView* fAttributeListView;
73 		BButton*		fAddAttributeButton;
74 		BButton*		fRemoveAttributeButton;
75 
76 		BWindow*		fNewTypeWindow;
77 };
78 
79 static const uint32 kMsgSelectNewType = 'slnt';
80 static const uint32 kMsgNewTypeWindowClosed = 'ntwc';
81 
82 #endif	// FILE_TYPES_WINDOW_H
83