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