1 /* 2 * Copyright 2005, Jérôme DUVAL. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 #ifndef _InstallerWindow_h 7 #define _InstallerWindow_h 8 9 #include <Box.h> 10 #include <Button.h> 11 #include <Menu.h> 12 #include <MenuField.h> 13 #include <ScrollView.h> 14 #include <String.h> 15 #include <TextView.h> 16 #include <Window.h> 17 #include "CopyEngine.h" 18 #include "DrawButton.h" 19 #include "PackageViews.h" 20 21 #define INSTALLER_RIGHT 402 22 23 enum InstallStatus { 24 kReadyForInstall, 25 kInstalling, 26 kFinished, 27 kCancelled 28 }; 29 30 const uint32 STATUS_MESSAGE = 'iSTM'; 31 const uint32 INSTALL_FINISHED = 'iIFN'; 32 const uint32 RESET_INSTALL = 'iRSI'; 33 const char PACKAGES_DIRECTORY[] = "_packages_"; 34 const char VAR_DIRECTORY[] = "var"; 35 36 class InstallerWindow : public BWindow { 37 public: 38 InstallerWindow(BRect frameRect); 39 virtual ~InstallerWindow(); 40 41 virtual void MessageReceived(BMessage *msg); 42 virtual bool QuitRequested(); 43 BMenu *GetSourceMenu() { return fSrcMenu; }; 44 BMenu *GetTargetMenu() { return fDestMenu; }; 45 private: 46 void DisableInterface(bool disable); 47 void LaunchDriveSetup(); 48 void PublishPackages(); 49 void ShowBottom(); 50 void StartScan(); 51 void AdjustMenus(); 52 void SetStatusMessage(const char *text); 53 static int ComparePackages(const void *firstArg, const void *secondArg); 54 BBox *fBackBox; 55 BButton *fBeginButton, *fSetupButton; 56 DrawButton *fDrawButton; 57 bool fDriveSetupLaunched; 58 InstallStatus fInstallStatus; 59 BTextView *fStatusView; 60 BMenu* fSrcMenu, *fDestMenu; 61 BMenuField* fSrcMenuField, *fDestMenuField; 62 PackagesView *fPackagesView; 63 BScrollView *fPackagesScrollView; 64 BStringView *fSizeView; 65 66 BBitmap *fLogo; 67 BPoint fDrawPoint; 68 CopyEngine *fCopyEngine; 69 BString fLastStatus; 70 BMenuItem *fLastSrcItem, *fLastTargetItem; 71 }; 72 73 #endif /* _InstallerWindow_h */ 74