xref: /haiku/src/apps/webpositive/DownloadWindow.h (revision e07fc6b71df68266b262583b4d9ca43138ea6c9f)
175ffc858Sstippi /*
275ffc858Sstippi  * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
375ffc858Sstippi  *
475ffc858Sstippi  * All rights reserved.
575ffc858Sstippi  *
675ffc858Sstippi  * Redistribution and use in source and binary forms, with or without
775ffc858Sstippi  * modification, are permitted provided that the following conditions
875ffc858Sstippi  * are met:
975ffc858Sstippi  * 1. Redistributions of source code must retain the above copyright
1075ffc858Sstippi  *    notice, this list of conditions and the following disclaimer.
1175ffc858Sstippi  * 2. Redistributions in binary form must reproduce the above copyright
1275ffc858Sstippi  *    notice, this list of conditions and the following disclaimer in the
1375ffc858Sstippi  *    documentation and/or other materials provided with the distribution.
1475ffc858Sstippi  *
1575ffc858Sstippi  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
1675ffc858Sstippi  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1775ffc858Sstippi  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1875ffc858Sstippi  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
1975ffc858Sstippi  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
2075ffc858Sstippi  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
2175ffc858Sstippi  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
2275ffc858Sstippi  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
2375ffc858Sstippi  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2475ffc858Sstippi  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2575ffc858Sstippi  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2675ffc858Sstippi  */
279ccfda9cSstippi #ifndef DOWNLOAD_WINDOW_H
289ccfda9cSstippi #define DOWNLOAD_WINDOW_H
2975ffc858Sstippi 
3075ffc858Sstippi 
31636f175bSstippi #include <String.h>
3275ffc858Sstippi #include <Window.h>
3375ffc858Sstippi 
34dd275f31Sstippi class BButton;
35a8d8342dSstippi class BFile;
36dd275f31Sstippi class BGroupLayout;
3798b056e1Sstippi class BScrollView;
38c516096eSstippi class BWebDownload;
39636f175bSstippi class SettingsMessage;
404b059d47Sstippi 
419ccfda9cSstippi 
4275ffc858Sstippi class DownloadWindow : public BWindow {
4375ffc858Sstippi public:
44636f175bSstippi 								DownloadWindow(BRect frame, bool visible,
45636f175bSstippi 									SettingsMessage* settings);
4675ffc858Sstippi 	virtual						~DownloadWindow();
4775ffc858Sstippi 
48*e07fc6b7Sstippi 	virtual	void				DispatchMessage(BMessage* message,
49*e07fc6b7Sstippi 									BHandler* target);
509ccfda9cSstippi 	virtual	void				MessageReceived(BMessage* message);
5175ffc858Sstippi 	virtual	bool				QuitRequested();
5275ffc858Sstippi 
53dd275f31Sstippi private:
549ccfda9cSstippi 			void				_DownloadStarted(BWebDownload* download);
559ccfda9cSstippi 			void				_DownloadFinished(BWebDownload* download);
569ccfda9cSstippi 			void				_RemoveFinishedDownloads();
57f28abe9dSstippi 			void				_RemoveMissingDownloads();
58c5d7a6c9Sstippi 			void				_ValidateButtonStatus();
599ccfda9cSstippi 			void				_SaveSettings();
609ccfda9cSstippi 			void				_LoadSettings();
619ccfda9cSstippi 			bool				_OpenSettingsFile(BFile& file, uint32 mode);
624b059d47Sstippi 
6375ffc858Sstippi private:
6498b056e1Sstippi 			BScrollView*		fDownloadsScrollView;
659ccfda9cSstippi 			BGroupLayout*		fDownloadViewsLayout;
669ccfda9cSstippi 			BButton*			fRemoveFinishedButton;
67f28abe9dSstippi 			BButton*			fRemoveMissingButton;
68636f175bSstippi 			BString				fDownloadPath;
6975ffc858Sstippi };
7075ffc858Sstippi 
719ccfda9cSstippi #endif // DOWNLOAD_WINDOW_H
72