Update the checkbox size when changing the size of the font
This commit is contained in:
parent
3c7b70f901
commit
bd5d268630
@ -73,8 +73,9 @@ bool ewol::CheckBox::CalculateMinSize(void)
|
||||
int32_t fontId = GetDefaultFontId();
|
||||
int32_t minWidth = ewol::GetWidth(fontId, m_label.c_str());
|
||||
int32_t minHeight = ewol::GetHeight(fontId);
|
||||
m_minSize.x = 25+minWidth;
|
||||
m_minSize.y = etk_max(25, minHeight);
|
||||
etkFloat_t boxSize = etk_max(20, minHeight) + 5;
|
||||
m_minSize.x = boxSize+minWidth;
|
||||
m_minSize.y = etk_max(boxSize, minHeight)+3;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -110,20 +111,21 @@ void ewol::CheckBox::OnRegenerateDisplay(void)
|
||||
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
||||
int32_t fontId = GetDefaultFontId();
|
||||
int32_t fontHeight = ewol::GetHeight(fontId);
|
||||
etkFloat_t boxSize = etk_max(20, fontHeight);
|
||||
//int32_t fontWidth = ewol::GetWidth(fontId, m_label.c_str());
|
||||
int32_t posy = (m_size.y - fontHeight - 6)/2 + 3;
|
||||
//int32_t posx = (m_size.x - fontWidth - 6)/2 + 25;
|
||||
tmpText->Text(25, posy, m_label.c_str());
|
||||
tmpText->Text(boxSize+5, posy, m_label.c_str());
|
||||
|
||||
|
||||
ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored;
|
||||
tmpOObjects->SetColor(m_textColorBg);
|
||||
tmpOObjects->Rectangle( 2.5, 2.5, 20, 20);
|
||||
tmpOObjects->Rectangle( 2.5, 2.5, boxSize, boxSize);
|
||||
tmpOObjects->SetColor(m_textColorFg);
|
||||
tmpOObjects->RectangleBorder( 2.5, 2.5, 20, 20, borderWidth);
|
||||
tmpOObjects->RectangleBorder( 2.5, 2.5, boxSize, boxSize, borderWidth);
|
||||
if (m_value) {
|
||||
tmpOObjects->Line( 2.5, 2.5, 22.5, 22.5, borderWidth);
|
||||
tmpOObjects->Line( 2.5, 22.5, 22.5, 2.5, borderWidth);
|
||||
tmpOObjects->Line( 2.5, 2.5, boxSize+2.5, boxSize+2.5, borderWidth);
|
||||
tmpOObjects->Line( 2.5, boxSize+2.5, boxSize+2.5, 2.5, borderWidth);
|
||||
}
|
||||
|
||||
AddOObject(tmpOObjects, "Decoration");
|
||||
|
Loading…
x
Reference in New Issue
Block a user