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