Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

mwidget.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002   mwidget.cpp  -  description
00003   -------------------
00004 begin                : Fri May 19 2000
00005 copyright            : (C) 2000 by Roman Merzlyakov
00006 email                : roman@sbrf.barrt.ru
00007 copyright            : (C) 2000 by Roman Razilov
00008 email                : Roman.Razilov@gmx.de
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *   This program is free software; you can redistribute it and/or modify  *
00014  *   it under the terms of the GNU General Public License as published by  *
00015  *   the Free Software Foundation; either version 2 of the License, or     *
00016  *   (at your option) any later version.                                   *
00017  *                                                                         *
00018  ***************************************************************************/
00019 #include "mwidget.h"
00020 #include <qlayout.h>
00021 #include <qhbox.h>
00022 #include <qlabel.h>
00023 
00024 MainWidget::MainWidget( QWidget* parent, const char* name )
00025         : QFrame( parent, name )
00026 {
00027         BallPainter *bPainter = new BallPainter();
00028 
00029         QGridLayout *Form1Layout = new QGridLayout( this );
00030         Form1Layout->setSpacing( 4 );
00031         Form1Layout->setMargin( 4 );
00032         QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00033         Form1Layout->addItem( spacer, 0, 0 );
00034 
00035         lsb = new LinesBoard(bPainter, this);
00036 
00037         Form1Layout->addWidget( lsb, 0, 1 );
00038         QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00039         Form1Layout->addItem( spacer_2, 0, 2 );
00040 
00041         QHBox *bottom=new QHBox(this);
00042         
00043         mPoints=new QLabel(bottom);
00044         bottom->setStretchFactor(mPoints, 2);
00045         
00046         lPrompt = new LinesPrompt(bPainter, bottom);
00047 
00048         Form1Layout->addWidget( bottom, 1, 1 );
00049         QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
00050         Form1Layout->addItem( spacer_3, 2, 1 );
00051 
00052 
00053         connect(lsb, SIGNAL(endTurn()), parent, SLOT(makeTurn()));
00054         connect(lsb, SIGNAL(eraseLine(int)), parent, SLOT(addScore(int)));
00055         connect(lsb, SIGNAL(endGame()), parent, SLOT(stopGame()));
00056 
00057         connect(lPrompt, SIGNAL(PromptPressed()), parent, SLOT(switchPrompt()));
00058 
00059 }
00060 
00061 void MainWidget::setMessage(const QString &message)
00062 {
00063         mPoints->setText(message);
00064 }
00065 
00066 
00067 /*
00068 Destructor: deallocates memory for contents
00069  */
00070 
00071 MainWidget::~MainWidget()
00072 {
00073 }
00074 
00075 LinesBoard * MainWidget::GetLsb()
00076 {
00077         return lsb;
00078 }
00079 
00080 LinesPrompt * MainWidget::GetPrompt()
00081 {
00082         return lPrompt;
00083 }

Generated on Sat Nov 5 16:17:28 2005 for OPIE by  doxygen 1.4.2