1 /* 2 * Copyright 2007-2014, Haiku, Inc. 3 * Distributed under the terms of the MIT license. 4 * 5 * Author: 6 * Łukasz 'Sil2100' Zemczak <sil2100@vexillium.org> 7 */ 8 #ifndef PACKAGE_VIEW_H 9 #define PACKAGE_VIEW_H 10 11 12 #include "PackageInfo.h" 13 #include "PackageInstall.h" 14 #include "PackageStatus.h" 15 16 #include <View.h> 17 18 class BBox; 19 class BButton; 20 class BFilePanel; 21 class BMenu; 22 class BMenuField; 23 class BPopUpMenu; 24 class BTextView; 25 26 27 enum { 28 P_MSG_INSTALL_TYPE_CHANGED = 'gpch', 29 P_MSG_PATH_CHANGED, 30 P_MSG_OPEN_PANEL, 31 P_MSG_INSTALL 32 }; 33 34 class PackageView : public BView { 35 public: 36 PackageView(const entry_ref* ref); 37 virtual ~PackageView(); 38 39 virtual void AttachedToWindow(); 40 virtual void MessageReceived(BMessage* message); 41 42 int32 ItemExists(PackageItem& item, 43 BPath& path, int32& policy); 44 CurrentPath()45 BPath* CurrentPath() 46 { return &fCurrentPath; } GetPackageInfo()47 PackageInfo* GetPackageInfo() 48 { return &fInfo; } CurrentType()49 uint32 CurrentType() const 50 { return fCurrentType; } StatusWindow()51 PackageStatus* StatusWindow() 52 { return fStatusWindow; } 53 54 private: 55 void _InitView(); 56 void _InitProfiles(); 57 58 status_t _InstallTypeChanged(int32 index); 59 60 BString _NamePlusSizeString(BString name, 61 size_t size, const char* format) const; 62 BMenuItem* _AddInstallTypeMenuItem(BString baseName, 63 size_t size, int32 index) const; 64 BMenuItem* _AddDestinationMenuItem(BString baseName, 65 size_t size, const char* path) const; 66 BMenuItem* _AddMenuItem(const char* name, 67 BMessage* message, BMenu* menu) const; 68 69 bool _ValidateFilePanelMessage(BMessage* message); 70 71 private: 72 BPopUpMenu* fInstallTypes; 73 BTextView* fInstallTypeDescriptionView; 74 BPopUpMenu* fDestination; 75 BMenuField* fDestField; 76 BButton* fBeginButton; 77 78 BFilePanel* fOpenPanel; 79 bool fExpectingOpenPanelResult; 80 81 BPath fCurrentPath; 82 uint32 fCurrentType; 83 84 PackageInfo fInfo; 85 PackageStatus* fStatusWindow; 86 PackageInstall fInstallProcess; 87 }; 88 89 #endif // PACKAGE_VIEW_H 90 91