xref: /haiku/src/apps/expander/ExpanderWindow.h (revision ed24eb5ff12640d052171c6a7feba37fab8a75d1)
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 class StatusView;
31 
32 
33 class ExpanderWindow : public BWindow {
34 public:
35 								ExpanderWindow(BRect frameRect,
36 									const entry_ref* ref, BMessage* settings);
37 	virtual						~ExpanderWindow();
38 
39 	virtual	void				MessageReceived(BMessage* message);
40 	virtual	bool				QuitRequested();
41 
42 //			void				SetRef(const entry_ref* ref);
43 			void				RefsReceived(BMessage* message);
44 
45 private:
46 			void				_CreateMenuBar();
47 			bool				CanQuit();
48 				// returns true if the window can be closed safely, false if not
49 			void				CloseWindowOrKeepOpen();
50 			void				OpenDestFolder();
51 			void				AutoListing();
52 			void				AutoExpand();
53 			void				StartExpanding();
54 			void				StopExpanding();
55 			void				_UpdateWindowSize(bool showContents);
56 			void				_ExpandListingText();
57 			void				StartListing();
58 			void				StopListing();
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 			StatusView*		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