xref: /haiku/src/apps/expander/ExpanderWindow.h (revision 35c09220cc37a3bab64c9766f936d95a4c5f4dd3)
1 /*
2  * Copyright 2004-2006, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Jérôme Duval
7  */
8 #ifndef EXPANDER_WINDOW_H
9 #define EXPANDER_WINDOW_H
10 
11 
12 #include <Window.h>
13 
14 
15 #include "DirectoryFilePanel.h"
16 #include "ExpanderRules.h"
17 
18 
19 class BCheckBox;
20 class BMenu;
21 class BScrollView;
22 class BStringView;
23 class BTextControl;
24 class BTextView;
25 
26 class ExpanderThread;
27 class ExpanderPreferences;
28 
29 
30 class ExpanderWindow : public BWindow {
31 public:
32 								ExpanderWindow(BRect frameRect,
33 									const entry_ref* ref, BMessage* settings);
34 	virtual						~ExpanderWindow();
35 
36 	virtual	void				FrameResized(float width, float height);
37 	virtual	void				MessageReceived(BMessage* msg);
38 	virtual	bool				QuitRequested();
39 
40 			void				SetRef(const entry_ref* ref);
41 			void				RefsReceived(BMessage* msg);
42 
43 private:
44 			bool				CanQuit();
45 				// returns true if the window can be closed safely, false if not
46 			void				CloseWindowOrKeepOpen();
47 			void				OpenDestFolder();
48 			void				AutoListing();
49 			void				AutoExpand();
50 			void				StartExpanding();
51 			void				StopExpanding();
52 			void				_UpdateWindowSize(bool showContents);
53 			void				StartListing();
54 			void				StopListing();
55 			bool				ValidateDest();
56 
57 private:
58 			BFilePanel*			fSourcePanel;
59 			DirectoryFilePanel*	fDestPanel;
60 			BMenuBar*			fBar;
61 			BMenu*				fMenu;
62 			entry_ref			fSourceRef;
63 			entry_ref			fDestRef;
64 			bool				fSourceChanged;
65 
66 			BButton*			fSourceButton;
67 			BButton*			fDestButton;
68 			BButton*			fExpandButton;
69 			BMenuItem*			fExpandItem;
70 			BMenuItem*			fShowItem;
71 			BMenuItem*			fStopItem;
72 			BMenuItem*			fSourceItem;
73 			BMenuItem*			fDestItem;
74 			BMenuItem*			fPreferencesItem;
75 			BCheckBox*			fShowContents;
76 			BTextControl*		fSourceText;
77 			BTextControl*		fDestText;
78 			BStringView*		fStatusView;
79 			BTextView*			fListingText;
80 			BScrollView*		fListingScroll;
81 
82 			ExpanderThread*		fListingThread;
83 			bool				fListingStarted;
84 
85 			ExpanderThread*		fExpandingThread;
86 			bool				fExpandingStarted;
87 
88 			BMessage			fSettings;
89 			ExpanderPreferences*	fPreferences;
90 			ExpanderRules		fRules;
91 
92 			float				fLargestDelta;
93 };
94 
95 #endif /* EXPANDER_WINDOW_H */
96