diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index 1b5aba9a1..dbd94b4c2 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -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; +} diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index c20420d9a..8c87b8d5e 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -133,6 +133,9 @@ class CComponentsText : public CComponentsItem, public CBox ///gets the embedded CTextBox object, so it's possible to get access directly to its methods and properties virtual CTextBox* getCTextBoxObject() { return ct_textbox; }; + + ///returns count of lines from a text box page + virtual int getTextLinesAutoHeight(const int& textMaxHeight, const int& textWidth, const int& mode); };