OpendTect  6.3
uiioobjsel.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: A.H. Bril
8  Date: April 2001
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "uiiocommon.h"
14 #include "uiiosel.h"
15 #include "helpview.h"
16 
17 class IOObj;
18 class CtxtIOObj;
19 class IOObjContext;
20 class uiIOObjRetDlg;
21 class uiIOObjInserter;
23 
24 
38 public:
39 
40  mExpClass(uiIo) Setup : public uiIOSelect::Setup
41  {
42  public:
44  : uiIOSelect::Setup(seltext)
45  , confirmoverwr_(true)
46  , withinserters_(true)
47  , withwriteopts_(true)
48  , filldef_(true) {}
49 
50  mDefSetupMemb(bool,confirmoverwr)
51  mDefSetupMemb(bool,withinserters)
52  mDefSetupMemb(bool,withwriteopts)
53  mDefSetupMemb(bool,filldef)
54  };
55 
57  const uiString& seltxt=uiString::emptyString());
58  uiIOObjSel(uiParent*,const IOObjContext&,const Setup&);
59  ~uiIOObjSel();
60 
61  virtual bool forRead() const;
62 
63  void setInput(const IOObj&);
64  void setInput(const DBKey&);
65  virtual void setEmpty();
66 
67  DBKey key(bool noerr=false) const;
68  const IOObj* ioobj(bool noerr=false) const;
69  IOObj* getIOObj(bool noerr=false);
70 
71  virtual bool fillPar(IOPar&) const;
72  bool fillPar(IOPar&,const char* baseky) const;
73  virtual void usePar(const IOPar&);
74  void usePar(const IOPar&,const char* baseky);
75 
76  void fillEntries();
77  void setConfirmOverwrite( bool yn )
78  { setup_.confirmoverwr_ = yn; }
79  void setHelpKey(const HelpKey& helpkey) { helpkey_=helpkey; }
80 
81  virtual void updateInput();
82  virtual void processInput();
83  virtual bool existingTyped() const
85  { return existingUsrName(getInput()); }
88 
89  virtual DBKey getKeyOnly() const;
90  virtual uiObject* endObj(bool left);
91 
92  static IOObjContext getWriteIOObjCtxt(IOObjContext);
93 
94  void fullUpdate() { initRead(); }
95 
96 protected:
97 
99 
102  Setup setup_;
107 
108  void preFinaliseCB(CallBacker*);
109  void doObjSel(CallBacker*);
110  void objInserted(CallBacker*);
111  void survChangedCB(CallBacker*);
112  void dbmChgCB(CallBacker*);
113  void initRead();
114 
115  virtual const char* userNameFromKey(const char*) const;
116  virtual void objSel();
117  virtual void commitSucceeded() {}
118 
119  virtual void fillDefault();
120  virtual void newSelection(uiIOObjRetDlg*) {}
121  virtual uiIOObjRetDlg* mkDlg();
122  virtual IOObj* createEntry(const char*);
123  void obtainIOObj();
124  bool existingUsrName(const char*) const;
125  void doCommit(bool) const;
126 
127 private:
128 
129  void init();
130 
131 public: // old style
132 
133  /* Comments for old style only:
134 On creation, the object makes a copy of your CtxtIOObj. When needed, you can do
135 commitInput() to get the selection in your input CtxtIOObj;
136 
137 You *have* to do commitInput() to get any selection! Other functions like
138 processInput() are special stuff for special situations.
139 
140 You have to check commitInput() and issue and error message if necessary. In
141 the new style, this is done if the setup.optional_ flag is false (this is the
142 default).
143 */
144 
146  const uiString& seltxt=uiString::emptyString());
147  uiIOObjSel(uiParent*,CtxtIOObj&,const Setup&);
148  bool commitInput();
149  bool doCommitInput(bool&);
150  CtxtIOObj& ctxtIOObj( bool work=false )
151  { return work ? workctio_ : inctio_; }
152 
153 };
154 
155 
156 #define mWriteIOObjContext(clss) \
157  uiIOObjSel::getWriteIOObjCtxt(mIOObjContext(clss))
158 #define mRWIOObjContext(clss,forread) \
159  (forread ? mIOObjContext(clss) : mWriteIOObjContext(clss))
#define mExpClass(module)
Definition: commondefs.h:157
bool dbmpushed_
Definition: uiioobjsel.h:105
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:182
Definition: ioobj.h:57
Definition: uiioobjsel.h:40
#define mODTextTranslationClass(clss)
Definition: uistring.h:37
Dialog letting the user select an object. It returns an IOObj* after successful go().
Definition: uiioobjseldlg.h:20
virtual void newSelection(uiIOObjRetDlg *)
Definition: uiioobjsel.h:120
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:200
Setup(const uiString &seltext=uiString::emptyString())
Definition: uiioobjsel.h:43
Definition: i_layout.h:26
bool init()
static const uiString & emptyString()
Definition: uistring.h:107
The base class for most UI elements.
Definition: uiobj.h:35
virtual void commitSucceeded()
Definition: uiioobjsel.h:117
Definition: uistring.h:88
CtxtIOObj & ctxtIOObj(bool work=false)
Definition: uiioobjsel.h:150
Definition: uiparent.h:24
Definition: helpview.h:47
Holds an IOObjCtxt plus a pointer to an IOObj and/or an IOPar.
Definition: ctxtioobj.h:24
HelpKey helpkey_
Definition: uiioobjsel.h:103
uiIOObjSelWriteTranslator * wrtrselfld_
Definition: uiioobjsel.h:98
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
CtxtIOObj & inctio_
Definition: uiioobjsel.h:100
inserts a new object into the OD data store.
Definition: uiioobjinserter.h:30
bool inctiomine_
Definition: uiioobjsel.h:104
#define mDefSetupMemb(typ, memb)
Definition: commondefs.h:129
User Interface (UI) element for selection of IOObjs.
Definition: uiioobjsel.h:36
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:187
void setConfirmOverwrite(bool yn)
Definition: uiioobjsel.h:77
ObjectSet< uiIOObjInserter > inserters_
Definition: uiioobjsel.h:106
Group for selecting output translator.
Definition: uiioobjselwritetransl.h:78
Full key to any object in the OpendTect data store.
Definition: dbkey.h:36
Setup setup_
Definition: uiioobjsel.h:102
void fullUpdate()
Definition: uiioobjsel.h:94
CtxtIOObj & workctio_
Definition: uiioobjsel.h:101
void setHelpKey(const HelpKey &helpkey)
Definition: uiioobjsel.h:79
UI element for selection of data objects.
Definition: uiiosel.h:28
Holds the context for selecting and/or creating IOObjs.
Definition: ioobjctxt.h:59

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