xref: /haiku/src/apps/expander/ExpanderWindow.h (revision 56430ad8002b8fd1ac69b590e9cc130de6d9e852)
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 BScrollView;
24 class BStringView;
25 class BTextControl;
26 class BTextView;
27 
28 class ExpanderThread;
29 class ExpanderPreferences;
30 
31 
32 class ExpanderWindow : public BWindow {
33 public:
34 								ExpanderWindow(BRect frameRect,
35 									const entry_ref* ref, BMessage* settings);
36 	virtual						~ExpanderWindow();
37 
38 	virtual	void				MessageReceived(BMessage* message);
39 	virtual	bool				QuitRequested();
40 
41 //			void				SetRef(const entry_ref* ref);
42 			void				RefsReceived(BMessage* message);
43 
44 private:
45 			void				_CreateMenuBar();
46 			bool				CanQuit();
47 				// returns true if the window can be closed safely, false if not
48 			void				CloseWindowOrKeepOpen();
49 			void				OpenDestFolder();
50 			void				AutoListing();
51 			void				AutoExpand();
52 			void				StartExpanding();
53 			void				StopExpanding();
54 			void				_UpdateWindowSize(bool showContents);
55 			void				_ExpandListingText();
56 			void				StartListing();
57 			void				StopListing();
58 			void				SetStatus(BString text);
59 			bool				ValidateDest();
60 
61 private:
62 			BFilePanel*			fSourcePanel;
63 			DirectoryFilePanel*	fDestPanel;
64 			BMenuBar*			fBar;
65 			BMenu*				fMenu;
66 			entry_ref			fSourceRef;
67 			entry_ref			fDestRef;
68 			bool				fSourceChanged;
69 
70 			BButton*			fSourceButton;
71 			BButton*			fDestButton;
72 			BButton*			fExpandButton;
73 			BMenuItem*			fExpandItem;
74 			BMenuItem*			fShowItem;
75 			BMenuItem*			fStopItem;
76 			BMenuItem*			fSourceItem;
77 			BMenuItem*			fDestItem;
78 			BMenuItem*			fPreferencesItem;
79 			BCheckBox*			fShowContents;
80 			BTextControl*		fSourceText;
81 			BTextControl*		fDestText;
82 			BStringView*		fStatusView;
83 			BTextView*			fListingText;
84 			BScrollView*		fScrollView;
85 
86 			ExpanderThread*		fListingThread;
87 			bool				fListingStarted;
88 
89 			ExpanderThread*		fExpandingThread;
90 			bool				fExpandingStarted;
91 
92 			BMessage			fSettings;
93 			ExpanderPreferences*	fPreferences;
94 			ExpanderRules		fRules;
95 
96 			float				fLongestLine;
97 			float				fLineHeight;
98 			float				fSizeLimit;
99 			float				fPreviousHeight;
100 };
101 
102 
103 #endif	// _EXPANDER_WINDOW_H
104