OpendTect-6_4  6.4
uifileinput.h
Go to the documentation of this file.
1 #ifndef uifileinput_h
2 #define uifileinput_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A.H. Bril
9  Date: 21/9/2000
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uitoolsmod.h"
16 #include "uigeninput.h"
17 #include "uifiledlg.h"
18 #include "file.h"
19 
20 class uiButton;
21 class BufferStringSet;
22 
34 mExpClass(uiTools) uiFileInput : public uiGenInput
36 public:
37 
38  mExpClass(uiTools) Setup
39  {
40  public:
41  Setup(const char* filenm=0);
42  Setup(uiFileDialog::Type t,const char* filenm=0);
43 
45 
47  mDefSetupMemb(BufferString,defseldir)
48  mDefSetupMemb(bool,forread)
49  mDefSetupMemb(bool,withexamine)
50  mDefSetupMemb(File::ViewStyle,examstyle)
51  mDefSetupMemb(bool,exameditable)
52  mDefSetupMemb(bool,displaylocalpath)
53 
54  mDefSetupMemb(bool,directories)
55  mDefSetupMemb(bool,allowallextensions)
56  mDefSetupMemb(bool,confirmoverwrite)
57  mDefSetupMemb(uiFileDialog::Type,filedlgtype)
58  mDefSetupMemb(uiString,objtype)
59  };
60 
61  uiFileInput(uiParent*,const uiString& seltxt,
62  const char* fnm=0);
63  uiFileInput(uiParent*,const uiString& seltxt,
64  const Setup&);
65  ~uiFileInput();
66 
67  void setFileName(const char*);
68  void setDefaultSelectionDir(const char*);
69  const char* defaultSelectionDir() const { return defseldir_;}
70  void setFilter( const char* fltr ) { filter_ = fltr; }
71  const char* selectedFilter() const { return selfltr_; }
72  void setSelectedFilter( const char* f ) { selfltr_ = f; }
73  void setObjType( const uiString& s ) { objtype_ = s; }
74  void setExamine( const CallBack& cb ) { excb_ = cb; }
76 
77  const char* fileName() const; // Full file path
78  const char* pathOnly() const;
79  const char* baseName() const; // Filename without path and extension
80  void getFileNames(BufferStringSet&) const;
81 
83  {
84  return selmodset_ ? selmode_
85  : (forread_ ? uiFileDialog::ExistingFile
87  }
88 
90  { selmodset_ = true; selmode_ = m; }
91 
92  void setSensitive(bool yn) { setChildrenSensitive(yn); }
93  void enableExamine(bool);
95  void setDefaultExtension(const char* ext);
96  // only when forread is false
97 
98  void selectFile( CallBacker* cb ) { doSelect(cb); }
99 
100 protected:
101 
102  bool forread_;
114 
118 
119  uiButton* examinebut_;
120 
121  virtual void doSelect(CallBacker*);
122  void inputChg(CallBacker*);
123  void examineFile(CallBacker*);
124  void isFinalised(CallBacker*);
125  void fnmEntered(CallBacker*);
126 };
127 
128 
129 #endif
#define mExpClass(module)
Definition: commondefs.h:160
Interface for several file and directory related services.
Definition: file.h:27
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
void selectFile(CallBacker *cb)
Definition: uifileinput.h:98
FixedString Setup()
Definition: keystrs.h:116
uiFileDialog::Type filedlgtype_
Definition: uifileinput.h:117
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
BufferString defaultext_
Definition: uifileinput.h:112
CallBack excb_
Definition: uifileinput.h:111
bool displaylocalpath_
Definition: uifileinput.h:105
void setSelectedFilter(const char *f)
Definition: uifileinput.h:72
A file-name input.
Definition: uifileinput.h:34
Definition: uistring.h:89
Definition: uiparent.h:26
bool addallexts_
Definition: uifileinput.h:107
Set of BufferString objects.
Definition: bufstringset.h:28
BufferString filter_
Definition: uifileinput.h:103
Type
Definition: uifiledlg.h:50
void setObjType(const uiString &s)
Definition: uifileinput.h:73
void setSelectMode(uiFileDialog::Mode m)
Definition: uifileinput.h:89
ViewStyle
Definition: file.h:99
uiFileDialog::Mode selmode_
Definition: uifileinput.h:116
BufferString defseldir_
Definition: uifileinput.h:104
void setFilter(const char *fltr)
Definition: uifileinput.h:70
BufferString selfltr_
Definition: uifileinput.h:106
General Input Element.
Definition: uigeninput.h:58
void setSensitive(bool yn)
Definition: uifileinput.h:92
#define mDefSetupMemb(typ, memb)
Definition: commondefs.h:137
Definition: uifiledlg.h:31
uiButton * examinebut_
Definition: uifileinput.h:119
Definition: uifileinput.h:38
Type
Definition: angles.h:27
Dialog to get a file or directory name from user.
Definition: uifiledlg.h:25
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
const char * selectedFilter() const
Definition: uifileinput.h:71
bool selmodset_
Definition: uifileinput.h:115
uiFileDialog::Mode selectMode() const
Definition: uifileinput.h:82
bool confirmoverwrite_
Definition: uifileinput.h:110
Definition: uifiledlg.h:32
bool forread_
Definition: uifileinput.h:102
BufferString fnm
Definition: uifileinput.h:44
File::ViewStyle examstyle_
Definition: uifileinput.h:108
uiString objtype_
Definition: uifileinput.h:113
CallBacks object-oriented (object + method).
Definition: callback.h:57
Mode
File selection mode.
Definition: uifiledlg.h:29
bool exameditable_
Definition: uifileinput.h:109
void setExamine(const CallBack &cb)
Overrules the simple stand-alone file browser.
Definition: uifileinput.h:74

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019