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