xref: /haiku/src/preferences/filetypes/ApplicationTypeWindow.h (revision d6a8b3e805b5f5e98c2f22b8305ba48d02fc16c4)
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 APPLICATION_TYPE_WINDOW_H
6 #define APPLICATION_TYPE_WINDOW_H
7 
8 
9 #include "IconView.h"
10 
11 #include <AppFileInfo.h>
12 #include <Mime.h>
13 #include <String.h>
14 #include <Window.h>
15 
16 class BButton;
17 class BCheckBox;
18 class BListView;
19 class BPopUpMenu;
20 class BRadioButton;
21 class BTextControl;
22 class BTextView;
23 
24 class MimeTypeListView;
25 
26 
27 class ApplicationTypeWindow : public BWindow {
28 	public:
29 		ApplicationTypeWindow(BPoint position, const BEntry& entry);
30 		virtual ~ApplicationTypeWindow();
31 
32 		virtual void MessageReceived(BMessage* message);
33 		virtual bool QuitRequested();
34 
35 	private:
36 		BString _Title(const BEntry& entry);
37 		void _SetTo(const BEntry& entry);
38 		void _UpdateAppFlagsEnabled();
39 		void _MakeNumberTextControl(BTextControl* control);
40 		void _Save();
41 
42 		bool _Flags(uint32& flags) const;
43 		BMessage _SupportedTypes() const;
44 		version_info _VersionInfo() const;
45 
46 		void _CheckSaveMenuItem(uint32 flags);
47 		uint32 _NeedsSaving(uint32 flags) const;
48 
49 	private:
50 		struct AppInfo {
51 			BString			signature;
52 			bool			gotFlags;
53 			uint32			flags;
54 			version_info	versionInfo;
55 
56 			BMessage		supportedTypes;
57 
58 			bool			iconChanged;
59 			bool			typeIconsChanged;
60 		};
61 		enum {
62 			CHECK_SIGNATUR			= 1 << 0,
63 			CHECK_FLAGS				= 1 << 1,
64 			CHECK_VERSION			= 1 << 2,
65 			CHECK_ICON				= 1 << 3,
66 
67 			CHECK_TYPES				= 1 << 4,
68 			CHECK_TYPE_ICONS		= 1 << 5,
69 
70 			CHECK_ALL				= 0xffffffff
71 		};
72 
73 	private:
74 		BEntry			fEntry;
75 		AppInfo			fOriginalInfo;
76 
77 		BTextControl*	fSignatureControl;
78 		IconView*		fIconView;
79 		Icon			fIcon;
80 
81 		BCheckBox*		fFlagsCheckBox;
82 		BRadioButton*	fSingleLaunchButton;
83 		BRadioButton*	fMultipleLaunchButton;
84 		BRadioButton*	fExclusiveLaunchButton;
85 		BCheckBox*		fArgsOnlyCheckBox;
86 		BCheckBox*		fBackgroundAppCheckBox;
87 
88 		BListView*		fTypeListView;
89 		BButton*		fAddTypeButton;
90 		BButton*		fRemoveTypeButton;
91 		IconView*		fTypeIconView;
92 
93 		BTextControl*	fMajorVersionControl;
94 		BTextControl*	fMiddleVersionControl;
95 		BTextControl*	fMinorVersionControl;
96 		BPopUpMenu*		fVarietyMenu;
97 		BTextControl*	fInternalVersionControl;
98 		BTextControl*	fShortDescriptionControl;
99 		BTextView*		fLongDescriptionView;
100 
101 		BMenuItem*		fSaveMenuItem;
102 		uint32			fChangedProperties;
103 };
104 
105 #endif // APPLICATION_TYPE_WINDOW_H
106