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