xref: /haiku/src/apps/webpositive/DownloadWindow.h (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 /*
2  * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
3  *
4  * All rights reserved. Distributed under the terms of the MIT License.
5  */
6 #ifndef DOWNLOAD_WINDOW_H
7 #define DOWNLOAD_WINDOW_H
8 
9 
10 #include <String.h>
11 #include <Window.h>
12 
13 class BButton;
14 class BFile;
15 class BGroupLayout;
16 class BScrollView;
17 class BWebDownload;
18 class SettingsMessage;
19 
20 
21 class DownloadWindow : public BWindow {
22 public:
23 								DownloadWindow(BRect frame, bool visible,
24 									SettingsMessage* settings);
25 	virtual						~DownloadWindow();
26 
27 	virtual	void				DispatchMessage(BMessage* message,
28 									BHandler* target);
29 	virtual void				FrameResized(float newWidth, float newHeight);
30 	virtual	void				MessageReceived(BMessage* message);
31 	virtual	bool				QuitRequested();
32 
33 			bool				DownloadsInProgress();
34 			void				SetMinimizeOnClose(bool minimize);
35 
36 private:
37 			void				_DownloadStarted(BWebDownload* download);
38 			void				_DownloadFinished(BWebDownload* download);
39 			void				_RemoveFinishedDownloads();
40 			void				_RemoveMissingDownloads();
41 			void				_ValidateButtonStatus();
42 			void				_SaveSettings();
43 			void				_LoadSettings();
44 			bool				_OpenSettingsFile(BFile& file, uint32 mode);
45 
46 private:
47 			BScrollView*		fDownloadsScrollView;
48 			BGroupLayout*		fDownloadViewsLayout;
49 			BButton*			fRemoveFinishedButton;
50 			BButton*			fRemoveMissingButton;
51 			BString				fDownloadPath;
52 			bool				fMinimizeOnClose;
53 };
54 
55 #endif // DOWNLOAD_WINDOW_H
56