2 Copyright 2004-2005 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP 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
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "vquestion.h"
23 VQuestion::VQuestion(void* treplyTo)
29 buttonYes.setSurfaceOffset(40, 130);
30 buttonNo.setSurfaceOffset(140, 130);
32 buttonYes.setText(tr("Yes"));
33 buttonNo.setText(tr("No"));
34 buttonNo.setActive(1);
37 VQuestion::~VQuestion()
39 if (mainText) delete[] mainText;
42 void VQuestion::setMainText(char* takeText)
44 int length = strlen(takeText);
45 mainText = new char[length + 1];
46 strcpy(mainText, takeText);
49 void VQuestion::draw()
53 buttonYes.setSurface(surface);
54 buttonNo.setSurface(surface);
56 if (mainText) drawPara(mainText, 10, 45, Colour::LIGHTTEXT);
61 void VQuestion::swap()
63 if (selectedOption == NO)
66 buttonYes.setActive(1);
67 buttonNo.setActive(0);
69 else if (selectedOption == YES)
72 buttonYes.setActive(0);
73 buttonNo.setActive(1);
77 int VQuestion::handleCommand(int command)
86 ViewMan::getInstance()->updateView(this);
89 case Remote::DF_RIGHT:
94 ViewMan::getInstance()->updateView(this);
103 if (selectedOption != YES) return 4;
105 Message* m = new Message(); // Question/answer mech
108 m->message = Message::QUESTION_YES;
109 ViewMan::getInstance()->postMessage(m);
117 void VQuestion::setDefault(UCHAR option)
119 selectedOption = option;