xref: /haiku/src/apps/expander/ExpanderWindow.h (revision b289aaf66bbf6e173aa90fa194fc256965f1b34d)
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  *		Karsten Heimrich <host.haiku@gmx.de>
8  */
9 #ifndef EXPANDER_WINDOW_H
10 #define EXPANDER_WINDOW_H
11 
12 
13 #include <Window.h>
14 
15 
16 #include "DirectoryFilePanel.h"
17 #include "ExpanderRules.h"
18 
19 
20 class BCheckBox;
21 class BMenu;
22 class BLayout;
23 class BStringView;
24 class BTextControl;
25 class BTextView;
26 
27 class ExpanderThread;
28 class ExpanderPreferences;
29 
30 
31 class ExpanderWindow : public BWindow {
32 public:
33 								ExpanderWindow(BRect frameRect,
34 									const entry_ref* ref, BMessage* settings);
35 	virtual						~ExpanderWindow();
36 
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 			void				_AddMenuBar(BLayout* layout);
45 			bool				CanQuit();
46 				// returns true if the window can be closed safely, false if not
47 			void				CloseWindowOrKeepOpen();
48 			void				OpenDestFolder();
49 			void				AutoListing();
50 			void				AutoExpand();
51 			void				StartExpanding();
52 			void				StopExpanding();
53 			void				_UpdateWindowSize(bool showContents);
54 			void				_ExpandListingText();
55 			void				StartListing();
56 			void				StopListing();
57 			bool				ValidateDest();
58 
59 private:
60 			BFilePanel*			fSourcePanel;
61 			DirectoryFilePanel*	fDestPanel;
62 			BMenuBar*			fBar;
63 			BMenu*				fMenu;
64 			entry_ref			fSourceRef;
65 			entry_ref			fDestRef;
66 			bool				fSourceChanged;
67 
68 			BButton*			fSourceButton;
69 			BButton*			fDestButton;
70 			BButton*			fExpandButton;
71 			BMenuItem*			fExpandItem;
72 			BMenuItem*			fShowItem;
73 			BMenuItem*			fStopItem;
74 			BMenuItem*			fSourceItem;
75 			BMenuItem*			fDestItem;
76 			BMenuItem*			fPreferencesItem;
77 			BCheckBox*			fShowContents;
78 			BTextControl*		fSourceText;
79 			BTextControl*		fDestText;
80 			BStringView*		fStatusView;
81 			BTextView*			fListingText;
82 
83 			ExpanderThread*		fListingThread;
84 			bool				fListingStarted;
85 
86 			ExpanderThread*		fExpandingThread;
87 			bool				fExpandingStarted;
88 
89 			BMessage			fSettings;
90 			ExpanderPreferences*	fPreferences;
91 			ExpanderRules		fRules;
92 
93 			float				fLongestLine;
94 			float				fLineHeight;
95 			float				fSizeLimit;
96 			float				fPreviousHeight;
97 };
98 
99 #endif /* EXPANDER_WINDOW_H */
100