diff --git a/source/gui/gtextbox.cpp b/source/gui/gtextbox.cpp index 7b8c7676b..880b40126 100644 --- a/source/gui/gtextbox.cpp +++ b/source/gui/gtextbox.cpp @@ -98,6 +98,30 @@ void CGUITextBox::render() } +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +int CGUITextBox::getTextWidth() +{ + return getFontBank()->getStringWidth((char*)TranslationDatabase::getString(getTextId())); +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +int CGUITextBox::getTextHeight() +{ + return getFontBank()->getStringHeight((char*)TranslationDatabase::getString(getTextId())); +} + + /*---------------------------------------------------------------------- Function: Purpose: diff --git a/source/gui/gtextbox.h b/source/gui/gtextbox.h index b09c9e898..7332c3af3 100644 --- a/source/gui/gtextbox.h +++ b/source/gui/gtextbox.h @@ -43,10 +43,14 @@ public: virtual void render(); + int getTextWidth(); + int getTextHeight(); protected: void recalc(); + int getTextId() {return m_textId;} + private: unsigned int m_textId; @@ -55,9 +59,6 @@ private: }; - - - /*---------------------------------------------------------------------- Globals ------- */