1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #include "titanic/pet_control/pet_translation.h"
24 #include "titanic/pet_control/pet_control.h"
25 
26 namespace Titanic {
27 
CPetTranslation()28 CPetTranslation::CPetTranslation() {
29 	Rect rect1(32, 368, 586, 438);
30 	_message.setBounds(rect1);
31 	_message.resize(50);
32 	_message.setHasBorder(false);
33 
34 	Rect rect2(32, 445, 586, 460);
35 	_tooltip.setBounds(rect2);
36 	_tooltip.setHasBorder(false);
37 }
38 
setup(CPetControl * petControl)39 bool CPetTranslation::setup(CPetControl *petControl) {
40 	if (petControl && setupControl(petControl))
41 		return reset();
42 	return false;
43 }
44 
draw(CScreenManager * screenManager)45 void CPetTranslation::draw(CScreenManager *screenManager) {
46 	_message.draw(screenManager);
47 	_tooltip.draw(screenManager);
48 }
49 
setupControl(CPetControl * petControl)50 bool CPetTranslation::setupControl(CPetControl *petControl) {
51 	if (petControl)
52 		_petControl = petControl;
53 	return true;
54 }
55 
clearTranslation()56 void CPetTranslation::clearTranslation() {
57 	_message.setup();
58 }
59 
addTranslation(const CString & str1,const CString & str2)60 void CPetTranslation::addTranslation(const CString &str1, const CString &str2) {
61 	CString msg = CString::format("%s%s - %s%s",
62 		CTextControl::getColorText(0, 0, 0x80).c_str(), str1.c_str(),
63 		CTextControl::getColorText(0, 0, 0).c_str(), str2.c_str());
64 	_message.addLine(msg);
65 	_petControl->makeDirty();
66 }
67 
68 } // End of namespace Titanic
69