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