ReactOS  0.4.14-dev-114-gc8cbd56
draw.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MY_BF_ACTIVEBORDER   0x1000000
 
#define MY_BF_INACTIVEBORDER   0x2000000
 

Functions

BOOL MyDrawFrameControl (HDC hDC, LPRECT rc, UINT uType, UINT uState, COLOR_SCHEME *scheme)
 
BOOL MyDrawEdge (HDC hDC, LPRECT rc, UINT edge, UINT flags, COLOR_SCHEME *scheme)
 
VOID MyDrawCaptionButtons (HDC hdc, LPRECT lpRect, BOOL bMinMax, int x, COLOR_SCHEME *scheme)
 
VOID MyDrawScrollbar (HDC hdc, LPRECT rc, HBRUSH hbrScrollbar, COLOR_SCHEME *scheme)
 
BOOL MyDrawCaptionTemp (HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, HICON hIcon, LPCWSTR str, UINT uFlags, COLOR_SCHEME *scheme)
 
DWORD MyDrawMenuBarTemp (HWND Wnd, HDC DC, LPRECT Rect, HMENU Menu, HFONT Font, COLOR_SCHEME *scheme)
 

Macro Definition Documentation

◆ MY_BF_ACTIVEBORDER

#define MY_BF_ACTIVEBORDER   0x1000000

Definition at line 16 of file draw.h.

◆ MY_BF_INACTIVEBORDER

#define MY_BF_INACTIVEBORDER   0x2000000

Definition at line 17 of file draw.h.

Function Documentation

◆ MyDrawCaptionButtons()

VOID MyDrawCaptionButtons ( HDC  hdc,
LPRECT  lpRect,
BOOL  bMinMax,
int  x,
COLOR_SCHEME scheme 
)

Definition at line 392 of file draw.c.

393 {
394  RECT rc3;
395  RECT rc4;
396  RECT rc5;
397 
398  rc3.left = lpRect->right - 2 - x;
399  rc3.top = lpRect->top + 2;
400  rc3.right = lpRect->right - 2;
401  rc3.bottom = lpRect->bottom - 2;
402 
404 
405  if (bMinMax)
406  {
407  rc4.left = rc3.left - x - 2;
408  rc4.top = rc3.top;
409  rc4.right = rc3.right - x - 2;
410  rc4.bottom = rc3.bottom;
411 
413 
414  rc5.left = rc4.left - x;
415  rc5.top = rc4.top;
416  rc5.right = rc4.right - x;
417  rc5.bottom = rc4.bottom;
418 
420  }
421 }
BOOL MyDrawFrameControl(HDC hDC, LPRECT rc, UINT uType, UINT uState, COLOR_SCHEME *scheme)
Definition: draw.c:371
LONG top
Definition: windef.h:292
DWORD scheme
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
static const WCHAR rc4[]
Definition: oid.c:1217
#define DFCS_CAPTIONCLOSE
Definition: winuser.h:480
HDC hdc
Definition: main.c:9
#define DFC_CAPTION
Definition: winuser.h:473
#define DFCS_CAPTIONMAX
Definition: winuser.h:482
LONG bottom
Definition: windef.h:294
#define DFCS_CAPTIONMIN
Definition: winuser.h:481

Referenced by OnPaint().

◆ MyDrawCaptionTemp()

BOOL MyDrawCaptionTemp ( HWND  hwnd,
HDC  hdc,
const RECT rect,
HFONT  hFont,
HICON  hIcon,
LPCWSTR  str,
UINT  uFlags,
COLOR_SCHEME scheme 
)

Definition at line 457 of file draw.c.

458 {
459  //ULONG Height;
460  //UINT VCenter, Padding;
461  //LONG ButtonWidth;
462  HBRUSH hbr;
463  HGDIOBJ hFontOld;
464  RECT rc;
465 
466  //Height = scheme->Size[SIZE_CAPTION_Y] - 1;
467  //VCenter = (rect->bottom - rect->top) / 2;
468  //Padding = VCenter - (Height / 2);
469 
470  //ButtonWidth = scheme->Size[SIZE_SIZE_X] - 2;
471 
472  if (uFlags & DC_GRADIENT)
473  {
474  GRADIENT_RECT gcap = {0, 1};
475  TRIVERTEX vert[2];
476  COLORREF Colors[2];
477 
478  Colors[0] = scheme->crColor[((uFlags & DC_ACTIVE) ?
480  Colors[1] = scheme->crColor[((uFlags & DC_ACTIVE) ?
482 
483  vert[0].x = rect->left;
484  vert[0].y = rect->top;
485  vert[0].Red = (WORD)Colors[0]<<8;
486  vert[0].Green = (WORD)Colors[0] & 0xFF00;
487  vert[0].Blue = (WORD)(Colors[0]>>8) & 0xFF00;
488  vert[0].Alpha = 0;
489 
490  vert[1].x = rect->right;
491  vert[1].y = rect->bottom;
492  vert[1].Red = (WORD)Colors[1]<<8;
493  vert[1].Green = (WORD)Colors[1] & 0xFF00;
494  vert[1].Blue = (WORD)(Colors[1]>>8) & 0xFF00;
495  vert[1].Alpha = 0;
496 
497  GdiGradientFill(hdc, vert, 2, &gcap, 1, GRADIENT_FILL_RECT_H);
498  }
499  else
500  {
501  if (uFlags & DC_ACTIVE)
503  else
505  FillRect(hdc, rect, hbr);
506  DeleteObject(hbr);
507  }
508 
509  hFontOld = SelectObject(hdc, hFont);
511  if (uFlags & DC_ACTIVE)
513  else
515  rc.left = rect->left + 2;
516  rc.top = rect->top;
517  rc.right = rect->right;
518  rc.bottom = rect->bottom;
519  DrawTextW(hdc, str, -1, &rc, DT_SINGLELINE | DT_VCENTER);
520  SelectObject(hdc, hFontOld);
521  return TRUE;
522 }
#define TRUE
Definition: types.h:120
LONG top
Definition: windef.h:292
DWORD scheme
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define COLOR_INACTIVECAPTION
Definition: winuser.h:906
#define COLOR_CAPTIONTEXT
Definition: winuser.h:912
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
LONG left
Definition: windef.h:291
UINT uFlags
Definition: api.c:60
LONG right
Definition: windef.h:293
INT WINAPI FillRect(HDC hDC, CONST RECT *lprc, HBRUSH hbr)
Definition: draw.c:1053
& rect
Definition: startmenu.cpp:1413
HFONT hFont
Definition: main.c:53
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
LONG y
Definition: wingdi.h:2780
#define COLOR_GRADIENTINACTIVECAPTION
Definition: winuser.h:935
#define TRANSPARENT
Definition: wingdi.h:949
const WCHAR * str
#define COLOR_ACTIVECAPTION
Definition: winuser.h:905
#define DT_VCENTER
Definition: winuser.h:543
#define DC_ACTIVE
Definition: winuser.h:427
LONG x
Definition: wingdi.h:2779
DWORD COLORREF
Definition: windef.h:285
Colors
Definition: ansiprsr.h:4
unsigned short WORD
Definition: ntddk_ex.h:93
#define COLOR_GRADIENTACTIVECAPTION
Definition: winuser.h:934
HDC hdc
Definition: main.c:9
#define COLOR_INACTIVECAPTIONTEXT
Definition: winuser.h:924
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
#define DT_SINGLELINE
Definition: winuser.h:540
COLOR16 Alpha
Definition: wingdi.h:2784
BOOL WINAPI GdiGradientFill(HDC hdc, TRIVERTEX *vert_array, ULONG nvert, void *grad_array, ULONG ngrad, ULONG mode)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
COLOR16 Red
Definition: wingdi.h:2781
COLOR16 Blue
Definition: wingdi.h:2783
LONG bottom
Definition: windef.h:294
COLOR16 Green
Definition: wingdi.h:2782
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17

Referenced by OnPaint().

◆ MyDrawEdge()

BOOL MyDrawEdge ( HDC  hDC,
LPRECT  rc,
UINT  edge,
UINT  flags,
COLOR_SCHEME scheme 
)

Definition at line 386 of file draw.c.

387 {
388  return MyIntDrawRectEdge(hDC, rc, edge, flags, scheme);
389 }
DWORD scheme
GLbitfield flags
Definition: glext.h:7161
static HDC hDC
Definition: 3dtext.c:33
static BOOL MyIntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags, COLOR_SCHEME *scheme)
Definition: draw.c:59

Referenced by OnPaint().

◆ MyDrawFrameControl()

BOOL MyDrawFrameControl ( HDC  hDC,
LPRECT  rc,
UINT  uType,
UINT  uState,
COLOR_SCHEME scheme 
)

Definition at line 371 of file draw.c.

372 {
373  switch(uType)
374  {
375  case DFC_BUTTON:
376  return MyDrawFrameButton(hDC, rc, uState, scheme);
377  case DFC_CAPTION:
378  return MyDrawFrameCaption(hDC, rc, uState, scheme);
379  case DFC_SCROLL:
380  return MyDrawFrameScroll(hDC, rc, uState, scheme);
381  }
382  return FALSE;
383 }
#define DFC_BUTTON
Definition: winuser.h:476
DWORD scheme
static BOOL MyDrawFrameButton(HDC hdc, LPRECT rc, UINT uState, COLOR_SCHEME *scheme)
Definition: draw.c:198
static BOOL MyDrawFrameScroll(HDC dc, LPRECT r, UINT uFlags, COLOR_SCHEME *scheme)
Definition: draw.c:302
#define DFC_CAPTION
Definition: winuser.h:473
static HDC hDC
Definition: 3dtext.c:33
#define DFC_SCROLL
Definition: winuser.h:475
static BOOL MyDrawFrameCaption(HDC dc, LPRECT r, UINT uFlags, COLOR_SCHEME *scheme)
Definition: draw.c:233

Referenced by MyDrawCaptionButtons(), MyDrawScrollbar(), and OnPaint().

◆ MyDrawMenuBarTemp()

DWORD MyDrawMenuBarTemp ( HWND  Wnd,
HDC  DC,
LPRECT  Rect,
HMENU  Menu,
HFONT  Font,
COLOR_SCHEME scheme 
)

Definition at line 527 of file draw.c.

528 {
529  HBRUSH hbr;
530  HPEN hPen;
531  HGDIOBJ hPenOld, hFontOld;
532  BOOL flat_menu;
533  INT i, bkgnd, x;
534  RECT rect;
535  WCHAR Text[128];
536  UINT uFormat = DT_CENTER | DT_VCENTER | DT_SINGLELINE;
537 
538  flat_menu = scheme->bFlatMenus;
539 
540  if (flat_menu)
541  hbr = CreateSolidBrush(scheme->crColor[COLOR_MENUBAR]);
542  else
543  hbr = CreateSolidBrush(scheme->crColor[COLOR_MENU]);
544  FillRect(DC, Rect, hbr);
545  DeleteObject(hbr);
546 
547  hPen = CreatePen(PS_SOLID, 0, scheme->crColor[COLOR_3DFACE]);
548  hPenOld = SelectObject(DC, hPen);
549  MoveToEx(DC, Rect->left, Rect->bottom - 1, NULL);
550  LineTo(DC, Rect->right, Rect->bottom - 1);
551  SelectObject(DC, hPenOld);
552  DeleteObject(hPen);
553 
554  bkgnd = (flat_menu ? COLOR_MENUBAR : COLOR_MENU);
555  x = Rect->left;
556  hFontOld = SelectObject(DC, Font);
557  for (i = 0; i < 3; i++)
558  {
559  GetMenuStringW(Menu, i, Text, 128, MF_BYPOSITION);
560 
561  rect.left = rect.right = x;
562  rect.top = Rect->top;
563  rect.bottom = Rect->bottom;
565  rect.bottom = Rect->bottom;
566  rect.right += MENU_BAR_ITEMS_SPACE;
567  x += rect.right - rect.left;
568 
569  if (i == 2)
570  {
571  if (flat_menu)
572  {
574  SetBkColor(DC, scheme->crColor[COLOR_HIGHLIGHT]);
575 
576  InflateRect (&rect, -1, -1);
577  hbr = CreateSolidBrush(scheme->crColor[COLOR_MENUHILIGHT]);
578  FillRect(DC, &rect, hbr);
579  DeleteObject(hbr);
580 
581  InflateRect (&rect, 1, 1);
582  hbr = CreateSolidBrush(scheme->crColor[COLOR_HIGHLIGHT]);
583  FrameRect(DC, &rect, hbr);
584  DeleteObject(hbr);
585  }
586  else
587  {
588  SetTextColor(DC, scheme->crColor[COLOR_MENUTEXT]);
589  SetBkColor(DC, scheme->crColor[COLOR_MENU]);
591  }
592  }
593  else
594  {
595  if (i == 1)
596  SetTextColor(DC, scheme->crColor[COLOR_GRAYTEXT]);
597  else
598  SetTextColor(DC, scheme->crColor[COLOR_MENUTEXT]);
599 
600  SetBkColor(DC, scheme->crColor[bkgnd]);
601  hbr = CreateSolidBrush(scheme->crColor[bkgnd]);
602  FillRect(DC, &rect, hbr);
603  DeleteObject(hbr);
604  }
605 
607 
608  rect.left += MENU_BAR_ITEMS_SPACE / 2;
609  rect.right -= MENU_BAR_ITEMS_SPACE / 2;
610 
611  if (i == 1)
612  {
613  ++rect.left; ++rect.top; ++rect.right; ++rect.bottom;
615  DrawTextW(DC, Text, -1, &rect, uFormat);
616  --rect.left; --rect.top; --rect.right; --rect.bottom;
618  }
619  DrawTextW(DC, Text, -1, &rect, uFormat);
620  }
621  SelectObject(DC, hFontOld);
622 
623  return TRUE;
624 }
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define TRUE
Definition: types.h:120
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
DWORD scheme
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define COLOR_BTNHIGHLIGHT
Definition: winuser.h:925
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
INT WINAPI FillRect(HDC hDC, CONST RECT *lprc, HBRUSH hbr)
Definition: draw.c:1053
int32_t INT
Definition: typedefs.h:56
& rect
Definition: startmenu.cpp:1413
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define BF_RECT
Definition: winuser.h:462
#define PS_SOLID
Definition: wingdi.h:585
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define COLOR_3DFACE
Definition: winuser.h:919
int WINAPI GetMenuStringW(_In_ HMENU hMenu, _In_ UINT uIDItem, _Out_writes_opt_(cchMax) LPWSTR lpString, _In_ int cchMax, _In_ UINT flags)
#define DT_CALCRECT
Definition: winuser.h:526
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MF_BYPOSITION
Definition: winuser.h:203
#define TRANSPARENT
Definition: wingdi.h:949
smooth NULL
Definition: ftsmooth.c:416
#define COLOR_MENU
Definition: winuser.h:907
#define DT_VCENTER
Definition: winuser.h:543
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:917
Definition: polytest.cpp:40
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define COLOR_MENUTEXT
Definition: winuser.h:910
#define COLOR_GRAYTEXT
Definition: winuser.h:922
BOOL WINAPI DrawEdge(HDC hDC, LPRECT rc, UINT edge, UINT flags)
Definition: draw.c:1081
#define BDR_SUNKENOUTER
Definition: winuser.h:443
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
#define DT_SINGLELINE
Definition: winuser.h:540
#define COLOR_BTNSHADOW
Definition: winuser.h:920
unsigned int UINT
Definition: ndis.h:50
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define DT_CENTER
Definition: winuser.h:527
INT WINAPI FrameRect(HDC hDC, CONST RECT *lprc, HBRUSH hbr)
Definition: draw.c:1034
char * Text
Definition: combotst.c:136
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17
#define MENU_BAR_ITEMS_SPACE
Definition: draw.c:12

Referenced by OnPaint().

◆ MyDrawScrollbar()

VOID MyDrawScrollbar ( HDC  hdc,
LPRECT  rc,
HBRUSH  hbrScrollbar,
COLOR_SCHEME scheme 
)

Definition at line 424 of file draw.c.

425 {
426  RECT rcTop;
427  RECT rcBottom;
428  RECT rcMiddle;
429  int width;
430 
431  width = rc->right - rc->left;
432 
433  rcTop.left = rc->left;
434  rcTop.right = rc->right;
435  rcTop.top = rc->top;
436  rcTop.bottom = rc->top + width;
437 
438  rcMiddle.left = rc->left;
439  rcMiddle.right = rc->right;
440  rcMiddle.top = rc->top + width;
441  rcMiddle.bottom = rc->bottom - width;
442 
443  rcBottom.left = rc->left;
444  rcBottom.right = rc->right;
445  rcBottom.top = rc->bottom - width;
446  rcBottom.bottom = rc->bottom;
447 
450 
451  FillRect(hdc, &rcMiddle, hbrScrollbar);
452 }
GLint GLint GLsizei width
Definition: gl.h:1546
BOOL MyDrawFrameControl(HDC hDC, LPRECT rc, UINT uType, UINT uState, COLOR_SCHEME *scheme)
Definition: draw.c:371
LONG top
Definition: windef.h:292
DWORD scheme
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
INT WINAPI FillRect(HDC hDC, CONST RECT *lprc, HBRUSH hbr)
Definition: draw.c:1053
#define DFCS_SCROLLDOWN
Definition: winuser.h:490
#define DFCS_SCROLLUP
Definition: winuser.h:489
HDC hdc
Definition: main.c:9
#define DFC_SCROLL
Definition: winuser.h:475
LONG bottom
Definition: windef.h:294

Referenced by OnPaint().