1#ifndef _ZIPOMATIC_WINDOW_H
2#define _ZIPOMATIC_WINDOW_H
3
4
5#include <Button.h>
6#include <List.h>
7#include <Rect.h>
8#include <StringView.h>
9#include <Window.h>
10
11#include "ZipOMaticActivity.h"
12#include "ZipperThread.h"
13
14
15enum direction {
16	up,
17	down,
18	left,
19	right
20};
21
22
23class ZippoWindow : public BWindow
24{
25public:
26							ZippoWindow(BList windowList,
27								bool keepOpen = false);
28							~ZippoWindow();
29
30	virtual	void			MessageReceived(BMessage* message);
31	virtual	bool			QuitRequested();
32
33			bool			IsZipping();
34			void			StopZipping();
35
36private:
37
38			void			_StartZipping(BMessage* message);
39			void			_CloseWindowOrKeepOpen();
40
41			void			_FindBestPlacement();
42			void			_OffsetRect(BRect* rect, direction whereTo);
43			void			_OffscreenBounceBack(BRect* rect,
44								direction* primaryDirection,
45								direction secondaryDirection);
46			BRect			_NearestRect(BRect goalRect, BRect a, BRect b);
47
48			BList			fWindowList;
49
50			Activity*		fActivityView;
51			BStringView*	fArchiveNameView;
52			BStringView*	fZipOutputView;
53			BButton*		fStopButton;
54
55			ZipperThread*	fThread;
56			BString			fArchiveName;
57
58			bool			fKeepOpen;
59			bool			fZippingWasStopped;
60			int32			fFileCount;
61
62			BInvoker*		fWindowInvoker;
63};
64
65#endif	// _ZIPOMATIC_WINDOW_H
66
67