xref: /haiku/src/preferences/filetypes/FileTypesWindow.h (revision ba499cdc3336fb89429027418871bf263f1f5e14)
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 ExtensionListView;
23 class TypeIconView;
24 class MimeTypeListView;
25 class StringView;
26 
27 
28 class FileTypesWindow : public BWindow {
29 	public:
30 		FileTypesWindow(const BMessage& settings);
31 		virtual ~FileTypesWindow();
32 
33 		virtual void MessageReceived(BMessage* message);
34 		virtual bool QuitRequested();
35 
36 		void PlaceSubWindow(BWindow* window);
37 
38 	private:
39 		BRect _Frame(const BMessage& settings) const;
40 		void _ShowSnifferRule(bool show);
41 		void _UpdateExtensions(BMimeType* type);
42 		void _AdoptPreferredApplication(BMessage* message, bool sameAs);
43 		void _UpdatePreferredApps(BMimeType* type);
44 		void _UpdateIcon(BMimeType* type);
45 		void _SetType(BMimeType* type, int32 forceUpdate = 0);
46 
47 	private:
48 		BMimeType		fCurrentType;
49 
50 		MimeTypeListView* fTypeListView;
51 		BButton*		fRemoveTypeButton;
52 
53 		BBox*			fIconBox;
54 		TypeIconView*	fIconView;
55 
56 		BBox*			fRecognitionBox;
57 		StringView*		fExtensionLabel;
58 		ExtensionListView* fExtensionListView;
59 		BButton*		fAddExtensionButton;
60 		BButton*		fRemoveExtensionButton;
61 		BTextControl*	fRuleControl;
62 
63 		BBox*			fDescriptionBox;
64 		StringView*		fInternalNameView;
65 		BTextControl*	fTypeNameControl;
66 		BTextControl*	fDescriptionControl;
67 
68 		BBox*			fPreferredBox;
69 		BMenuField*		fPreferredField;
70 		BButton*		fSelectButton;
71 		BButton*		fSameAsButton;
72 
73 		BBox*			fAttributeBox;
74 		AttributeListView* fAttributeListView;
75 		BButton*		fAddAttributeButton;
76 		BButton*		fRemoveAttributeButton;
77 
78 		BWindow*		fNewTypeWindow;
79 };
80 
81 static const uint32 kMsgSelectNewType = 'slnt';
82 static const uint32 kMsgNewTypeWindowClosed = 'ntwc';
83 
84 #endif	// FILE_TYPES_WINDOW_H
85