Salome HOME
Initial version
[modules/gui.git] / src / RegistryDisplay / HelpWindow.cxx
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : HelpWindow.cxx
25 //  Author : Pascale NOYRET, EDF
26 //  Module : SALOME
27 //  $Header$
28
29 using namespace std;
30 # include "HelpWindow.hxx"
31 # include "utilities.h"
32
33 # include <qtextview.h>
34 # include <qpushbutton.h>
35 # include <qtextstream.h> 
36 # include <qfile.h> 
37
38 HelpWindow::HelpWindow(QWidget* parent, const char* name ) 
39      : QMainWindow( parent, name, WType_TopLevel | WDestructiveClose )
40 {
41   BEGIN_OF("Constructeur HelpWindow");
42   
43   setCaption( tr( "Help" ) );
44
45   myTextView = new QTextView( this, "myTextView" );
46   QPalette pal = myTextView->palette();
47   QColorGroup cg = pal.active();
48   cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
49   cg.setColor( QColorGroup::HighlightedText, Qt::white );
50   cg.setColor( QColorGroup::Base, QColor( 255,255,220 )  ); 
51   cg.setColor( QColorGroup::Text, Qt::black );
52   pal.setActive  ( cg );
53   cg = pal.inactive();
54   cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
55   cg.setColor( QColorGroup::HighlightedText, Qt::white );
56   cg.setColor( QColorGroup::Base, QColor( 255,255,220 )  ); 
57   cg.setColor( QColorGroup::Text, Qt::black );
58   pal.setInactive( cg );
59   cg = pal.disabled();
60   cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
61   cg.setColor( QColorGroup::HighlightedText, Qt::white );
62   cg.setColor( QColorGroup::Base, QColor( 255,255,220 )  ); 
63   cg.setColor( QColorGroup::Text, Qt::black );
64   pal.setDisabled( cg );
65   myTextView->setPalette( pal );
66   
67   setCentralWidget( myTextView );
68   setMinimumSize( 450, 250 );
69
70   QFile f ( "tmp.txt" );
71   if ( f.open( IO_ReadOnly ) )   
72     {
73       QTextStream t( &f ); 
74       while ( !t.eof() ) 
75         {
76           myTextView->append(t.readLine());
77         }
78     }
79   f.close();
80
81   END_OF("Constructeur HelpWindow");
82 }
83
84 /*!
85   Destructor
86 */
87 HelpWindow::~HelpWindow()
88 {
89   BEGIN_OF("Destructeur HelpWindow");
90   END_OF("Destructeur HelpWindow");
91 };
92
93 /*!
94   Sets text
95 */
96 void HelpWindow::setText( const QString& text )
97 {
98   myTextView->setText( text );
99 }
100
101