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
14class BBox;
15class BButton;
16class BListView;
17class BMenuField;
18class BMimeType;
19class BOutlineListView;
20class BSplitView;
21class BTextControl;
22
23class AttributeListView;
24class ExtensionListView;
25class MimeTypeListView;
26class StringView;
27class TypeIconView;
28
29
30static const uint32 kMsgSelectNewType = 'slnt';
31static const uint32 kMsgNewTypeWindowClosed = 'ntwc';
32
33
34class FileTypesWindow : public BWindow {
35public:
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
46private:
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
58private:
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