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