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