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 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 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