1 /*****************************************************************************/ 2 // Expander 3 // Written by Jérôme Duval 4 // 5 // ExpanderWindow.h 6 // 7 // 8 // Copyright (c) 2004 OpenBeOS Project 9 // 10 // Permission is hereby granted, free of charge, to any person obtaining a 11 // copy of this software and associated documentation files (the "Software"), 12 // to deal in the Software without restriction, including without limitation 13 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 // and/or sell copies of the Software, and to permit persons to whom the 15 // Software is furnished to do so, subject to the following conditions: 16 // 17 // The above copyright notice and this permission notice shall be included 18 // in all copies or substantial portions of the Software. 19 // 20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 23 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 26 // DEALINGS IN THE SOFTWARE. 27 /*****************************************************************************/ 28 29 #ifndef _ExpanderWindow_h 30 #define _ExpanderWindow_h 31 32 #include <CheckBox.h> 33 #include <Window.h> 34 #include <FilePanel.h> 35 #include <TextControl.h> 36 #include <ScrollView.h> 37 #include "DirectoryFilePanel.h" 38 #include "ExpanderRules.h" 39 40 class ExpanderThread; 41 class ExpanderPreferences; 42 43 class ExpanderWindow : public BWindow { 44 public: 45 ExpanderWindow(BRect frameRect, const entry_ref *ref, BMessage *settings); 46 virtual ~ExpanderWindow(); 47 48 virtual void FrameResized(float width, float height); 49 virtual void MessageReceived(BMessage *msg); 50 virtual bool QuitRequested(); 51 52 void SetRef(const entry_ref *ref); 53 void RefsReceived(BMessage *msg); 54 55 private: 56 bool CanQuit(); 57 // returns true if the window can be closed safely, false if not 58 void CloseWindowOrKeepOpen(); 59 void OpenDestFolder(); 60 void AutoListing(); 61 void AutoExpand(); 62 void StartExpanding(); 63 void StopExpanding(); 64 void StartListing(); 65 void StopListing(); 66 67 BFilePanel *fSourcePanel; 68 DirectoryFilePanel *fDestPanel; 69 BMenuBar *fBar; 70 BMenu *fMenu; 71 entry_ref fSourceRef; 72 entry_ref fDestRef; 73 bool fSourceChanged; 74 75 BButton *fSourceButton, *fDestButton, *fExpandButton; 76 BMenuItem *fExpandItem, *fShowItem, *fStopItem, 77 *fSourceItem, *fDestItem, *fPreferencesItem; 78 BCheckBox *fShowContents; 79 BTextControl *fSourceText, *fDestText; 80 BTextView *fExpandedText, *fListingText; 81 BScrollView *fListingScroll; 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 94 #endif /* _ExpanderWindow_h */ 95