123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- #if _WIN32_WINNT < 0x0400
- #define _WIN32_WINNT 0x0400
- #endif
- #ifdef __cplusplus
- extern "C"
- {
- #endif
- #include "ComboXP.h"
- #include "ScrollXP.H"
- extern HHOOK g_hPrevHookXP ;
- extern PCLASSXP g_pClassXP ;
- extern COLORREF g_crDialogbkColor;
- VOID WINAPI ComboDrawComboBoxXP(PCLASSXP pCxp)
- {
- RECT Rect;
- MEMDCXP Mdcxp;
- HANDLE hHandle;
-
- GetWindowRect(pCxp->hWnd, &Rect);
- Rect.right -= Rect.left;
- Rect.bottom -= Rect.top;
- Rect.top = Rect.left = 0;
- if (Rect.bottom>2*GetSystemMetrics(SM_CYVTHUMB))
- return;
-
- Mdcxp.hWnd = pCxp->hWnd;
- Mdcxp.bTransfer = TRUE;
- Mdcxp.hBitmap = NULL;
- GetMemDCXP(&Mdcxp);
- #ifdef CXP_BKCOLOR
- hHandle = (HANDLE) CreateSolidBrush(
- (pCxp->lState & CXPS_DISABLED) ? (CXP_BKCOLOR - 0x00202020) : 0x00BD9E7B);
- #else
- hHandle = (HANDLE) CreateSolidBrush(
- (pCxp->dwState & CXPS_DISABLED) ? (GetSysColor(COLOR_BTNFACE) - 0x00202020) : 0x00BD9E7B);
- #endif
-
- FrameRect(Mdcxp.hMemDC, &Rect, (HBRUSH) hHandle);
- DeleteObject((HGDIOBJ) hHandle);
-
- InflateRect(&Rect, -1, -1);
- #ifdef CXP_BKCOLOR
- hHandle = (HANDLE) CreateSolidBrush(
- (pCxp->dwState & CXPS_DISABLED) ? CXP_BKCOLOR : GetSysColor(COLOR_WINDOW));
- #else
- hHandle = (HANDLE) GetSysColorBrush(
- (pCxp->dwState & CXPS_DISABLED) ? COLOR_BTNFACE : COLOR_WINDOW);
- #endif
- FrameRect(Mdcxp.hMemDC, &Rect, (HBRUSH) hHandle);
- InflateRect(&Rect, -1, -1);
- Rect.left = Rect.right - GetSystemMetrics(SM_CYVTHUMB);
- FrameRect(Mdcxp.hMemDC, &Rect, (HBRUSH) hHandle);
- #ifdef CXP_BKCOLOR
- DeleteObject(hHandle);
- #endif
- Rect.left++;
- ScrollDrowThumbXP(Mdcxp.hMemDC, Rect, pCxp->dwState | CXPH_DOWNWARDS | CXPH_LARGEARROW);
-
-
-
-
- Mdcxp.bTransfer = TRUE;
- ReleaseMemDCXP(&Mdcxp);
- }
- BOOL WINAPI ComboOnMouseDown(PCLASSXP pCxp)
- {
- RECT Rect;
- POINT point;
-
- GetWindowRect(pCxp->hWnd, &Rect);
- Rect.right -= Rect.left;
- Rect.bottom -= Rect.top;
- Rect.top = Rect.left = 0;
- GetCursorPos(&point);
- Rect.left = Rect.right - 2 * GetSystemMetrics(SM_CYVTHUMB);
- if(Rect.left < 0) Rect.left = 0;
- ScreenToClient(pCxp->hWnd, &point);
- if(!PtInRect(&Rect,point)) return FALSE;
- pCxp->dwState |= CXPS_PRESSED;
- ComboDrawComboBoxXP(pCxp);
- Sleep(300);
- pCxp->dwState &= ~CXPS_PRESSED;
- ComboDrawComboBoxXP(pCxp);
- return TRUE;
- }
- LRESULT ComboWindowProc(PCLASSXP pCxp, UINT message,WPARAM wParam, LPARAM lParam)
- {
- LONG lReturn;
- POINT point;
- HWND hWnd = pCxp->hWnd;
- switch (message)
- {
- case WM_NCPAINT:
- case WM_PAINT:
- lReturn = (LONG) CallWindowProc(pCxp->wpPrev, hWnd, message, wParam, lParam);
-
- ComboDrawComboBoxXP(pCxp);
- return lReturn;
-
- case WM_NCLBUTTONDOWN:
- return 0;
- case WM_LBUTTONDOWN:
- ComboOnMouseDown(pCxp);
- lReturn = (LONG) CallWindowProc(pCxp->wpPrev, hWnd, message, wParam, lParam);
- return lReturn;
- case WM_LBUTTONUP:
- pCxp->dwState &= ~CXPS_PRESSED;
- lReturn = (LONG) CallWindowProc(pCxp->wpPrev, hWnd, message, wParam, lParam);
- ComboDrawComboBoxXP(pCxp);
- return lReturn;
-
- break;
- }
- lReturn = (LONG) CallWindowProc(pCxp->wpPrev, hWnd, message, wParam, lParam);
- if (message == WM_NCDESTROY)
- DeleteClassXP(hWnd);
- return lReturn;
- }
- #ifdef __cplusplus
- }
- #endif
|