--- trunk/rosapps/games/solitaire/cardlib/cardbitmaps.cpp 2005-08-07 07:32:36 UTC (rev 17142)
+++ trunk/rosapps/games/solitaire/cardlib/cardbitmaps.cpp 2005-08-07 07:33:14 UTC (rev 17143)
@@ -1,281 +1,281 @@
-//
-// CardLib - Card bitmap support
-//
-// Freeware
-// Copyright J Brown 2001
-//
-#include <windows.h>
-#include "globals.h"
-#include "cardcolor.h"
-
-#ifndef __REACTOS__
-#pragma comment( lib, "..\\CardLib\\cards16.lib" )
-
-extern "C" HINSTANCE WINAPI LoadLibrary16( PSTR );
-extern "C" void WINAPI FreeLibrary16( HINSTANCE );
-#endif
-
-#define NUMCARDBITMAPS (52+16)
-
-void PaintRect(HDC hdc, RECT *rect, COLORREF col);
-
-void LoadCardBitmapsFromLibrary(HINSTANCE hCardDll, int *pwidth, int *pheight)
-{
- HBITMAP hBitmap;
- HDC hdcCard = NULL;
- HANDLE hOld;
- int i, xpos;
- int width, height;
- BITMAP bmp;
-
- for(i = 0; i < NUMCARDBITMAPS; i++)
- {
- //convert into the range used by the cdt_xxx functions
- int val;
-
- if(i < 52) val = (i % 4) * 13 + (i/4);
- else val = i;
-
- hBitmap = LoadBitmap(hCardDll, MAKEINTRESOURCE(val + 1));
- GetObject(hBitmap, sizeof(bmp), &bmp);
-
- width = bmp.bmWidth;
- height = bmp.bmHeight;
-
- if(i == 0) //if first time through, create BIG bitmap..
- {
- HDC hdc = GetDC(0);
- __hdcCardBitmaps = CreateCompatibleDC(hdc);
- __hbmCardBitmaps = CreateCompatibleBitmap(hdc, width * NUMCARDBITMAPS, height);
- SelectObject(__hdcCardBitmaps, __hbmCardBitmaps);
-
- hdcCard = CreateCompatibleDC(0);
-
- ReleaseDC(0, hdc);
- }
-
- hOld = SelectObject(hdcCard, hBitmap);
- BitBlt(__hdcCardBitmaps, i*width, 0, width, height, hdcCard, 0, 0, SRCCOPY);
- SelectObject(hdcCard, hOld);
-
- //Now draw a black border around each card...
- xpos = i*width;
- MoveToEx(__hdcCardBitmaps, xpos+2, 0, 0);
- LineTo(__hdcCardBitmaps, xpos+width - 3, 0);
- LineTo(__hdcCardBitmaps, xpos+width - 1, 2);
- LineTo(__hdcCardBitmaps, xpos+width - 1, height - 3); //vertical
- LineTo(__hdcCardBitmaps, xpos+width - 3, height - 1);
- LineTo(__hdcCardBitmaps, xpos+2, height - 1);
- LineTo(__hdcCardBitmaps, xpos+0, height - 3);
- LineTo(__hdcCardBitmaps, xpos+0, 2);
- LineTo(__hdcCardBitmaps, xpos+2, 0);
-
- DeleteObject(hBitmap);
- }
-
- DeleteDC(hdcCard);
-
- *pwidth = width;
- *pheight = height;
-
-}
-
-void LoadCardBitmaps(void)
-{
- HINSTANCE hCardDll;
-
-
- //If Windows NT/2000/XP
- if(GetVersion() < 0x80000000)
- {
- hCardDll = LoadLibrary("cards.dll");
-
- if(hCardDll == 0)
- {
- MessageBox(0, "Error loading cards.dll (32bit)", "Shed", MB_OK | MB_ICONEXCLAMATION);
- PostQuitMessage(0);
- return;
- }
-
- LoadCardBitmapsFromLibrary(hCardDll, &__cardwidth, &__cardheight);
-
- FreeLibrary(hCardDll);
- }
-#ifndef __REACTOS__
- //Else, Win9X
- else
- {
- hCardDll = LoadLibrary16("cards.dll");
-
- if(hCardDll == 0)
- {
- MessageBox(0, "Error loading cards.dll (16bit)", "Shed", MB_OK | MB_ICONEXCLAMATION);
- PostQuitMessage(0);
- return;
- }
-
- LoadCardBitmapsFromLibrary(hCardDll, &__cardwidth, &__cardheight);
-
- FreeLibrary16(hCardDll);
- }
-#endif
-}
-
-void FreeCardBitmaps()
-{
- DeleteObject (__hbmCardBitmaps);
- DeleteDC (__hdcCardBitmaps);
-}
-//
-// Paint a checkered rectangle, with each alternate
-// pixel being assigned a different colour
-//
-static void DrawCheckedRect(HDC hdc, RECT *rect, COLORREF fg, COLORREF bg)
-{
- static WORD wCheckPat[8] =
- {
- 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555
- };
-
- HBITMAP hbmp;
- HBRUSH hbr, hbrold;
- COLORREF fgold, bgold;
-
- hbmp = CreateBitmap(8, 8, 1, 1, wCheckPat);
- hbr = CreatePatternBrush(hbmp);
-
- //UnrealizeObject(hbr);
-
- SetBrushOrgEx(hdc, rect->left, rect->top, 0);
-
- hbrold = (HBRUSH)SelectObject(hdc, hbr);
-
- fgold = SetTextColor(hdc, fg);
- bgold = SetBkColor(hdc, bg);
-
- PatBlt(hdc, rect->left, rect->top,
- rect->right - rect->left,
- rect->bottom - rect->top,
- PATCOPY);
-
- SetBkColor(hdc, bgold);
- SetTextColor(hdc, fgold);
-
- SelectObject(hdc, hbrold);
- DeleteObject(hbr);
- DeleteObject(hbmp);
-}
-
-void GetSinkCols(COLORREF crBase, COLORREF *fg, COLORREF *bg, COLORREF *sh1, COLORREF *sh2)
-{
- if(bg) *bg = crBase;
- if(fg) *fg = ColorScaleRGB(crBase, RGB(255,255,255), 0.2);//RGB(49, 99, 140);
- if(sh1) *sh1 = ColorScaleRGB(crBase, RGB(0,0,0), 0.4);
- if(sh2) *sh2 = ColorScaleRGB(crBase, RGB(0,0,0), 0.2);
-}
-
-HBITMAP CreateSinkBmp(HDC hdcCompat, HDC hdc, COLORREF col, int width, int height)
-{
- HANDLE hold, hpold;
- HBITMAP hbm = CreateCompatibleBitmap(hdcCompat, width, height);
-
- HPEN hpfg, hpbg, hpsh, hpsh2;
-
- RECT rect;
- COLORREF fg, bg, shadow, shadow2;
-
- GetSinkCols(col, &fg, &bg, &shadow, &shadow2);
-
- hold = SelectObject(hdc, hbm);
-
- //fill with a solid base colour
- SetRect(&rect, 0,0,width,height);
- PaintRect(hdc, &rect, MAKE_PALETTERGB(bg));
-
- //draw the outline
- hpfg = CreatePen(PS_SOLID, 0, MAKE_PALETTERGB(fg));
- hpbg = CreatePen(PS_SOLID, 0, MAKE_PALETTERGB(bg));
- hpsh = CreatePen(PS_SOLID, 0, MAKE_PALETTERGB(shadow));
- hpsh2= CreatePen(PS_SOLID, 0, MAKE_PALETTERGB(shadow2));
-
- hpold = SelectObject(hdc, hpsh);
- MoveToEx(hdc, 2, 0, NULL);
- LineTo (hdc, width-3,0);
- LineTo (hdc, width-1, 2);
-
- SelectObject(hdc, hpold);
- hpold = SelectObject(hdc, hpsh2);
- LineTo (hdc, width-1, height-3); //vertical
- LineTo (hdc, width-3, height-1);
- LineTo (hdc, 2, height-1);
- LineTo (hdc, 0, height-3);
- SelectObject(hdc, hpold);
- hpold = SelectObject(hdc, hpsh);
-
- //MoveToEx( hdc, 0, height-3,0);
- LineTo (hdc, 0, 2);
- LineTo (hdc, 2, 0);
-
- SelectObject(hdc, hpold);
-
- //draw the highlight (vertical)
- hpold = SelectObject(hdc, hpfg);
- MoveToEx(hdc, width - 2, 3, NULL);
- LineTo (hdc, width - 2, height - 2);
-
- //(horz)
- MoveToEx(hdc, width - 3, height-2, NULL);
- LineTo (hdc, 3, height-2);
- SelectObject(hdc, hpold);
-
- //draw the background
- InflateRect(&rect, -2, -2);
- DrawCheckedRect(hdc, &rect, MAKE_PALETTERGB(bg), MAKE_PALETTERGB(fg));
-
- //overwrite the top-left background pixel
- SetPixel(hdc, 2, 2, MAKE_PALETTERGB(bg));
-
- DeleteObject(hpsh);
- DeleteObject(hpsh2);
- DeleteObject(hpfg);
- DeleteObject(hpbg);
-
-
- return hbm;
-}
-
-
-
-void CopyColor(PALETTEENTRY *pe, COLORREF col)
-{
- pe->peBlue = GetBValue(col);
- pe->peGreen = GetGValue(col);
- pe->peRed = GetRValue(col);
- pe->peFlags = 0;
-}
-
-HPALETTE MakePaletteFromCols(COLORREF cols[], int nNumColours)
-{
- LOGPALETTE *lp;
- HPALETTE hPalette;
-
- // Allocate memory for the logical palette
- lp = (LOGPALETTE *)HeapAlloc(
- GetProcessHeap(), 0, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * nNumColours);
-
- lp->palNumEntries = nNumColours;
- lp->palVersion = 0x300;
-
- //copy the colours into the logical palette format
- for(int i = 0; i < nNumColours; i++)
- {
- CopyColor(&lp->palPalEntry[i], cols[i]);
- }
-
- // create palette!
- hPalette = CreatePalette(lp);
-
- HeapFree(GetProcessHeap(), 0, lp);
-
- return hPalette;
-}
+//
+// CardLib - Card bitmap support
+//
+// Freeware
+// Copyright J Brown 2001
+//
+#include <windows.h>
+#include "globals.h"
+#include "cardcolor.h"
+
+#ifndef __REACTOS__
+#pragma comment( lib, "..\\CardLib\\cards16.lib" )
+
+extern "C" HINSTANCE WINAPI LoadLibrary16( PSTR );
+extern "C" void WINAPI FreeLibrary16( HINSTANCE );
+#endif
+
+#define NUMCARDBITMAPS (52+16)
+
+void PaintRect(HDC hdc, RECT *rect, COLORREF col);
+
+void LoadCardBitmapsFromLibrary(HINSTANCE hCardDll, int *pwidth, int *pheight)
+{
+ HBITMAP hBitmap;
+ HDC hdcCard = NULL;
+ HANDLE hOld;
+ int i, xpos;
+ int width, height;
+ BITMAP bmp;
+
+ for(i = 0; i < NUMCARDBITMAPS; i++)
+ {
+ //convert into the range used by the cdt_xxx functions
+ int val;
+
+ if(i < 52) val = (i % 4) * 13 + (i/4);
+ else val = i;
+
+ hBitmap = LoadBitmap(hCardDll, MAKEINTRESOURCE(val + 1));
+ GetObject(hBitmap, sizeof(bmp), &bmp);
+
+ width = bmp.bmWidth;
+ height = bmp.bmHeight;
+
+ if(i == 0) //if first time through, create BIG bitmap..
+ {
+ HDC hdc = GetDC(0);
+ __hdcCardBitmaps = CreateCompatibleDC(hdc);
+ __hbmCardBitmaps = CreateCompatibleBitmap(hdc, width * NUMCARDBITMAPS, height);
+ SelectObject(__hdcCardBitmaps, __hbmCardBitmaps);
+
+ hdcCard = CreateCompatibleDC(0);
+
+ ReleaseDC(0, hdc);
+ }
+
+ hOld = SelectObject(hdcCard, hBitmap);
+ BitBlt(__hdcCardBitmaps, i*width, 0, width, height, hdcCard, 0, 0, SRCCOPY);
+ SelectObject(hdcCard, hOld);
+
+ //Now draw a black border around each card...
+ xpos = i*width;
+ MoveToEx(__hdcCardBitmaps, xpos+2, 0, 0);
+ LineTo(__hdcCardBitmaps, xpos+width - 3, 0);
+ LineTo(__hdcCardBitmaps, xpos+width - 1, 2);
+ LineTo(__hdcCardBitmaps, xpos+width - 1, height - 3); //vertical
+ LineTo(__hdcCardBitmaps, xpos+width - 3, height - 1);
+ LineTo(__hdcCardBitmaps, xpos+2, height - 1);
+ LineTo(__hdcCardBitmaps, xpos+0, height - 3);
+ LineTo(__hdcCardBitmaps, xpos+0, 2);
+ LineTo(__hdcCardBitmaps, xpos+2, 0);
+
+ DeleteObject(hBitmap);
+ }
+
+ DeleteDC(hdcCard);
+
+ *pwidth = width;
+ *pheight = height;
+
+}
+
+void LoadCardBitmaps(void)
+{
+ HINSTANCE hCardDll;
+
+
+ //If Windows NT/2000/XP
+ if(GetVersion() < 0x80000000)
+ {
+ hCardDll = LoadLibrary("cards.dll");
+
+ if(hCardDll == 0)
+ {
+ MessageBox(0, "Error loading cards.dll (32bit)", "Shed", MB_OK | MB_ICONEXCLAMATION);
+ PostQuitMessage(0);
+ return;
+ }
+
+ LoadCardBitmapsFromLibrary(hCardDll, &__cardwidth, &__cardheight);
+
+ FreeLibrary(hCardDll);
+ }
+#ifndef __REACTOS__
+ //Else, Win9X
+ else
+ {
+ hCardDll = LoadLibrary16("cards.dll");
+
+ if(hCardDll == 0)
+ {
+ MessageBox(0, "Error loading cards.dll (16bit)", "Shed", MB_OK | MB_ICONEXCLAMATION);
+ PostQuitMessage(0);
+ return;
+ }
+
+ LoadCardBitmapsFromLibrary(hCardDll, &__cardwidth, &__cardheight);
+
+ FreeLibrary16(hCardDll);
+ }
+#endif
+}
+
+void FreeCardBitmaps()
+{
+ DeleteObject (__hbmCardBitmaps);
+ DeleteDC (__hdcCardBitmaps);
+}
+//
+// Paint a checkered rectangle, with each alternate
+// pixel being assigned a different colour
+//
+static void DrawCheckedRect(HDC hdc, RECT *rect, COLORREF fg, COLORREF bg)
+{
+ static WORD wCheckPat[8] =
+ {
+ 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555
+ };
+
+ HBITMAP hbmp;
+ HBRUSH hbr, hbrold;
+ COLORREF fgold, bgold;
+
+ hbmp = CreateBitmap(8, 8, 1, 1, wCheckPat);
+ hbr = CreatePatternBrush(hbmp);
+
+ //UnrealizeObject(hbr);
+
+ SetBrushOrgEx(hdc, rect->left, rect->top, 0);
+
+ hbrold = (HBRUSH)SelectObject(hdc, hbr);
+
+ fgold = SetTextColor(hdc, fg);
+ bgold = SetBkColor(hdc, bg);
+
+ PatBlt(hdc, rect->left, rect->top,
+ rect->right - rect->left,
+ rect->bottom - rect->top,
+ PATCOPY);
+
+ SetBkColor(hdc, bgold);
+ SetTextColor(hdc, fgold);
+
+ SelectObject(hdc, hbrold);
+ DeleteObject(hbr);
+ DeleteObject(hbmp);
+}
+
+void GetSinkCols(COLORREF crBase, COLORREF *fg, COLORREF *bg, COLORREF *sh1, COLORREF *sh2)
+{
+ if(bg) *bg = crBase;
+ if(fg) *fg = ColorScaleRGB(crBase, RGB(255,255,255), 0.2);//RGB(49, 99, 140);
+ if(sh1) *sh1 = ColorScaleRGB(crBase, RGB(0,0,0), 0.4);
+ if(sh2) *sh2 = ColorScaleRGB(crBase, RGB(0,0,0), 0.2);
+}
+
+HBITMAP CreateSinkBmp(HDC hdcCompat, HDC hdc, COLORREF col, int width, int height)
+{
+ HANDLE hold, hpold;
+ HBITMAP hbm = CreateCompatibleBitmap(hdcCompat, width, height);
+
+ HPEN hpfg, hpbg, hpsh, hpsh2;
+
+ RECT rect;
+ COLORREF fg, bg, shadow, shadow2;
+
+ GetSinkCols(col, &fg, &bg, &shadow, &shadow2);
+
+ hold = SelectObject(hdc, hbm);
+
+ //fill with a solid base colour
+ SetRect(&rect, 0,0,width,height);
+ PaintRect(hdc, &rect, MAKE_PALETTERGB(bg));
+
+ //draw the outline
+ hpfg = CreatePen(PS_SOLID, 0, MAKE_PALETTERGB(fg));
+ hpbg = CreatePen(PS_SOLID, 0, MAKE_PALETTERGB(bg));
+ hpsh = CreatePen(PS_SOLID, 0, MAKE_PALETTERGB(shadow));
+ hpsh2= CreatePen(PS_SOLID, 0, MAKE_PALETTERGB(shadow2));
+
+ hpold = SelectObject(hdc, hpsh);
+ MoveToEx(hdc, 2, 0, NULL);
+ LineTo (hdc, width-3,0);
+ LineTo (hdc, width-1, 2);
+
+ SelectObject(hdc, hpold);
+ hpold = SelectObject(hdc, hpsh2);
+ LineTo (hdc, width-1, height-3); //vertical
+ LineTo (hdc, width-3, height-1);
+ LineTo (hdc, 2, height-1);
+ LineTo (hdc, 0, height-3);
+ SelectObject(hdc, hpold);
+ hpold = SelectObject(hdc, hpsh);
+
+ //MoveToEx( hdc, 0, height-3,0);
+ LineTo (hdc, 0, 2);
+ LineTo (hdc, 2, 0);
+
+ SelectObject(hdc, hpold);
+
+ //draw the highlight (vertical)
+ hpold = SelectObject(hdc, hpfg);
+ MoveToEx(hdc, width - 2, 3, NULL);
+ LineTo (hdc, width - 2, height - 2);
+
+ //(horz)
+ MoveToEx(hdc, width - 3, height-2, NULL);
+ LineTo (hdc, 3, height-2);
+ SelectObject(hdc, hpold);
+
+ //draw the background
+ InflateRect(&rect, -2, -2);
+ DrawCheckedRect(hdc, &rect, MAKE_PALETTERGB(bg), MAKE_PALETTERGB(fg));
+
+ //overwrite the top-left background pixel
+ SetPixel(hdc, 2, 2, MAKE_PALETTERGB(bg));
+
+ DeleteObject(hpsh);
+ DeleteObject(hpsh2);
+ DeleteObject(hpfg);
+ DeleteObject(hpbg);
+
+
+ return hbm;
+}
+
+
+
+void CopyColor(PALETTEENTRY *pe, COLORREF col)
+{
+ pe->peBlue = GetBValue(col);
+ pe->peGreen = GetGValue(col);
+ pe->peRed = GetRValue(col);
+ pe->peFlags = 0;
+}
+
+HPALETTE MakePaletteFromCols(COLORREF cols[], int nNumColours)
+{
+ LOGPALETTE *lp;
+ HPALETTE hPalette;
+
+ // Allocate memory for the logical palette
+ lp = (LOGPALETTE *)HeapAlloc(
+ GetProcessHeap(), 0, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * nNumColours);
+
+ lp->palNumEntries = nNumColours;
+ lp->palVersion = 0x300;
+
+ //copy the colours into the logical palette format
+ for(int i = 0; i < nNumColours; i++)
+ {
+ CopyColor(&lp->palPalEntry[i], cols[i]);
+ }
+
+ // create palette!
+ hPalette = CreatePalette(lp);
+
+ HeapFree(GetProcessHeap(), 0, lp);
+
+ return hPalette;
+}
Property changes on: trunk/rosapps/games/solitaire/cardlib/cardbitmaps.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
--- trunk/rosapps/games/solitaire/cardlib/cardbutton.cpp 2005-08-07 07:32:36 UTC (rev 17142)
+++ trunk/rosapps/games/solitaire/cardlib/cardbutton.cpp 2005-08-07 07:33:14 UTC (rev 17143)
@@ -1,489 +1,489 @@
-//
-// CardLib - CardButton class
-//
-// Freeware
-// Copyright J Brown 2001
-//
-#include <windows.h>
-#include <tchar.h>
-
-#include "cardlib.h"
-#include "cardwindow.h"
-#include "cardbutton.h"
-#include "cardcolor.h"
-
-HPALETTE UseNicePalette(HDC, HPALETTE);
-void RestorePalette(HDC, HPALETTE);
-
-void PaintRect(HDC hdc, RECT *rect, COLORREF colour);
-
-CardButton::CardButton(CardWindow &parent, int Id, TCHAR *szText, UINT Style, bool visible,
- int x, int y, int width, int height)
-
- : parentWnd(parent), id(Id), uStyle(Style), fVisible(visible), ButtonCallback(0)
-{
- crText = RGB(255,255,255);
- crBack = RGB(0, 128, 0);
-
- xadjust = 0;
- yadjust = 0;
- xjustify = 0;
- yjustify = 0;
-
- fMouseDown = false;
- fButtonDown = false;
-
- hIcon = 0;
-
- SetText(szText);
- Move(x, y, width, height);
-
- mxlock = CreateMutex(0, FALSE, 0);
-
- hFont = 0;
-}
-
-CardButton::~CardButton()
-{
- CloseHandle(mxlock);
-}
-
-void CardButton::DrawRect(HDC hdc, RECT *rect, bool fNormal)
-{
- RECT fill;
-
- HANDLE hOld;
-
- HPEN hhi = CreatePen(0, 0, MAKE_PALETTERGB(crHighlight));
- HPEN hsh = CreatePen(0, 0, MAKE_PALETTERGB(crShadow));
- HPEN hbl = (HPEN)GetStockObject(BLACK_PEN);
-
- int x = rect->left;
- int y = rect->top;
- int width = rect->right-rect->left - 1;
- int height = rect->bottom-rect->top - 1;
-
- SetRect(&fill, x+1, y+1, x+width-1, y+height-1);
-
- int one = 1;
-
- if(!fNormal)
- {
- x += width;
- y += height;
- width = -width;
- height = -height;
- one = -1;
- OffsetRect(&fill, 1, 1);
- }
-
- if(fNormal)
- hOld = SelectObject(hdc, hhi);
- else
- hOld = SelectObject(hdc, hhi);
-
- MoveToEx(hdc, x, y+height, 0);
- LineTo(hdc, x, y);
- LineTo(hdc, x+width, y);
- SelectObject(hdc, hOld);
-
- hOld = SelectObject(hdc, hbl);
- LineTo(hdc, x+width, y+height);
- LineTo(hdc, x-one, y+height);
- SelectObject(hdc, hOld);
-
- hOld = SelectObject(hdc, hsh);
- MoveToEx(hdc, x+one, y+height-one, 0);
- LineTo(hdc, x+width-one, y+height-one);
- LineTo(hdc, x+width-one, y);
- SelectObject(hdc, hOld);
-
- PaintRect(hdc, &fill, MAKE_PALETTERGB(crBack));
-
- DeleteObject(hhi);
- DeleteObject(hsh);
-}
-
-void CardButton::Clip(HDC hdc)
-{
- if(fVisible == false) return;
-
- ExcludeClipRect(hdc, rect.left, rect.top, rect.right, rect.bottom);
-}
-
-void CardButton::Draw(HDC hdc, bool fNormal)
-{
- SIZE textsize;
- int x, y; //text x, y
- int ix, iy; //icon x, y
- int iconwidth = 0;
-
- RECT cliprect;
-
- if(fVisible == 0) return;
-
- if(hFont == 0)
- SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
- else
- SelectObject(hdc, hFont);
-
- GetTextExtentPoint32(hdc, szText, lstrlen(szText), &textsize);
-
- if(hIcon)
- {
- x = rect.left + 32 + 8;
- }
- else
- {
- if(uStyle & CB_ALIGN_LEFT)
- {
- x = rect.left + iconwidth;
- }
- else if(uStyle & CB_ALIGN_RIGHT)
- {
- x = rect.left + (rect.right-rect.left-iconwidth-textsize.cx);
- }
- else //centered
- {
- x = rect.right - rect.left - iconwidth;
- x = (x - textsize.cx) / 2;
- x += rect.left + iconwidth;
- }
- }
-
- y = rect.bottom - rect.top;
- y = (y - textsize.cy) / 2;
- y += rect.top;
-
- //calc icon position..
- ix = rect.left + 4;
- iy = rect.top + (rect.bottom-rect.top-32) / 2;
-
- //if button is pressed, then shift text
- if(fNormal == false && (uStyle & CB_PUSHBUTTON))
- {
- x += 1;
- y += 1;
- ix += 1;
- iy += 1;
- }
-
- SetRect(&cliprect, x, y, x+textsize.cx, y+textsize.cy);
- ExcludeClipRect(hdc, x, y, x+textsize.cx, y+textsize.cy);
-
- //
- // Calc icon pos
- //
-
- if(hIcon)
- {
- ExcludeClipRect(hdc, ix, iy, ix + 32, iy + 32);
- }
-
- if(uStyle & CB_PUSHBUTTON)
- {
- DrawRect(hdc, &rect, fNormal);
-
- SetBkColor(hdc, MAKE_PALETTERGB(crBack));
- SetTextColor(hdc, crText);//MAKE_PALETTERGB(crText));
-
- SelectClipRgn(hdc, 0);
-
- ExtTextOut(hdc, x, y, ETO_OPAQUE, &cliprect, szText, lstrlen(szText), 0);
- }
- else
- {
- SetBkColor(hdc, MAKE_PALETTERGB(crBack));
- SetTextColor(hdc, crText);//MAKE_PALETTERGB(crText));
-
- SelectClipRgn(hdc, 0);
-
- ExtTextOut(hdc, x, y, ETO_OPAQUE, &rect, szText, lstrlen(szText), 0);
- }
-
- if(hIcon)
- {
[truncated at 1000 lines; 29211 more skipped]