* CComponentsInfoBox: Add removeLineBreaks()

This commit is contained in:
micha-bbg
2012-08-20 22:21:28 +02:00
committed by Thilo Graf
parent e233c7467e
commit af8c8f2c10
2 changed files with 11 additions and 1 deletions

View File

@@ -221,7 +221,8 @@ class CComponentsInfoBox : public CComponentsContainer
void setTextColor(fb_pixel_t color_text){ col_text = color_text;};
void setSpaceOffset(const int offset){x_offset = offset;};
void setPicture(const std::string& picture_name){pic_name = picture_name;};
void removeLineBreaks(std::string& str);
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
};

View File

@@ -390,6 +390,15 @@ void CComponentsInfoBox::paint(bool do_save_bg)
text = NULL;
}
void CComponentsInfoBox::removeLineBreaks(std::string& str)
{
std::string::size_type spos = str.find_first_of("\r\n");
while (spos != std::string::npos) {
str.replace(spos, 1, " ");
spos = str.find_first_of("\r\n");
}
}
//-------------------------------------------------------------------------------------------------------
//sub class CComponentsShapeSquare from CComponentsContainer
CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)