1 /*
2  * Copyright (C) 2002 - David W. Durham
3  *
4  * This file is part of ReZound, an audio editing application.
5  *
6  * ReZound is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published
8  * by the Free Software Foundation; either version 2 of the License,
9  * or (at your option) any later version.
10  *
11  * ReZound is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
19  */
20 
21 #ifndef __FXDiskEntityParamValue_H__
22 #define __FXDiskEntityParamValue_H__
23 
24 #include "../../config/common.h"
25 #include "fox_compat.h"
26 
27 #include <string>
28 
29 class CNestedDataFile;
30 
31 /*
32 	This widget is added to action dialogs and can be used to select various types
33 	of entities which would reside on disk (i.e. selection of an audio filename,
34 	directory, or just a general filename)
35 */
36 
37 class FXDiskEntityParamValue : public FXVerticalFrame
38 {
39 	FXDECLARE(FXDiskEntityParamValue);
40 
41 public:
42 	enum DiskEntityTypes
43 	{
44 		detAudioFilename,
45 		detGeneralFilename,
46 		detDirectory
47 	};
48 
49 	FXDiskEntityParamValue(FXComposite *p,int opts,const char *name,const string initialEntityName,DiskEntityTypes entityType);
50 	virtual ~FXDiskEntityParamValue();
51 
52 	long onEntityNameTextBoxChange(FXObject *sender,FXSelector sel,void *ptr);
53 	long onBrowseButton(FXObject *sender,FXSelector sel,void *ptr);
54 
55 	const string getEntityName() const;
56 	const bool getOpenAsRaw() const; // the notion of 'raw' is really only applicable for a type of detAudioFilename and can be ignored for other types
57 	void setEntityName(const string entityName,bool openAsRaw=false);
58 
59 	const string getName() const;
60 
61 	void setTipText(const FXString &text);
62 	FXString getTipText() const;
63 
64 	const DiskEntityTypes getEntityType() const;
65 
66 	void readFromFile(const string &prefix,CNestedDataFile *f);
67 	void writeToFile(const string &prefix,CNestedDataFile *f);
68 
69 	enum
70 	{
71 		ID_ENTITYNAME_TEXTBOX=FXVerticalFrame::ID_LAST,
72 		ID_BROWSE_BUTTON,
73 		ID_LAST
74 	};
75 
76 
77 protected:
FXDiskEntityParamValue()78 	FXDiskEntityParamValue() : entityType(detAudioFilename) {}
79 
80 private:
81 	const string name;
82 
83 	const DiskEntityTypes entityType;
84 
85 	FXHorizontalFrame *hFrame;
86 		FXLabel *titleLabel;
87 		FXTextField *entityNameTextBox;
88 		FXButton *browseButton;
89 	FXCheckButton *openAsRawCheckButton;
90 
91 	FXFont *textFont;
92 };
93 
94 #endif
95