- continue "marletting"

- use marlett font for scrollbar control
- TODO: scrollbar size grip with marlett

svn path=/trunk/; revision=40729
This commit is contained in:
Matthias Kupfer 2009-04-29 09:55:05 +00:00
parent f0794d4f2c
commit a06899befa

View file

@ -880,59 +880,43 @@ static BOOL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags)
static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags) static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags)
{ {
POINT Line[4]; int colorIdx = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_BTNTEXT;
LOGFONT lf;
HFONT hFont, hOldFont;
COLORREF clrsave;
RECT myr; RECT myr;
INT bkmode;
TCHAR Symbol;
// for scrollgripsize
POINT Line[4];
int SmallDiam = UITOOLS_MakeSquareRect(r, &myr) - 2; int SmallDiam = UITOOLS_MakeSquareRect(r, &myr) - 2;
int i; int i;
HBRUSH hbsave, hb, hb2; HBRUSH hbsave, hb, hb2;
HPEN hpsave, hp, hp2; HPEN hpsave, hp, hp2;
int tri = 290*SmallDiam/1000 - 1; int tri = 290*SmallDiam/1000 - 1;
int d46, d93; int d46, d93;
// end scrollgripsize
/*
* This fixes a problem with really tiny "scroll" buttons. In particular
* with the updown control.
* Making sure that the arrow is as least 3 pixels wide (or high).
*/
if (tri == 0)
tri = 1;
switch(uFlags & 0xff) switch(uFlags & 0xff)
{ {
case DFCS_SCROLLCOMBOBOX: case DFCS_SCROLLCOMBOBOX:
case DFCS_SCROLLDOWN: case DFCS_SCROLLDOWN:
Line[2].x = myr.left + 470*SmallDiam/1000 + 2; Symbol = '6';
Line[2].y = myr.top + 687*SmallDiam/1000 + 1;
Line[0].x = Line[2].x - tri;
Line[1].x = Line[2].x + tri;
Line[0].y = Line[1].y = Line[2].y - tri;
break; break;
case DFCS_SCROLLUP: case DFCS_SCROLLUP:
Line[2].x = myr.left + 470*SmallDiam/1000 + 2; Symbol = '5';
Line[2].y = myr.bottom - (687*SmallDiam/1000 + 1);
Line[0].x = Line[2].x - tri;
Line[1].x = Line[2].x + tri;
Line[0].y = Line[1].y = Line[2].y + tri;
break; break;
case DFCS_SCROLLLEFT: case DFCS_SCROLLLEFT:
Line[2].x = myr.right - (687*SmallDiam/1000 + 1); Symbol = '3';
Line[2].y = myr.top + 470*SmallDiam/1000 + 2;
Line[0].y = Line[2].y - tri;
Line[1].y = Line[2].y + tri;
Line[0].x = Line[1].x = Line[2].x + tri;
break; break;
case DFCS_SCROLLRIGHT: case DFCS_SCROLLRIGHT:
Line[2].x = myr.left + 687*SmallDiam/1000 + 1; Symbol = '4';
Line[2].y = myr.top + 470*SmallDiam/1000 + 2;
Line[0].y = Line[2].y - tri;
Line[1].y = Line[2].y + tri;
Line[0].x = Line[1].x = Line[2].x - tri;
break; break;
case DFCS_SCROLLSIZEGRIP: case DFCS_SCROLLSIZEGRIP:
// FIXME: needs to use marlett too, copied for compatibility only
/* This one breaks the flow... */ /* This one breaks the flow... */
IntDrawRectEdge(dc, r, EDGE_BUMP, BF_MIDDLE | ((uFlags&(DFCS_MONO|DFCS_FLAT)) ? BF_MONO : 0)); IntDrawRectEdge(dc, r, EDGE_BUMP, BF_MIDDLE | ((uFlags&(DFCS_MONO|DFCS_FLAT)) ? BF_MONO : 0));
hpsave = (HPEN)SelectObject(dc, GetStockObject(NULL_PEN)); hpsave = (HPEN)SelectObject(dc, GetStockObject(NULL_PEN));
@ -1005,42 +989,50 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags)
SelectObject(dc, hpsave); SelectObject(dc, hpsave);
SelectObject(dc, hbsave); SelectObject(dc, hbsave);
return TRUE; return TRUE;
case DFCS_SCROLLSIZEGRIPRIGHT:
return FALSE; // unimplemented yet
default: default:
return FALSE; return FALSE;
} }
if(uFlags & DFCS_PUSHED)
/* Here do the real scroll-bar controls end up */ IntDrawRectEdge(dc,r,EDGE_SUNKEN, BF_RECT | BF_MIDDLE | BF_SOFT);
if( ! (uFlags & (0xff00 & ~DFCS_ADJUSTRECT)) )
/* UITOOLS95_DFC_ButtonPush always uses BF_SOFT which we don't */
/* want for the normal scroll-arrow button. */
IntDrawRectEdge( dc, r, EDGE_RAISED, (uFlags&DFCS_ADJUSTRECT) | BF_MIDDLE | BF_RECT);
else else
UITOOLS95_DFC_ButtonPush(dc, r, (uFlags & 0xff00) ); IntDrawRectEdge(dc,r,BDR_RAISEDINNER | BDR_RAISEDOUTER, BF_RECT |
BF_SOFT | BF_MIDDLE);
ZeroMemory(&lf, sizeof(LOGFONT));
UITOOLS_MakeSquareRect(r, &myr);
myr.left += 1;
myr.top += 1;
myr.right -= 1;
myr.bottom -= 1;
if(uFlags & DFCS_PUSHED)
OffsetRect(&myr,1,1);
lf.lfHeight = myr.bottom - myr.top;
lf.lfWidth = 0;
lf.lfWeight = FW_NORMAL;
lf.lfCharSet = DEFAULT_CHARSET;
lstrcpy(lf.lfFaceName, TEXT("Marlett"));
hFont = CreateFontIndirect(&lf);
/* save font and text color */
hOldFont = SelectObject(dc, hFont);
clrsave = GetTextColor(dc);
bkmode = GetBkMode(dc);
/* set color and drawing mode */
SetBkMode(dc, TRANSPARENT);
if(uFlags & DFCS_INACTIVE) if(uFlags & DFCS_INACTIVE)
{ {
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT)); /* draw shadow */
hpsave = (HPEN)SelectObject(dc, GetSysColorPen(COLOR_BTNHIGHLIGHT)); SetTextColor(dc, GetSysColor(COLOR_BTNHIGHLIGHT));
Polygon(dc, Line, 3); TextOut(dc, myr.left + 1, myr.top + 1, &Symbol, 1);
SelectObject(dc, hpsave);
SelectObject(dc, hbsave);
} }
SetTextColor(dc, GetSysColor(colorIdx));
if( (uFlags & DFCS_INACTIVE) || !(uFlags & DFCS_PUSHED) ) /* draw selected symbol */
for(i = 0; i < 3; i++) TextOut(dc, myr.left, myr.top, &Symbol, 1);
{ /* restore previous settings */
Line[i].x--; SetTextColor(dc, clrsave);
Line[i].y--; SelectObject(dc, hOldFont);
} SetBkMode(dc, bkmode);
DeleteObject(hFont);
i = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_BTNTEXT;
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i));
hpsave = (HPEN)SelectObject(dc, GetSysColorPen(i));
Polygon(dc, Line, 3);
SelectObject(dc, hpsave);
SelectObject(dc, hbsave);
return TRUE; return TRUE;
} }
@ -1055,6 +1047,10 @@ static BOOL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags)
Symbol = '8'; Symbol = '8';
break; break;
case DFCS_MENUARROWRIGHT:
Symbol = 'w'; // FIXME: needs to confirm
break;
case DFCS_MENUBULLET: case DFCS_MENUBULLET:
Symbol = 'h'; Symbol = 'h';
break; break;