////////////////////////////////////////////////////////////////////// // XLogical - A puzzle game // // Copyright (C) 2000 Neil Brown, Tom Warkentin // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // or at the website: http://www.gnu.org // //////////////////////////////////////////////////////////////////////// #include #include "exception.h" #include "text.h" #include "menutext.h" CMenuText::CMenuText( void ) : fText( "" ) { #if DEBUG & 1 cout << ">CMenuText::CMenuText()" << endl; #endif #if DEBUG & 1 cout << "CMenuText::CMenuText()" << endl; #endif #if DEBUG & 1 cout << "CMenuText::~CMenuText()" << endl; #endif #if DEBUG & 1 cout << "CMenuText::Click()" << endl; cout << "aX=" << aX << " aY=" << aY << " aButton=" << aButton << endl; #endif if (aButton == 1) { Selected(); } #if DEBUG & 1 cout << "CMenuText::Draw()" << endl; #endif CText *font = NULL; if ((fX >= 0) && (fX+fWidth < fMainWidth) && (fY >= 0) && (fY+fHeight < fMainHeight)) { if (fHilighted) { font = graphDriver->graph_hi_font(); font->render_string((char *) fText.c_str( ), fX, fY ); } else { font = graphDriver->graph_lo_font(); font->render_string( (char *)fText.c_str( ), fX, fY ); } } #if DEBUG & 1 cout << "CMenuText::Realize()" << endl; #endif fHeight = graphDriver->graph_hi_font( )->get_height( ); fWidth = graphDriver->graph_hi_font( )->stringLen( const_cast(fText.c_str()) ); #if DEBUG & 1 cout << "CMenuText::Selected()" << endl; #endif cout << "text=[" << fText.c_str() << "] selected!" << endl; #if DEBUG & 1 cout << "CMenuText::SetText()" << endl; #endif fText = aText; fWidth = graphDriver->graph_hi_font( )->stringLen( const_cast(fText.c_str()) ); fX = (fMainWidth/2) - (Width()/2); #if DEBUG & 1 cout << "