mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-08 02:42:34 +00:00
GRAPHICS: MACGUI: modify the position where it draws the title, currently, it will draw title at the center of title box
This commit is contained in:
parent
83341beddd
commit
aeacf0d4d2
@ -48,7 +48,7 @@ struct BorderName {
|
||||
};
|
||||
|
||||
static const BorderName borders[] = {
|
||||
{0x00, "StandardClose", { 1, 2, 19, 2, 2, 2, false}, kWindowBorderTitle, 23},
|
||||
{0x00, "StandardClose", { 1, 2, 19, 2, 2, 2, false}, kWindowBorderTitle, 25},
|
||||
{0x01, "ThickNoTitle", { 5, 5, 5, 5, -1, -1, false}, 0, 0},
|
||||
{0x02, "ThinNoTitle", { 1, 1, 1, 1, -1, -1, false}, 0, 0},
|
||||
{0x03, "ThinNoTitleShadow", { 1, 3, 1, 3, -1, -1, false}, 0, 0},
|
||||
|
@ -152,7 +152,7 @@ void MacWindowBorder::drawScrollBar(ManagedSurface *g, MacWindowManager *wm) {
|
||||
_scrollSize = -1;
|
||||
}
|
||||
|
||||
void MacWindowBorder::drawTitle(ManagedSurface *g, MacWindowManager *wm) {
|
||||
void MacWindowBorder::drawTitle(ManagedSurface *g, MacWindowManager *wm, int titleOffset) {
|
||||
const Graphics::Font *font = wm->_fontMan->getFont(Graphics::MacFont(kMacFontChicago, 12));
|
||||
int width = g->w;
|
||||
int titleColor = wm->_colorBlack;
|
||||
@ -164,7 +164,7 @@ void MacWindowBorder::drawTitle(ManagedSurface *g, MacWindowManager *wm) {
|
||||
if (titleWidth > maxWidth)
|
||||
titleWidth = maxWidth;
|
||||
|
||||
font->drawString(g, _title, (width - titleWidth) / 2 + 5, titleY + yOff, titleWidth, titleColor);
|
||||
font->drawString(g, _title, titleOffset + 5, titleY + yOff, titleWidth, titleColor);
|
||||
}
|
||||
|
||||
void MacWindowBorder::blitBorderInto(ManagedSurface &destination, uint32 flags, MacWindowManager *wm) {
|
||||
@ -198,7 +198,7 @@ void MacWindowBorder::blitBorderInto(ManagedSurface &destination, uint32 flags,
|
||||
srf.free();
|
||||
|
||||
if (flags & kWindowBorderTitle)
|
||||
drawTitle(&destination, wm);
|
||||
drawTitle(&destination, wm, src->getTitleOffset());
|
||||
|
||||
if (flags & kWindowBorderScrollbar)
|
||||
drawScrollBar(&destination, wm);
|
||||
|
@ -123,7 +123,7 @@ public:
|
||||
|
||||
void setScroll(int scrollPos, int scrollSize) { _scrollPos = scrollPos, _scrollSize = scrollSize; }
|
||||
|
||||
void drawTitle(ManagedSurface *g, MacWindowManager *wm);
|
||||
void drawTitle(ManagedSurface *g, MacWindowManager *wm, int titleOffset);
|
||||
|
||||
void drawScrollBar(ManagedSurface *g, MacWindowManager *wm);
|
||||
|
||||
|
@ -154,6 +154,12 @@ void NinePatchSide::calcOffsets(int len, int titleIndex, int titleWidth) {
|
||||
}
|
||||
}
|
||||
|
||||
int NinePatchBitmap::getTitleOffset() {
|
||||
if (_titleIndex == 0)
|
||||
return 0;
|
||||
return _h._m[_titleIndex]->dest_offset;
|
||||
}
|
||||
|
||||
NinePatchBitmap::NinePatchBitmap(Graphics::TransparentSurface *bmp, bool owns_bitmap, int titlePos, int titleWidth) {
|
||||
int i;
|
||||
uint8 r, g, b, a;
|
||||
|
@ -100,6 +100,8 @@ public:
|
||||
int getMinWidth() { return _h._fix; }
|
||||
int getMinHeight() { return _v._fix; }
|
||||
int getTitleWidth() { return _titleWidth; }
|
||||
// always call it after you calc the offset, such as after you call blit, then you will get the right offset
|
||||
int getTitleOffset();
|
||||
Graphics::TransparentSurface *getSource() { return _bmp; }
|
||||
Common::Rect &getPadding() { return _padding; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user