xref: /haiku/src/preferences/filetypes/FileTypesWindow.h (revision 041ea260089705137d559753470b0eec731e5640)
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 BButton;
14 class BListView;
15 class BMenuField;
16 class BMimeType;
17 class BOutlineListView;
18 class BTextControl;
19 
20 class AttributeListView;
21 class IconView;
22 class MimeTypeListView;
23 class StringView;
24 
25 
26 class FileTypesWindow : public BWindow {
27 	public:
28 		FileTypesWindow(BRect frame);
29 		virtual ~FileTypesWindow();
30 
31 		virtual void MessageReceived(BMessage* message);
32 		virtual bool QuitRequested();
33 
34 		void PlaceSubWindow(BWindow* window);
35 
36 	private:
37 		void _UpdateExtensions(BMimeType* type);
38 		void _AdoptPreferredApplication(BMessage* message, bool sameAs);
39 		void _AddSignature(BMenuItem* item, const char* signature);
40 		BMenuItem* _CreateApplicationItem(const char* signature);
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 		IconView*		fIconView;
52 
53 		BListView*		fExtensionListView;
54 		BButton*		fAddExtensionButton;
55 		BButton*		fRemoveExtensionButton;
56 
57 		StringView*		fInternalNameView;
58 		BTextControl*	fTypeNameControl;
59 		BTextControl*	fDescriptionControl;
60 
61 		BMenuField*		fPreferredField;
62 		BButton*		fSelectButton;
63 		BButton*		fSameAsButton;
64 
65 		AttributeListView* fAttributeListView;
66 		BButton*		fAddAttributeButton;
67 		BButton*		fRemoveAttributeButton;
68 
69 		BWindow*		fNewTypeWindow;
70 };
71 
72 static const uint32 kMsgPreferredAppOpened = 'paOp';
73 static const uint32 kMsgSamePreferredAppAsOpened = 'spaO';
74 
75 static const uint32 kMsgSelectNewType = 'slnt';
76 static const uint32 kMsgNewTypeWindowClosed = 'ntwc';
77 
78 
79 extern void error_alert(const char* message, status_t status = B_OK,
80 	alert_type type = B_WARNING_ALERT);
81 
82 #endif	// FILE_TYPES_WINDOW_H
83