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

prompt.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                           prompt.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 <qpainter.h>
00020 #include "prompt.h"
00021 
00022 LinesPrompt::LinesPrompt( BallPainter * abPainter, QWidget* parent, const char* name )
00023     : QWidget( parent, name )
00024 {
00025 
00026   bPainter = abPainter;
00027 
00028   setFocusPolicy( NoFocus );
00029   setBackgroundColor( gray );
00030 
00031   setMouseTracking( FALSE );
00032   setFixedSize(wPrompt(), hPrompt());
00033 
00034   PromptEnabled = true;
00035   cb[0]=NOBALL;
00036   cb[1]=NOBALL;
00037   cb[2]=NOBALL;
00038 }
00039 
00040 LinesPrompt::~LinesPrompt()
00041 {
00042 }
00043 
00044 int LinesPrompt::width() { return CELLSIZE * 3 ; }
00045 int LinesPrompt::height() { return CELLSIZE ;  }
00046 
00047 int LinesPrompt::wPrompt() { return CELLSIZE * 3 ; }
00048 int LinesPrompt::hPrompt() { return CELLSIZE ;  }
00049 
00050 void LinesPrompt::paintEvent( QPaintEvent* )
00051 {
00052   QPainter paint( this );
00053   if(PromptEnabled){
00054     paint.drawPixmap(0,          0, *(bPainter->GetNormalBall(cb[0])) );
00055     paint.drawPixmap(CELLSIZE,   0, *(bPainter->GetNormalBall(cb[1])) );
00056     paint.drawPixmap(2*CELLSIZE, 0, *(bPainter->GetNormalBall(cb[2])) );
00057   }
00058   else{
00059     paint.drawPixmap(0,          0, *(bPainter->GetBackgroundPix()) );
00060     paint.drawPixmap(CELLSIZE,   0, *(bPainter->GetBackgroundPix()) );
00061     paint.drawPixmap(2*CELLSIZE, 0, *(bPainter->GetBackgroundPix()) );
00062   }
00063 }
00064 
00065 /*
00066    Handles mouse press events for the LinesPrompt widget.
00067 */
00068 void LinesPrompt::mousePressEvent( QMouseEvent* e )
00069 {
00070     emit PromptPressed();
00071 }
00072 
00073 void LinesPrompt::SetBalls( int *pcb )
00074 {
00075                 for (int i = 0; i<BALLSDROP; i++)
00076                         cb[i] = pcb[i];
00077 
00078     update();
00079 }
00080 
00081 bool LinesPrompt::getState()
00082 {
00083     return PromptEnabled;
00084 }
00085 void LinesPrompt::setPrompt(bool enabled)
00086 {
00087     PromptEnabled = enabled;
00088     update();
00089 }

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