CComponentsText: Add function getTextLinesAutoHeight()

- Function is used for determine the number of lines
  in a text box in AUTO_HIGH mode.

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
Michael Liebmann
2013-10-23 16:42:40 +02:00
committed by Thilo Graf
parent 64c6eb5945
commit ad630c5acb
2 changed files with 18 additions and 0 deletions

View File

@@ -273,3 +273,18 @@ string CComponentsText::iToString(int int_val)
string i_string(i_str.str());
return i_string;
}
//helper, get lines per textbox page
int CComponentsText::getTextLinesAutoHeight(const int& textMaxHeight, const int& textWidth, const int& mode)
{
CComponentsText box;
box.iX = 0;
box.iY = 0;
box.iWidth = textWidth;
box.iHeight = textMaxHeight;
CTextBox tb(ct_text.c_str(), ct_font, mode, &box);
int ret = tb.getLinesPerPage();
return ret;
}