Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.3 KiB

  1. #include "ctlspriv.h"
  2. #include "unixstuff.h"
  3. EXTERN_C void UnixPaintArrow(HDC hDC, BOOL bHoriz, BOOL bDown, int nXCenter, int nYCenter,
  4. int nWidth, int nHeight)
  5. {
  6. HPEN hOldPen;
  7. HBRUSH hOldBrush;
  8. POINT pFigure[4];
  9. LOGBRUSH hBrLog = { BS_SOLID, GetSysColor( COLOR_BTNTEXT ), 0 };
  10. HBRUSH hBrush = CreateBrushIndirect( &hBrLog );
  11. HPEN hPen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNTEXT ) );
  12. if( hPen && hBrush )
  13. {
  14. hOldPen = (HPEN) SelectObject(hDC, hPen);
  15. hOldBrush = (HBRUSH) SelectObject(hDC, hBrush);
  16. }
  17. else
  18. {
  19. hOldPen = (HPEN) SelectObject(hDC, GetStockObject( BLACK_PEN ) );
  20. hOldBrush = (HBRUSH) SelectObject(hDC, GetStockObject( BLACK_BRUSH ) );
  21. }
  22. if(bHoriz) {
  23. if (bDown) {
  24. pFigure[0].x = nXCenter - nWidth /2;
  25. pFigure[0].y = nYCenter - nHeight/2;
  26. pFigure[1].x = nXCenter - nWidth /2;
  27. pFigure[1].y = nYCenter + nHeight/2;
  28. pFigure[2].x = nXCenter + nWidth /2;
  29. pFigure[2].y = nYCenter;
  30. } else {
  31. pFigure[0].x = nXCenter - nWidth /2;
  32. pFigure[0].y = nYCenter;
  33. pFigure[1].x = nXCenter + nWidth /2;
  34. pFigure[1].y = nYCenter + nHeight/2;
  35. pFigure[2].x = nXCenter + nWidth /2;
  36. pFigure[2].y = nYCenter - nHeight/2;
  37. }
  38. }
  39. else {
  40. if (bDown) {
  41. pFigure[0].x = nXCenter - nWidth /2;
  42. pFigure[0].y = nYCenter - nHeight/2;
  43. pFigure[1].x = nXCenter + nWidth /2;
  44. pFigure[1].y = nYCenter - nHeight/2;
  45. pFigure[2].x = nXCenter;
  46. pFigure[2].y = nYCenter + nHeight/2;
  47. } else {
  48. pFigure[0].x = nXCenter;
  49. pFigure[0].y = nYCenter - nHeight/2;
  50. pFigure[1].x = nXCenter - nWidth /2;
  51. pFigure[1].y = nYCenter + nHeight/2;
  52. pFigure[2].x = nXCenter + nWidth /2;
  53. pFigure[2].y = nYCenter + nHeight/2;
  54. }
  55. }
  56. Polygon(hDC, pFigure, 3);
  57. SelectObject(hDC, hOldPen);
  58. SelectObject(hDC, hOldBrush);
  59. if( hPen ) DeleteObject(hPen );
  60. if( hBrush ) DeleteObject(hBrush);
  61. }