Salome HOME
be40bc8a245b71c9c85fa39342d5a979f7129a52
[modules/gui.git] / src / TOOLSGUI / ToolsGUI_RegWidget.h
1 //  SALOME RegistryDisplay : GUI for Registry server implementation
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : RegWidget.h
25 //  Author : Pascale NOYRET, EDF
26 //  Module : SALOME
27 //  $Header$
28
29 #ifndef __REGWIDGET_H__
30 #define __REGWIDGET_H__
31 #include <qapplication.h>
32 #include <qmainwindow.h>
33
34 #include <SALOMEconfig.h>
35 #include CORBA_CLIENT_HEADER(SALOME_Registry)
36
37 class QTabWidget;
38 class QListView;
39 class QListViewItem;
40 class QWidget;
41 class QTimer;
42 class QCloseEvent;
43 class QTextView;
44 #if QT_VERSION > 300
45 class QPushButton;
46 #endif
47
48 #include <Standard_Macro.hxx>
49
50 class ToolsGUI_HelpWindow;
51 class ToolsGUI_IntervalWindow;
52
53 class Standard_EXPORT  ToolsGUI_InfoWindow : public QMainWindow
54 {
55   Q_OBJECT
56
57 public:
58   ToolsGUI_InfoWindow( QWidget* parent = 0, const char* name = 0);
59
60   void setText( const QString& text );
61   QTextView* textView() const { return myTextView; }
62
63 protected:
64   void keyPressEvent( QKeyEvent * e );
65
66 private:
67   QTextView* myTextView;
68 };
69
70 class Standard_EXPORT ToolsGUI_RegWidget : public QMainWindow
71 {
72   Q_OBJECT
73
74 public:
75   ToolsGUI_RegWidget( CORBA::ORB_var &orb , QWidget *parent = 0, const char *name = 0 );
76   ~ToolsGUI_RegWidget();
77   void       SetListe();
78   void       SetListeHistory();
79   void       InfoReg();
80   void       InfoHistory();
81
82   bool       eventFilter( QObject* object, QEvent* event );
83
84   static ToolsGUI_RegWidget* GetRegWidget( CORBA::ORB_var &orb , QWidget *parent = 0, const char *name = 0 );
85
86 public slots:
87   void       slotHelp();
88   void       slotListeSelect();
89   void       slotClientChanged( QListViewItem* );
90   void       slotHistoryChanged( QListViewItem* );
91   void       slotSelectRefresh();
92   void       slotIntervalOk();
93 protected:  
94   static QString setlongText( const Registry::Infos &c_info );
95   int            numitem( const QString& name, const QString& pid, const QString& machine, const Registry::AllInfos* c_info );
96   void           closeEvent( QCloseEvent *e);
97    
98 protected :
99   QListView*               _clients;
100   QListView*               _history;
101   QWidget*                 _parent;
102   QTabWidget*              _tabWidget;
103   QPushButton*             _refresh;
104   QPushButton*             _interval;
105   QPushButton*             _close;
106   QTimer*                  _counter;
107   Registry::AllInfos*      _serverhistory;
108   Registry::AllInfos*      _serverclients;
109   ToolsGUI_InfoWindow*     myInfoWindow;
110   ToolsGUI_HelpWindow*     myHelpWindow;
111   ToolsGUI_IntervalWindow* myIntervalWindow;
112   int                      myRefreshInterval;
113
114 private:
115   const      Registry::Components_var _VarComponents;
116   static     ToolsGUI_RegWidget* myRegWidgetPtr;
117 };
118
119 #endif