OpendTect-6_4  6.4
uimainwin.h
Go to the documentation of this file.
1 #ifndef uimainwin_h
2 #define uimainwin_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: 31/05/2000
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uibasemod.h"
16 #include "uiparent.h"
17 #include "mousecursor.h"
18 #include "uistring.h"
19 
20 mFDQtclass(QWidget)
21 class uiDockWin;
22 class uiGroup;
23 class uiMainWinBody;
24 class uiMenuBar;
25 class uiObject;
26 class uiMenu;
27 class uiStatusBar;
28 class uiToolBar;
29 class Timer;
30 class BufferStringSet;
31 
36 mExpClass(uiBase) uiMainWin : public uiParent
38 friend class uiMainWinBody;
39 public:
40  mExpClass(uiBase) Setup
41  { mODTextTranslationClass(Setup);
42  public:
43  Setup( const uiString& capt )
44  : caption_(capt)
45  , icontxt_(capt)
46  , modal_(false)
47  , withmenubar_(true)
48  , deleteonclose_(true)
49  , nrstatusflds_(1)
50  {}
51 
52  mDefSetupMemb(uiString,caption)
53  mDefSetupMemb(uiString,icontxt)
54  mDefSetupMemb(bool,modal)
55  mDefSetupMemb(bool,withmenubar)
56  mDefSetupMemb(bool,deleteonclose)
57  mDefSetupMemb(int,nrstatusflds)
58  };
59 
60  uiMainWin(uiParent*,const uiMainWin::Setup&);
61  uiMainWin(uiParent*,const uiString&
62  caption=uiString::emptyString(),
63  int nrstatusflds=1,bool withmenubar=true,
64  bool modal=false);
65  virtual ~uiMainWin();
66 
68  enum Dock
69  {
70  Top,
73  Left,
74  Minimized,
77  TornOff,
79  Unmanaged
80  };
81 
82  uiStatusBar* statusBar();
83  uiMenuBar* menuBar();
84 
85  static uiMainWin* activeWindow();
86 
87  void setCaption(const uiString&);
88  const uiString& caption(bool unique=false) const;
89  void setIcon(const uiPixmap&);
91  void setIconText(const uiString&);
92 
93  virtual void show();
94  void close();
95  void raise();
96 
97  void showMaximized();
98  void showMinimized();
99  void showNormal();
100 
101  bool isMaximized() const;
102  bool isMinimized() const;
103  bool isHidden() const;
104  bool isModal() const;
105 
106  void setSensitive(bool yn);
107 
108  void toStatusBar(const uiString&,int fldidx=0,int msecs=-1);
109 
110  virtual void reDraw(bool deep);
111  uiGroup* topGroup();
112 
113  void setShrinkAllowed(bool yn);
114  bool shrinkAllowed();
115 
117  void setExitAppOnClose(bool yn);
118  void setDeleteOnClose(bool yn);
119 
120  void removeDockWindow(uiDockWin*);
121  void addDockWindow(uiDockWin&,Dock);
122  void addToolBar(uiToolBar*);
123  uiToolBar* findToolBar(const char*);
124  uiToolBar* removeToolBar(uiToolBar*);
125  void addToolBarBreak();
126 
127  uiMenu& getToolbarsMenu() const;
128 
129  const ObjectSet<uiToolBar>& toolBars() const;
130  const ObjectSet<uiDockWin>& dockWins() const;
131 
134 
136  static uiMainWin* gtUiWinIfIsBdy(mQtclass(QWidget*) mwimpl);
137 
138  enum PopupArea { TopLeft, TopRight, BottomLeft, BottomRight,
139  Middle, Auto };
140  void setPopupArea( PopupArea pa ) { popuparea_ = pa; }
141  PopupArea getPopupArea() const { return popuparea_; }
142  void setCornerPos(int x,int y);
144  uiRect geometry(bool frame=true) const;
145 
146  bool poppedUp() const;
147  bool touch();
148  bool finalised() const;
149  virtual uiMainWin* mainwin() { return this; }
150  mQtclass(QWidget*) qWidget() const;
151  uiParent* parent() { return parent_; }
152  const uiParent* parent() const { return parent_; }
153 
154  enum ActModalTyp { None=0, Main, Message, File, Colour, Font, Unknown };
155  static ActModalTyp activeModalType();
156  static uiMainWin* activeModalWindow();
157  static const char* activeModalQDlgTitle();
158  static const char* activeModalQDlgButTxt(int butnr);
159  static int activeModalQDlgRetVal(int butnr);
160  static void closeActiveModalQDlg(int retval);
161 
162  static void getModalSignatures(BufferStringSet&);
163  static void getTopLevelWindows(ObjectSet<uiMainWin>&,
164  bool visibleonly=true);
165 
166  static uiString uniqueWinTitle(const uiString&,
167  mQtclass(QWidget*) forwindow=0,
168  BufferString* addendum = 0);
169 
170  void translateText();
171 
172 
173  bool grab(const char* filenm,int zoom=1,
174  const char* format=0,int quality=-1) const;
181  static bool grabScreen(const char* filenm,const char* format=0,
182  int quality=-1,int screen=0);
183 
184  void activateInGUIThread(const CallBack&,
185  bool busywait=true);
186  void saveImage(const char* fnm,int w,int h,int res);
187  void saveAsPDF(const char* fnm,int w,int h,int res)
188  { saveAsPDF_PS( fnm, true, w, h, res ); }
189  void saveAsPS(const char* fnm,int w,int h,int res)
190  { saveAsPDF_PS( fnm, false, w, h, res ); }
194  void copyToClipBoard();
195 
197  void runScript(const char* filename);
198  const char* getScriptToRun() const;
199 
200 protected:
201 
202  virtual bool closeOK() {return true;}
203 
204  uiMainWin(uiString,uiParent*);
205  uiObject* mainobject();
206 
207  void saveSettings();
208  void readSettings();
209  void saveAsPDF_PS(const char* fnm,bool aspdf,int w,int h,
210  int res);
211 
212  void copyToClipBoardCB(CallBacker*);
213  void aftPopupCB(CallBacker*);
214  void languageChangeCB(CallBacker*);
215  void setForceFinalise(bool);
216 
217  uiMainWinBody* body_;
218  uiParent* parent_;
220 
222 
223  void updateCaption();
227 
229 
230 public:
231  // Not for casual use
232  static void programActiveWindow(uiMainWin*);
233  static uiMainWin* programmedActiveWindow();
234 };
235 
236 #endif
Definition: uigroup.h:54
Definition: uitoolbar.h:31
#define mExpClass(module)
Definition: commondefs.h:160
User interface main window.
Definition: uimainwin.h:36
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
Definition: uigeom.h:42
#define mQtclass(cls)
Definition: commondefs.h:229
Notifier< uiMainWin > runScriptRequest
Definition: uimainwin.h:196
Definition: uimainwin.h:139
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
bool isHidden(const char *)
ActModalTyp
Definition: uimainwin.h:154
void saveAsPS(const char *fnm, int w, int h, int res)
Definition: uimainwin.h:189
static const uiString & emptyString()
Definition: uistring.h:109
Timer * afterpopuptimer_
Definition: uimainwin.h:219
PopupArea
Definition: uimainwin.h:138
The base class for most UI elements.
Definition: uiobj.h:38
Definition: uistring.h:89
Definition: uiparent.h:26
Set of BufferString objects.
Definition: bufstringset.h:28
PopupArea popuparea_
Definition: uimainwin.h:221
Notifier< uiMainWin > ctrlCPressed
Definition: uimainwin.h:192
FixedString None()
Definition: keystrs.h:90
Definition: uistatusbar.h:26
Setup(const uiString &capt)
Definition: uimainwin.h:43
Definition: uimainwin.h:40
uiParent * parent_
Definition: uimainwin.h:218
Dock
Dock Selector.
Definition: uimainwin.h:68
Definition: uimainwin.h:72
virtual uiMainWin * mainwin()
Definition: uimainwin.h:149
#define mDefSetupMemb(typ, memb)
Definition: commondefs.h:137
PopupArea getPopupArea() const
Definition: uimainwin.h:141
Definition: uimainwin.h:73
Definition: uimenu.h:65
uiString uniquecaption_
Definition: uimainwin.h:225
Off-screen pixel-based paint device.
Definition: uipixmap.h:34
void saveAsPDF(const char *fnm, int w, int h, int res)
Definition: uimainwin.h:187
Notifier< uiMainWin > afterPopup
Definition: uimainwin.h:193
Definition: uimainwin.h:70
Definition: uimainwin.h:138
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
BufferString scripttorun_
Definition: uimainwin.h:228
const uiParent * parent() const
Definition: uimainwin.h:152
uiMainWinBody * body_
Definition: uimainwin.h:217
virtual bool closeOK()
confirm window close
Definition: uimainwin.h:202
mFDQtclass(QWidget) class uiDockWin
Definition: uibody.h:18
uiParent * parent()
Definition: uimainwin.h:151
Definition: uimainwin.h:71
Notifier< uiMainWin > activatedone
Definition: uimainwin.h:191
Timer class.
Definition: timer.h:25
CallBacks object-oriented (object + method).
Definition: callback.h:57
Notifier< uiMainWin > windowClosed
triggered when window exits
Definition: uimainwin.h:132
uiString caption_
Definition: uimainwin.h:224
int languagechangecount_
Definition: uimainwin.h:226
void setPopupArea(PopupArea pa)
Definition: uimainwin.h:140

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