Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/gui.git] / src / RegistryDisplay / 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 #include <IntervalWindow.hxx>
38
39 class QTabWidget;
40 class QListView;
41 class QListViewItem;
42 class QWidget;
43 class QTimer;
44 class QCloseEvent;
45 class QTextView;
46 #if QT_VERSION > 300
47 class QPushButton;
48 #endif
49 class HelpWindow;
50 class InfoWindow;
51
52 class RegWidget : public QMainWindow
53 {
54   Q_OBJECT
55
56 public:
57   RegWidget( CORBA::ORB_var &orb , QWidget *parent = 0, const char *name = 0 );
58   ~RegWidget();
59   void       SetListe();
60   void       SetListeHistory();
61   void       InfoReg();
62   void       InfoHistory();
63
64   bool       eventFilter( QObject* object, QEvent* event );
65
66   static RegWidget* GetRegWidget( CORBA::ORB_var &orb , QWidget *parent = 0, const char *name = 0 );
67
68 public slots:
69   void       slotHelp();
70   void       slotListeSelect();
71   void       slotClientChanged( QListViewItem* );
72   void       slotHistoryChanged( QListViewItem* );
73   void       slotSelectRefresh();
74   void       slotIntervalOk();
75 protected:  
76   static QString setlongText( const Registry::Infos &c_info );
77   int            numitem( const QString& name, const QString& pid, const QString& machine, const Registry::AllInfos* c_info );
78   void           closeEvent( QCloseEvent *e);
79    
80 protected :
81   QListView*          _clients;
82   QListView*          _history;
83   QWidget*            _parent;
84   QTabWidget*         _tabWidget;
85   QPushButton*        _refresh;
86   QPushButton*        _interval;
87   QPushButton*        _close;
88   QTimer*             _counter;
89   Registry::AllInfos* _serverhistory;
90   Registry::AllInfos* _serverclients;
91   InfoWindow*         myInfoWindow;
92   HelpWindow*         myHelpWindow;
93   IntervalWindow*     myIntervalWindow;
94   int                 myRefreshInterval;
95
96 private:
97   const      Registry::Components_var _VarComponents;
98   static     RegWidget* myRegWidgetPtr;
99 };
100
101 class InfoWindow : public QMainWindow {
102 public:
103   InfoWindow( QWidget* parent = 0, const char* name = 0);
104
105   void setText( const QString& text );
106   QTextView* textView() const { return myTextView; }
107
108 protected:
109   void keyPressEvent( QKeyEvent * e );
110
111 private:
112   QTextView* myTextView;
113
114 };
115
116 #endif