#include "windows.h"
|
#include "windows.h"
|
#include "wintools.h"
|
#include "wintools.h"
|
/*
|
/*
|
* WIN Draw Library
|
* WIN Draw Library
|
* Draw3dShadow - draws a shadow with bottom-left and top-right missing
|
* Draw3dShadow - draws a shadow with bottom-left and top-right missing
|
* Draw3dBox - draws a complete shadow
|
* Draw3dBox - draws a complete shadow
|
* Draw3dInset - draw a 2 line 3d inset
|
* Draw3dInset - draw a 2 line 3d inset
|
* Draw3dOutset - draw a 2 line 3d outset
|
* Draw3dOutset - draw a 2 line 3d outset
|
*/
|
*/
|
|
|
/*
|
/*
|
* Draw3dShadow
|
* Draw3dShadow
|
* NOINDENT_BLACK T=white, B=black
|
* NOINDENT_BLACK T=white, B=black
|
* NOINDENT_GRAY T=white, B=dkgray
|
* NOINDENT_GRAY T=white, B=dkgray
|
* INDENT_BLACK T=black, B=white
|
* INDENT_BLACK T=black, B=white
|
* INDENT_GRAY T=dkgray, B=white
|
* INDENT_GRAY T=dkgray, B=white
|
*
|
*
|
* TTTTTTTTTTTTTT
|
* TTTTTTTTTTTTTT
|
* T B
|
* T B
|
* T B
|
* T B
|
* BBBBBBBBBBBBBB
|
* BBBBBBBBBBBBBB
|
*/
|
*/
|
void WINAPI
|
void WINAPI
|
Draw3dShadow(HDC hDC,int x,int y,int w,int h,COLORREF crTop,COLORREF crBottom)
|
Draw3dShadow(HDC hDC,int x,int y,int w,int h,COLORREF crTop,COLORREF crBottom)
|
{
|
{
|
HPEN hPenTop, hPenBottom, holdPen;
|
HPEN hPenTop, hPenBottom, holdPen;
|
|
|
hPenTop = CreatePen( PS_SOLID, 1, crTop);
|
hPenTop = CreatePen( PS_SOLID, 1, crTop);
|
hPenBottom = CreatePen( PS_SOLID, 1, crBottom);
|
hPenBottom = CreatePen( PS_SOLID, 1, crBottom);
|
holdPen = SelectObject( hDC, hPenTop);
|
holdPen = SelectObject( hDC, hPenTop);
|
MoveToEx( hDC, x, y+h-2, NULL);
|
MoveToEx( hDC, x, y+h-2, NULL);
|
LineTo( hDC, x, y); /* left side*/
|
LineTo( hDC, x, y); /* left side*/
|
LineTo( hDC, x+w-1, y); /* top side*/
|
LineTo( hDC, x+w-1, y); /* top side*/
|
|
|
SelectObject( hDC, hPenBottom);
|
SelectObject( hDC, hPenBottom);
|
MoveToEx( hDC, x+w-1, y+1, NULL);
|
MoveToEx( hDC, x+w-1, y+1, NULL);
|
LineTo( hDC, x+w-1, y+h-1); /* right side*/
|
LineTo( hDC, x+w-1, y+h-1); /* right side*/
|
LineTo( hDC, x, y+h-1); /* bottom side*/
|
LineTo( hDC, x, y+h-1); /* bottom side*/
|
|
|
SelectObject( hDC, holdPen);
|
SelectObject( hDC, holdPen);
|
DeleteObject( hPenTop);
|
DeleteObject( hPenTop);
|
DeleteObject( hPenBottom);
|
DeleteObject( hPenBottom);
|
}
|
}
|
|
|
/*
|
/*
|
* Draw3dBox
|
* Draw3dBox
|
*
|
*
|
* TTTTTTTTTTTTTTB
|
* TTTTTTTTTTTTTTB
|
* T B
|
* T B
|
* T B
|
* T B
|
* BBBBBBBBBBBBBBB
|
* BBBBBBBBBBBBBBB
|
*/
|
*/
|
void WINAPI
|
void WINAPI
|
Draw3dBox(HDC hDC,int x,int y,int w,int h,COLORREF crTop,COLORREF crBottom)
|
Draw3dBox(HDC hDC,int x,int y,int w,int h,COLORREF crTop,COLORREF crBottom)
|
{
|
{
|
HPEN hPenTop, hPenBottom, holdPen;
|
HPEN hPenTop, hPenBottom, holdPen;
|
|
|
hPenTop = CreatePen( PS_SOLID, 1, crTop);
|
hPenTop = CreatePen( PS_SOLID, 1, crTop);
|
hPenBottom = CreatePen( PS_SOLID, 1, crBottom);
|
hPenBottom = CreatePen( PS_SOLID, 1, crBottom);
|
holdPen = SelectObject( hDC, hPenTop);
|
holdPen = SelectObject( hDC, hPenTop);
|
MoveToEx( hDC, x, y+h-2, NULL);
|
MoveToEx( hDC, x, y+h-2, NULL);
|
LineTo( hDC, x, y); /* left side*/
|
LineTo( hDC, x, y); /* left side*/
|
MoveToEx( hDC, x, y, NULL);
|
MoveToEx( hDC, x, y, NULL);
|
LineTo( hDC, x+w-1, y); /* top side*/
|
LineTo( hDC, x+w-1, y); /* top side*/
|
|
|
SelectObject( hDC, hPenBottom);
|
SelectObject( hDC, hPenBottom);
|
MoveToEx( hDC, x+w-1, y, NULL);
|
MoveToEx( hDC, x+w-1, y, NULL);
|
LineTo( hDC, x+w-1, y+h-1); /* right side*/
|
LineTo( hDC, x+w-1, y+h-1); /* right side*/
|
LineTo( hDC, x-1, y+h-1); /* bottom side*/
|
LineTo( hDC, x-1, y+h-1); /* bottom side*/
|
|
|
SelectObject( hDC, holdPen);
|
SelectObject( hDC, holdPen);
|
DeleteObject( hPenTop);
|
DeleteObject( hPenTop);
|
DeleteObject( hPenBottom);
|
DeleteObject( hPenBottom);
|
}
|
}
|
|
|
/*
|
/*
|
* Draw 2 line deep 3d inset
|
* Draw 2 line deep 3d inset
|
*/
|
*/
|
void WINAPI
|
void WINAPI
|
Draw3dInset(HDC hDC,int x,int y,int w,int h)
|
Draw3dInset(HDC hDC,int x,int y,int w,int h)
|
{
|
{
|
Draw3dBox(hDC, x, y, w, h,
|
Draw3dBox(hDC, x, y, w, h,
|
GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNHIGHLIGHT));
|
GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNHIGHLIGHT));
|
++x; ++y; w -= 2; h -= 2;
|
++x; ++y; w -= 2; h -= 2;
|
Draw3dBox(hDC, x, y, w, h,
|
Draw3dBox(hDC, x, y, w, h,
|
GetSysColor(COLOR_WINDOWFRAME), GetSysColor(COLOR_3DLIGHT));
|
GetSysColor(COLOR_WINDOWFRAME), GetSysColor(COLOR_3DLIGHT));
|
}
|
}
|
|
|
/*
|
/*
|
* Draw 2 line deep 3d outset
|
* Draw 2 line deep 3d outset
|
*/
|
*/
|
void WINAPI
|
void WINAPI
|
Draw3dOutset(HDC hDC,int x,int y,int w,int h)
|
Draw3dOutset(HDC hDC,int x,int y,int w,int h)
|
{
|
{
|
Draw3dBox(hDC, x, y, w, h,
|
Draw3dBox(hDC, x, y, w, h,
|
GetSysColor(COLOR_3DLIGHT), GetSysColor(COLOR_WINDOWFRAME));
|
GetSysColor(COLOR_3DLIGHT), GetSysColor(COLOR_WINDOWFRAME));
|
++x; ++y; w -= 2; h -= 2;
|
++x; ++y; w -= 2; h -= 2;
|
Draw3dBox(hDC, x, y, w, h,
|
Draw3dBox(hDC, x, y, w, h,
|
GetSysColor(COLOR_BTNHIGHLIGHT), GetSysColor(COLOR_BTNSHADOW));
|
GetSysColor(COLOR_BTNHIGHLIGHT), GetSysColor(COLOR_BTNSHADOW));
|
}
|
}
|
|
|
/*
|
/*
|
* Draw 1 line pushed down rectangle
|
* Draw 1 line pushed down rectangle
|
*/
|
*/
|
void WINAPI
|
void WINAPI
|
Draw3dPushDown(HDC hDC, int x, int y, int w, int h)
|
Draw3dPushDown(HDC hDC, int x, int y, int w, int h)
|
{
|
{
|
Draw3dBox(hDC, x, y, w, h, GetSysColor(COLOR_BTNSHADOW),
|
Draw3dBox(hDC, x, y, w, h, GetSysColor(COLOR_BTNSHADOW),
|
GetSysColor(COLOR_BTNSHADOW));
|
GetSysColor(COLOR_BTNSHADOW));
|
}
|
}
|
|
|
/*
|
/*
|
* Draw either 3d up or down depending on state
|
* Draw either 3d up or down depending on state
|
*/
|
*/
|
void WINAPI
|
void WINAPI
|
Draw3dUpDownState(HDC hDC, int x, int y, int w, int h, BOOL fDown)
|
Draw3dUpDownState(HDC hDC, int x, int y, int w, int h, BOOL fDown)
|
{
|
{
|
if (fDown)
|
if (fDown)
|
Draw3dPushDown(hDC, x, y, w, h);
|
Draw3dPushDown(hDC, x, y, w, h);
|
else Draw3dOutset(hDC, x, y, w, h);
|
else Draw3dOutset(hDC, x, y, w, h);
|
}
|
}
|
|
|
void WINAPI
|
void WINAPI
|
Draw3dUpFrame(HDC hDC, int l, int t, int r, int b)
|
Draw3dUpFrame(HDC hDC, int l, int t, int r, int b)
|
{
|
{
|
RECT rc;
|
RECT rc;
|
HBRUSH hbr;
|
HBRUSH hbr;
|
|
|
SetRect(&rc, l, t, r, b);
|
SetRect(&rc, l, t, r, b);
|
Draw3dBox(hDC, rc.left, rc.top,
|
Draw3dBox(hDC, rc.left, rc.top,
|
rc.right-rc.left, rc.bottom-rc.top,
|
rc.right-rc.left, rc.bottom-rc.top,
|
GetSysColor(COLOR_3DLIGHT),
|
GetSysColor(COLOR_3DLIGHT),
|
GetSysColor(COLOR_WINDOWFRAME));
|
GetSysColor(COLOR_WINDOWFRAME));
|
InflateRect(&rc, -1, -1);
|
InflateRect(&rc, -1, -1);
|
Draw3dBox(hDC, rc.left, rc.top,
|
Draw3dBox(hDC, rc.left, rc.top,
|
rc.right-rc.left, rc.bottom-rc.top,
|
rc.right-rc.left, rc.bottom-rc.top,
|
GetSysColor(COLOR_BTNHIGHLIGHT),
|
GetSysColor(COLOR_BTNHIGHLIGHT),
|
GetSysColor(COLOR_BTNSHADOW));
|
GetSysColor(COLOR_BTNSHADOW));
|
InflateRect(&rc, -1, -1);
|
InflateRect(&rc, -1, -1);
|
|
|
hbr = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
|
hbr = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
|
FillRect(hDC, &rc, hbr);
|
FillRect(hDC, &rc, hbr);
|
DeleteObject(hbr);
|
DeleteObject(hbr);
|
}
|
}
|
|
|