OpendTect-6_4  6.4
uidialog.h
Go to the documentation of this file.
1 #ifndef uidialog_h
2 #define uidialog_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A.H. Lammertink
9  Date: 08/08/2000
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uibasemod.h"
16 
17 #include "uimainwin.h"
18 #include "uistrings.h"
19 
20 #include "bufstring.h"
21 #include "helpview.h"
22 #include "od_helpids.h"
23 
24 class uiButton;
25 
37 #define mNoDlgTitle uiString::emptyString()
38 #define mTODOHelpKey HelpKey( 0, ::toString(-1) )
39 #define mNoHelpKey HelpKey::emptyHelpKey()
40 
41 
42 mExpClass(uiBase) uiDialog : public uiMainWin
43 {
44  // impl: uimainwin.cc
45  friend class uiDialogBody;
46 
47 public:
48 
51  mExpClass(uiBase) Setup
52  {
53  public:
54  Setup( const uiString& window_title,
55  const uiString& dialog_title,
56  const HelpKey& help_key )
57  : wintitle_(window_title)
58  , dlgtitle_(dialog_title)
59  , helpkey_(help_key)
60  , savetext_(uiStrings::sSaveAsDefault())
61  , oktext_( uiStrings::sOk() )
62  , canceltext_( uiStrings::sCancel() )
63  , modal_(true) // if no parent given, always non-modal
64  , applybutton_(false)
65  , applytext_(uiStrings::sApply())
66  , savebutton_(false), savebutispush_(false)
67  , separator_(true), menubar_(false), nrstatusflds_(0)
68  , mainwidgcentered_(false), savechecked_(false)
69  , fixedsize_(false), okcancelrev_(false)
70  {}
71 
72  mDefSetupMemb(uiString,wintitle)
73  mDefSetupMemb(uiString,dlgtitle)
74  mDefSetupMemb(HelpKey,helpkey)
75  mDefSetupMemb(uiString,savetext)
76  mDefSetupMemb(uiString,oktext)
77  mDefSetupMemb(uiString,canceltext)
78  mDefSetupMemb(uiString,applytext)
79  mDefSetupMemb(bool,modal)
80  mDefSetupMemb(bool,applybutton)
81  mDefSetupMemb(bool,savebutton)
82  mDefSetupMemb(bool,savebutispush)
83  mDefSetupMemb(bool,separator)
84  mDefSetupMemb(bool,savechecked)
85  mDefSetupMemb(bool,menubar)
86  mDefSetupMemb(bool,mainwidgcentered)
87  mDefSetupMemb(bool,fixedsize)
88  mDefSetupMemb(bool,okcancelrev)
89  mDefSetupMemb(int,nrstatusflds)
91 
92  private:
93  Setup( const char* window_title,
94  const char* dialog_title,
95  int help_id )
96  : helpkey_(mNoHelpKey)
97  {}
100 
101  };
102 
103  enum Button { OK, CANCEL, APPLY, HELP, CREDITS, SAVE };
104 
105  uiDialog(uiParent*,const Setup&);
106  const Setup& setup() const;
107 
108  int go();
109  int goMinimized();
110 
111  void reject( CallBacker* cb =0);
112  void accept( CallBacker* cb =0);
113  void done(int ret=0);
115 
116  void setHSpacing( int );
117  void setVSpacing( int );
118  void setBorder( int );
119 
120  void setModal(bool yn);
121  bool isModal() const;
122 
123  uiButton* button( Button but );
124  void setButtonText( Button but, const uiString& txt );
125 
126  enum CtrlStyle { OkAndCancel, RunAndClose, CloseOnly };
128  void setCtrlStyle(CtrlStyle);
130  CtrlStyle getCtrlStyle() const { return ctrlstyle_; }
131  void setOkCancelText(const uiString& ok,const uiString& cnl);
132  void setOkText(const uiString&);
134  void setCancelText(const uiString&);
136  void enableSaveButton(
137  const uiString& txt=uiStrings::sSaveAsDefault());
139  int uiResult() const;
140 
141  void setButtonSensitive(Button,bool);
142  void setSaveButtonChecked(bool);
143  void setTitleText(const uiString& txt);
144  bool hasSaveButton() const;
145  bool saveButtonChecked() const;
146 
147  void setSeparator(bool yn);
149  bool separator() const;
150  void setHelpKey(const HelpKey&);
151  virtual HelpKey helpKey() const;
152 
153  void showMinMaxButtons();
154  void showAlwaysOnTop();
155  static int titlePos();
156  static void setTitlePos(int pos);
157  // pos: -1 = left, 0 = center, 1 = right
158 
160 
161 protected:
162 
163  virtual bool rejectOK(CallBacker*){ return true;}
164  virtual bool acceptOK(CallBacker*){ return true;}
165  virtual bool doneOK(int) { return true; }
166 
169  static int titlepos_;
170 
171 };
172 
173 #endif
CtrlStyle
Definition: uidialog.h:126
#define mExpClass(module)
Definition: commondefs.h:160
User interface main window.
Definition: uimainwin.h:36
description of properties of dialog.
Definition: uidialog.h:51
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
#define mNoHelpKey
Definition: uidialog.h:39
Definition: uidialog.h:126
virtual bool acceptOK(CallBacker *)
confirm accept
Definition: uidialog.h:164
Button
Definition: uidialog.h:103
Definition: uistrings.h:24
virtual bool doneOK(int)
confirm exit
Definition: uidialog.h:165
Definition: uistring.h:89
Definition: uiparent.h:26
Definition: helpview.h:49
Definition: uidialog.h:42
virtual bool rejectOK(CallBacker *)
confirm reject
Definition: uidialog.h:163
static uiString sSaveAsDefault()
Definition: uistrings.h:430
static int titlepos_
Definition: uidialog.h:169
#define mDefSetupMemb(typ, memb)
Definition: commondefs.h:137
CtrlStyle ctrlstyle_
Definition: uidialog.h:168
Notifier< uiDialog > applyPushed
Definition: uidialog.h:159
bool cancelpushed_
Definition: uidialog.h:167
Setup(const char *window_title, const char *dialog_title, int help_id)
nrstatusflds == -1: Make a statusbar, but don&#39;t add msg fields.
Definition: uidialog.h:93
CtrlStyle getCtrlStyle() const
OK button disabled when set to CloseOnly.
Definition: uidialog.h:130
Setup(const uiString &window_title, const uiString &dialog_title, const HelpKey &help_key)
Definition: uidialog.h:54

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