mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 07:51:19 +02:00
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:
@@ -273,3 +273,18 @@ string CComponentsText::iToString(int int_val)
|
|||||||
string i_string(i_str.str());
|
string i_string(i_str.str());
|
||||||
return i_string;
|
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;
|
||||||
|
}
|
||||||
|
@@ -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
|
///gets the embedded CTextBox object, so it's possible to get access directly to its methods and properties
|
||||||
virtual CTextBox* getCTextBoxObject() { return ct_textbox; };
|
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user