Increase height of dialog/menu title bars to the standard icon height

objectmenu
Günther Brammer 2016-01-30 15:06:25 +01:00
parent 90860d3422
commit 7f75d09740
2 changed files with 9 additions and 6 deletions

View File

@ -139,11 +139,11 @@ namespace C4GUI
// draw symbol // draw symbol
if (fctIcon.Surface) if (fctIcon.Surface)
{ {
C4Facet cgoSymbol(cgo.Surface, cgo.TargetX + rcBounds.x + 1, cgo.TargetY + rcBounds.y + 1, rcBounds.Hgt-2, rcBounds.Hgt-2); C4Facet cgoSymbol(cgo.Surface, cgo.TargetX + rcBounds.x, cgo.TargetY + rcBounds.y, rcBounds.Hgt, rcBounds.Hgt);
fctIcon.Draw(cgoSymbol); fctIcon.Draw(cgoSymbol);
} }
// calculations for automatic scrolling // calculations for automatic scrolling
int32_t iXOff = 0; int32_t iXOff = 0, iYOff;
if (iAlign == ALeft) iXOff += C4GUI_IconLabelSpacing; if (iAlign == ALeft) iXOff += C4GUI_IconLabelSpacing;
if (iAutoScrollDelay) if (iAutoScrollDelay)
{ {
@ -168,14 +168,17 @@ namespace C4GUI
// print out text; clipped // print out text; clipped
pDraw->StorePrimaryClipper(); pDraw->StorePrimaryClipper();
pDraw->SetPrimaryClipper(rcBounds.x + GetLeftIndent() + cgo.TargetX, rcBounds.y + cgo.TargetY, rcBounds.x+rcBounds.Wdt - GetRightIndent() + cgo.TargetX, rcBounds.y+rcBounds.Hgt + cgo.TargetY); pDraw->SetPrimaryClipper(rcBounds.x + GetLeftIndent() + cgo.TargetX, rcBounds.y + cgo.TargetY, rcBounds.x+rcBounds.Wdt - GetRightIndent() + cgo.TargetX, rcBounds.y+rcBounds.Hgt + cgo.TargetY);
pDraw->TextOut(sText.getData(), *pFont, 1.0f, cgo.Surface, x0 + cgo.TargetX + iXOff, rcBounds.y + cgo.TargetY + (rcBounds.Hgt-pFont->GetLineHeight())/2-1, dwFgClr, iAlign); iYOff = (rcBounds.Hgt-pFont->GetLineHeight())/2-1;
// even border all around the text
if (!fctIcon.Surface) iXOff += iYOff;
pDraw->TextOut(sText.getData(), *pFont, 1.0f, cgo.Surface, x0 + cgo.TargetX + iXOff, rcBounds.y + cgo.TargetY + iYOff, dwFgClr, iAlign);
pDraw->RestorePrimaryClipper(); pDraw->RestorePrimaryClipper();
} }
int32_t WoodenLabel::GetDefaultHeight(CStdFont *pUseFont) int32_t WoodenLabel::GetDefaultHeight(CStdFont *pUseFont)
{ {
if (!pUseFont) pUseFont = &(::GraphicsResource.TextFont); if (!pUseFont) pUseFont = &(::GraphicsResource.TextFont);
return std::max<int32_t>(pUseFont->GetLineHeight(), C4GUI_MinWoodBarHgt); return std::max<int32_t>(pUseFont->GetLineHeight(), C4SymbolSize);
} }
void WoodenLabel::SetIcon(const C4Facet &rfctIcon) void WoodenLabel::SetIcon(const C4Facet &rfctIcon)

View File

@ -438,9 +438,9 @@ void C4Menu::InitLocation(C4Facet &cgoArea)
{ {
ItemHeight = std::max<int32_t>(ItemHeight, ::GraphicsResource.FontRegular.GetLineHeight()); ItemHeight = std::max<int32_t>(ItemHeight, ::GraphicsResource.FontRegular.GetLineHeight());
int32_t iWdt, iHgt; int32_t iWdt, iHgt;
::GraphicsResource.FontRegular.GetTextExtent(Caption, ItemWidth, iHgt, true); ::GraphicsResource.FontRegular.GetTextExtent(Caption, iWdt, iHgt, true);
// FIXME: Blah. This stuff should be calculated correctly by pTitle. // FIXME: Blah. This stuff should be calculated correctly by pTitle.
ItemWidth += ItemHeight + 16; ItemWidth += iWdt + 20 + C4GUI_IconLabelSpacing;
C4MenuItem *pItem; C4MenuItem *pItem;
for (int i = 0; (pItem = GetItem(i)); ++i) for (int i = 0; (pItem = GetItem(i)); ++i)
{ {