| 1 |
/* |
| 2 |
* Copyright (C) 2004 Ivo Danihelka ([email protected]) |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU General Public License as published by |
| 6 |
* the Free Software Foundation; either version 2 of the License, or |
| 7 |
* (at your option) any later version. |
| 8 |
*/ |
| 9 |
#include "WiPara.h" |
| 10 |
|
| 11 |
#include "WiLabel.h" |
| 12 |
#include "StringTool.h" |
| 13 |
|
| 14 |
//----------------------------------------------------------------- |
| 15 |
WiPara::WiPara(const std::string &text, const Font &font, |
| 16 |
const SDL_Color &color) |
| 17 |
{ |
| 18 |
const std::string space = " "; |
| 19 |
StringTool::t_args lines = StringTool::split(text, '\n'); |
| 20 |
for (unsigned int i = 0; i < lines.size(); ++i) { |
| 21 |
std::string line = lines[i]; |
| 22 |
if (line.empty()) { |
| 23 |
line = space; |
| 24 |
} |
| 25 |
addWidget(new WiLabel(line, font, color)); |
| 26 |
} |
| 27 |
} |