xref: /haiku/src/apps/expander/ExpanderWindow.h (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
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 			void				SetStatus(BString text);
58 			bool				ValidateDest();
59 
60 private:
61 			BFilePanel*			fSourcePanel;
62 			DirectoryFilePanel*	fDestPanel;
63 			BMenuBar*			fBar;
64 			BMenu*				fMenu;
65 			entry_ref			fSourceRef;
66 			entry_ref			fDestRef;
67 			bool				fSourceChanged;
68 
69 			BButton*			fSourceButton;
70 			BButton*			fDestButton;
71 			BButton*			fExpandButton;
72 			BMenuItem*			fExpandItem;
73 			BMenuItem*			fShowItem;
74 			BMenuItem*			fStopItem;
75 			BMenuItem*			fSourceItem;
76 			BMenuItem*			fDestItem;
77 			BMenuItem*			fPreferencesItem;
78 			BCheckBox*			fShowContents;
79 			BTextControl*		fSourceText;
80 			BTextControl*		fDestText;
81 			BStringView*		fStatusView;
82 			BTextView*			fListingText;
83 
84 			ExpanderThread*		fListingThread;
85 			bool				fListingStarted;
86 
87 			ExpanderThread*		fExpandingThread;
88 			bool				fExpandingStarted;
89 
90 			BMessage			fSettings;
91 			ExpanderPreferences*	fPreferences;
92 			ExpanderRules		fRules;
93 
94 			float				fLongestLine;
95 			float				fLineHeight;
96 			float				fSizeLimit;
97 			float				fPreviousHeight;
98 };
99 
100 #endif /* EXPANDER_WINDOW_H */
101