00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef G4UIQt_h
00030 #define G4UIQt_h
00031
00032 #if defined(G4UI_BUILD_QT_SESSION) || defined(G4UI_USE_QT)
00033
00034 #include <map>
00035
00036 #include "G4VBasicShell.hh"
00037 #include "G4VInteractiveSession.hh"
00038
00039 #include <qobject.h>
00040 #include <qmap.h>
00041 #include <qstringlist.h>
00042 #include <qtabwidget.h>
00043
00044 class QMainWindow;
00045 class QLineEdit;
00046 class G4UIsession;
00047 class QListWidget;
00048 class QTreeWidget;
00049 class QTreeWidgetItem;
00050 class QTextEdit;
00051 class QLabel;
00052 class QResizeEvent;
00053 class QTabWidget;
00054 class QStringList;
00055 class QSplitter;
00056 class QToolBar;
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078 class G4QTabWidget : public QTabWidget {
00079 public :
00080 G4QTabWidget();
00081 G4QTabWidget(QSplitter*&);
00082 void paintEvent ( QPaintEvent * event );
00083 inline void setTabSelected(bool a) { tabSelected = a; };
00084 inline void setLastTabCreated(int a) { lastCreated = a; };
00085 inline bool isTabSelected() { return tabSelected; };
00086 bool tabSelected;
00087 int lastCreated;
00088 };
00089
00090 class G4UIQt : public QObject, public G4VBasicShell, public G4VInteractiveSession {
00091 Q_OBJECT
00092
00093 public:
00094 G4UIQt(int,char**);
00095
00096 G4UIsession* SessionStart();
00097
00098 void AddMenu(const char*,const char*);
00099
00100
00101
00102
00103 void AddButton(const char*,const char*,const char*);
00104
00105
00106
00107
00108
00109 void AddIcon(const char* userLabel, const char* iconFile, const char* command, const char* file_name="");
00110
00111
00112
00113
00114
00115
00116 bool AddTabWidget(QWidget*,QString,int,int);
00117
00118
00119 QTabWidget* GetSceneTreeComponentsTBWidget();
00120
00121
00122 bool IsSplitterReleased();
00123
00124 inline bool IsIconMoveSelected() {
00125 return fMoveSelected;
00126 };
00127 inline bool IsIconRotateSelected() {
00128 return fRotateSelected;
00129 };
00130 inline bool IsIconPickSelected() {
00131 return fPickSelected;
00132 };
00133 inline bool IsIconZoomInSelected() {
00134 return fZoomInSelected;
00135 };
00136 inline bool IsIconZoomOutSelected() {
00137 return fZoomOutSelected;
00138 };
00139
00140 void SetIconMoveSelected();
00141 void SetIconRotateSelected();
00142 void SetIconPickSelected();
00143 void SetIconZoomInSelected();
00144 void SetIconZoomOutSelected();
00145 void SetIconHLHSRSelected();
00146 void SetIconHLRSelected();
00147 void SetIconSolidSelected();
00148 void SetIconWireframeSelected();
00149 void SetIconPerspectiveSelected();
00150 void SetIconOrthoSelected();
00151
00152 public:
00153 ~G4UIQt();
00154 void Prompt(G4String);
00155 void SessionTerminate();
00156 virtual void PauseSessionStart(const G4String&);
00157 virtual G4int ReceiveG4cout(const G4String&);
00158 virtual G4int ReceiveG4cerr(const G4String&);
00159
00160
00161 private:
00162 void SecondaryLoop(G4String);
00163 void CreateHelpWidget();
00164 void InitHelpTreeAndVisParametersWidget();
00165 void FillHelpTree();
00166 virtual void ExitHelp() const;
00167
00168 void CreateHelpTree(QTreeWidgetItem*,G4UIcommandTree*);
00169 QTreeWidgetItem* FindTreeItem(QTreeWidgetItem *,const QString&);
00170
00171 QString GetCommandList(const G4UIcommand*);
00172
00173 virtual G4bool GetHelpChoice(G4int&);
00174 bool eventFilter(QObject*,QEvent*);
00175 void ActivateCommand(G4String);
00176 QMap<int,QString> LookForHelpStringInChildTree(G4UIcommandTree *,const QString&);
00177
00178 void CreateVisParametersTBWidget();
00179 void CreateHelpTBWidget();
00180 void CreateCoutTBWidget();
00181 void CreateHistoryTBWidget();
00182 void OpenHelpTreeOnCommand(const QString &);
00183 QString GetShortCommandPath(QString);
00184 QString GetLongCommandPath(QTreeWidgetItem*);
00185 G4bool IsGUICommand(const G4UIcommand*);
00186 bool CreateVisCommandGroupAndToolBox(G4UIcommand*, QWidget*, int, bool isDialog);
00187 bool CreateCommandWidget(G4UIcommand* command, QWidget* parent, bool isDialog);
00188
00189 private:
00190
00191 QMainWindow * fMainWindow;
00192 QLabel *fCommandLabel;
00193 QLineEdit * fCommandArea;
00194 QTextEdit *fCoutTBTextArea;
00195 QTextEdit *fHelpArea;
00196 QTabWidget* fUITabWidget;
00197 QStringList fG4cout;
00198 QLineEdit * fCoutFilter;
00199
00200 QListWidget *fHistoryTBTableList;
00201 QTreeWidget *fHelpTreeWidget;
00202 QWidget* fHelpTBWidget;
00203 QWidget* fHistoryTBWidget;
00204 QWidget* fCoutTBWidget;
00205 QTabWidget* fSceneTreeComponentsTBWidget;
00206 QLineEdit* fHelpLine;
00207 G4QTabWidget* fViewerTabWidget;
00208 QString fCoutText;
00209 QLabel *fEmptyViewerTabLabel;
00210 QSplitter * fMainSplitterWidget;
00211 QSplitter* fRightSplitterWidget;
00212 QSplitter * fHelpVSplitter;
00213 int fLastQTabSizeX;
00214 int fLastQTabSizeY;
00215
00216 QToolBar *fToolbarApp;
00217 QToolBar *fToolbarUser;
00218
00219 bool fMoveSelected;
00220 bool fRotateSelected;
00221 bool fPickSelected;
00222 bool fZoomInSelected;
00223 bool fZoomOutSelected;
00224
00225 private Q_SLOTS :
00226 void ExitSession();
00227 void ClearButtonCallback();
00228 void CommandEnteredCallback();
00229 void ButtonCallback(const QString&);
00230 void HelpTreeClicCallback();
00231 void HelpTreeDoubleClicCallback();
00232 void ShowHelpCallback();
00233 void CommandHistoryCallback();
00234 void LookForHelpStringCallback();
00235 void UpdateTabWidget(int);
00236 void ResizeTabWidget( QResizeEvent* );
00237 void CoutFilterCallback(const QString&);
00238 void TabCloseCallback(int);
00239 void ToolBoxActivated(int);
00240 void VisParameterCallback(QWidget*);
00241 void ChangeColorCallback(QWidget*);
00242 void ChangeCursorStyle(const QString&);
00243 void ChangeSurfaceStyle(const QString&);
00244 void OpenIconCallback(const QString&);
00245 void SaveIconCallback(const QString&);
00246 void ChangePerspectiveOrtho(const QString&);
00247 };
00248
00249 #endif
00250
00251 #endif
00252