xref: /haiku/src/preferences/filetypes/FileTypesWindow.h (revision f793ebf4db716f31e32e86b83fe9160bbfb04e70)
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 TypeIconView;
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 _UpdatePreferredApps(BMimeType* type);
40 		void _UpdateIcon(BMimeType* type);
41 		void _SetType(BMimeType* type, int32 forceUpdate = 0);
42 
43 	private:
44 		BMimeType		fCurrentType;
45 
46 		MimeTypeListView* fTypeListView;
47 		BButton*		fRemoveTypeButton;
48 
49 		TypeIconView*	fIconView;
50 
51 		BListView*		fExtensionListView;
52 		BButton*		fAddExtensionButton;
53 		BButton*		fRemoveExtensionButton;
54 
55 		StringView*		fInternalNameView;
56 		BTextControl*	fTypeNameControl;
57 		BTextControl*	fDescriptionControl;
58 
59 		BMenuField*		fPreferredField;
60 		BButton*		fSelectButton;
61 		BButton*		fSameAsButton;
62 
63 		AttributeListView* fAttributeListView;
64 		BButton*		fAddAttributeButton;
65 		BButton*		fRemoveAttributeButton;
66 
67 		BWindow*		fNewTypeWindow;
68 };
69 
70 static const uint32 kMsgPreferredAppOpened = 'paOp';
71 static const uint32 kMsgSamePreferredAppAsOpened = 'spaO';
72 
73 static const uint32 kMsgSelectNewType = 'slnt';
74 static const uint32 kMsgNewTypeWindowClosed = 'ntwc';
75 
76 
77 extern void error_alert(const char* message, status_t status = B_OK,
78 	alert_type type = B_WARNING_ALERT);
79 
80 #endif	// FILE_TYPES_WINDOW_H
81