ReactOS 0.4.15-dev-7942-gd23573b
draw.c File Reference
#include "desk.h"
Include dependency graph for draw.c:

Go to the source code of this file.

Macros

#define MENU_BAR_ITEMS_SPACE   (12)
 

Functions

static BOOL MyIntDrawRectEdge (HDC hdc, LPRECT rc, UINT uType, UINT uFlags, COLOR_SCHEME *scheme)
 
static BOOL MyDrawFrameButton (HDC hdc, LPRECT rc, UINT uState, COLOR_SCHEME *scheme)
 
static int MyMakeSquareRect (LPRECT src, LPRECT dst)
 
static BOOL MyDrawFrameCaption (HDC dc, LPRECT r, UINT uFlags, COLOR_SCHEME *scheme)
 
static BOOL MyDrawFrameScroll (HDC dc, LPRECT r, UINT uFlags, COLOR_SCHEME *scheme)
 
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)
 

Variables

static const signed char LTInnerNormal []
 
static const signed char LTOuterNormal []
 
static const signed char RBInnerNormal []
 
static const signed char RBOuterNormal []
 
static const signed char LTRBOuterMono []
 
static const signed char LTRBInnerMono []
 

Macro Definition Documentation

◆ MENU_BAR_ITEMS_SPACE

#define MENU_BAR_ITEMS_SPACE   (12)

Definition at line 12 of file draw.c.

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
static const WCHAR rc4[]
Definition: oid.c:1217
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HDC hdc
Definition: main.c:9
DWORD scheme
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define DFCS_CAPTIONMIN
Definition: winuser.h:481
#define DFCS_CAPTIONCLOSE
Definition: winuser.h:480
#define DFC_CAPTION
Definition: winuser.h:473
#define DFCS_CAPTIONMAX
Definition: winuser.h:482

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;
520 SelectObject(hdc, hFontOld);
521 return TRUE;
522}
Colors
Definition: ansiprsr.h:4
HFONT hFont
Definition: main.c:53
#define DC_ACTIVE
Definition: dc21x4.h:120
#define TRUE
Definition: types.h:120
UINT uFlags
Definition: api.c:59
unsigned short WORD
Definition: ntddk_ex.h:93
pKey DeleteObject()
BOOL WINAPI GdiGradientFill(HDC hdc, TRIVERTEX *vert_array, ULONG nvert, void *grad_array, ULONG ngrad, ULONG mode)
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
const WCHAR * str
& rect
Definition: startmenu.cpp:1413
COLOR16 Red
Definition: wingdi.h:2786
LONG y
Definition: wingdi.h:2785
COLOR16 Green
Definition: wingdi.h:2787
COLOR16 Alpha
Definition: wingdi.h:2789
COLOR16 Blue
Definition: wingdi.h:2788
LONG x
Definition: wingdi.h:2784
DWORD COLORREF
Definition: windef.h:300
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define TRANSPARENT
Definition: wingdi.h:950
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define COLOR_INACTIVECAPTIONTEXT
Definition: winuser.h:934
#define COLOR_GRADIENTINACTIVECAPTION
Definition: winuser.h:945
#define DT_SINGLELINE
Definition: winuser.h:540
#define COLOR_ACTIVECAPTION
Definition: winuser.h:915
#define COLOR_INACTIVECAPTION
Definition: winuser.h:916
#define COLOR_GRADIENTACTIVECAPTION
Definition: winuser.h:944
#define DT_VCENTER
Definition: winuser.h:543
#define COLOR_CAPTIONTEXT
Definition: winuser.h:922

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}
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
GLbitfield flags
Definition: glext.h:7161

Referenced by OnPaint().

◆ MyDrawFrameButton()

static BOOL MyDrawFrameButton ( HDC  hdc,
LPRECT  rc,
UINT  uState,
COLOR_SCHEME scheme 
)
static

Definition at line 198 of file draw.c.

199{
200 UINT edge;
201 if (uState & (DFCS_PUSHED | DFCS_CHECKED | DFCS_FLAT))
202 edge = EDGE_SUNKEN;
203 else
204 edge = EDGE_RAISED;
205 return MyIntDrawRectEdge(hdc, rc, edge, (uState & DFCS_FLAT) | BF_RECT | BF_SOFT, scheme);
206}
unsigned int UINT
Definition: ndis.h:50
#define EDGE_SUNKEN
Definition: winuser.h:451
#define DFCS_FLAT
Definition: winuser.h:510
#define DFCS_CHECKED
Definition: winuser.h:504
#define BF_SOFT
Definition: winuser.h:469
#define BF_RECT
Definition: winuser.h:462
#define EDGE_RAISED
Definition: winuser.h:450
#define DFCS_PUSHED
Definition: winuser.h:503

Referenced by MyDrawFrameControl().

◆ MyDrawFrameCaption()

static BOOL MyDrawFrameCaption ( HDC  dc,
LPRECT  r,
UINT  uFlags,
COLOR_SCHEME scheme 
)
static

Definition at line 233 of file draw.c.

234{
235 LOGFONT lf;
236 HFONT hFont, hOldFont;
237 COLORREF clrsave;
238 RECT myr;
239 INT bkmode;
241 switch(uFlags & 0xff)
242 {
244 Symbol = 'r';
245 break;
246 case DFCS_CAPTIONHELP:
247 Symbol = 's';
248 break;
249 case DFCS_CAPTIONMIN:
250 Symbol = '0';
251 break;
252 case DFCS_CAPTIONMAX:
253 Symbol = '1';
254 break;
256 Symbol = '2';
257 break;
258 default:
259 return FALSE;
260 }
262 ZeroMemory(&lf, sizeof(lf));
263 MyMakeSquareRect(r, &myr);
264 myr.left += 1;
265 myr.top += 1;
266 myr.right -= 1;
267 myr.bottom -= 1;
268 if (uFlags & DFCS_PUSHED)
269 OffsetRect(&myr,1,1);
270 lf.lfHeight = myr.bottom - myr.top;
271 lf.lfWidth = 0;
272 lf.lfWeight = FW_NORMAL;
274 lstrcpy(lf.lfFaceName, TEXT("Marlett"));
276 /* Save font and text color */
277 hOldFont = SelectObject(dc, hFont);
278 clrsave = GetTextColor(dc);
279 bkmode = GetBkMode(dc);
280 /* Set color and drawing mode */
282 if (uFlags & DFCS_INACTIVE)
283 {
284 /* Draw shadow */
286 TextOut(dc, myr.left + 1, myr.top + 1, &Symbol, 1);
287 }
289 /* Draw selected symbol */
290 TextOut(dc, myr.left, myr.top, &Symbol, 1);
291 /* Restore previous settings */
292 SetTextColor(dc, clrsave);
293 SelectObject(dc, hOldFont);
294 SetBkMode(dc, bkmode);
296 return TRUE;
297}
Definition: Symbol.h:9
#define FALSE
Definition: types.h:117
static int MyMakeSquareRect(LPRECT src, LPRECT dst)
Definition: draw.c:209
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define TEXT(s)
Definition: k32.h:26
static const WCHAR dc[]
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
LONG lfHeight
Definition: dimm.idl:42
BYTE lfCharSet
Definition: dimm.idl:50
LONG lfWeight
Definition: dimm.idl:46
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
LONG lfWidth
Definition: dimm.idl:43
int32_t INT
Definition: typedefs.h:58
#define ZeroMemory
Definition: winbase.h:1712
#define lstrcpy
Definition: winbase.h:3874
int WINAPI GetBkMode(_In_ HDC)
COLORREF WINAPI GetTextColor(_In_ HDC)
Definition: text.c:861
#define DEFAULT_CHARSET
Definition: wingdi.h:384
#define FW_NORMAL
Definition: wingdi.h:373
#define CreateFontIndirect
Definition: wingdi.h:4444
#define TextOut
Definition: wingdi.h:4483
#define COLOR_BTNTEXT
Definition: winuser.h:933
#define DFCS_INACTIVE
Definition: winuser.h:502
#define BF_MIDDLE
Definition: winuser.h:468
#define DFCS_CAPTIONRESTORE
Definition: winuser.h:483
#define COLOR_BTNSHADOW
Definition: winuser.h:930
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define COLOR_BTNHIGHLIGHT
Definition: winuser.h:935
#define DFCS_CAPTIONHELP
Definition: winuser.h:484
char TCHAR
Definition: xmlstorage.h:189

Referenced by MyDrawFrameControl().

◆ 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}
static BOOL MyDrawFrameCaption(HDC dc, LPRECT r, UINT uFlags, COLOR_SCHEME *scheme)
Definition: draw.c:233
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_SCROLL
Definition: winuser.h:475
#define DFC_BUTTON
Definition: winuser.h:476

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

◆ MyDrawFrameScroll()

static BOOL MyDrawFrameScroll ( HDC  dc,
LPRECT  r,
UINT  uFlags,
COLOR_SCHEME scheme 
)
static

Definition at line 302 of file draw.c.

303{
304 LOGFONT lf;
305 HFONT hFont, hOldFont;
306 COLORREF clrsave;
307 RECT myr;
308 INT bkmode;
310 switch(uFlags & 0xff)
311 {
313 case DFCS_SCROLLDOWN:
314 Symbol = '6';
315 break;
316
317 case DFCS_SCROLLUP:
318 Symbol = '5';
319 break;
320
321 case DFCS_SCROLLLEFT:
322 Symbol = '3';
323 break;
324
325 case DFCS_SCROLLRIGHT:
326 Symbol = '4';
327 break;
328
329 default:
330 return FALSE;
331 }
333 ZeroMemory(&lf, sizeof(lf));
334 MyMakeSquareRect(r, &myr);
335 myr.left += 1;
336 myr.top += 1;
337 myr.right -= 1;
338 myr.bottom -= 1;
339 if (uFlags & DFCS_PUSHED)
340 OffsetRect(&myr,1,1);
341 lf.lfHeight = myr.bottom - myr.top;
342 lf.lfWidth = 0;
343 lf.lfWeight = FW_NORMAL;
345 lstrcpy(lf.lfFaceName, TEXT("Marlett"));
347 /* Save font and text color */
348 hOldFont = SelectObject(dc, hFont);
349 clrsave = GetTextColor(dc);
350 bkmode = GetBkMode(dc);
351 /* Set color and drawing mode */
353 if (uFlags & DFCS_INACTIVE)
354 {
355 /* Draw shadow */
357 TextOut(dc, myr.left + 1, myr.top + 1, &Symbol, 1);
358 }
360 /* Draw selected symbol */
361 TextOut(dc, myr.left, myr.top, &Symbol, 1);
362 /* restore previous settings */
363 SetTextColor(dc, clrsave);
364 SelectObject(dc, hOldFont);
365 SetBkMode(dc, bkmode);
367 return TRUE;
368}
#define DFCS_SCROLLUP
Definition: winuser.h:489
#define DFCS_SCROLLCOMBOBOX
Definition: winuser.h:493
#define DFCS_SCROLLLEFT
Definition: winuser.h:491
#define DFCS_SCROLLRIGHT
Definition: winuser.h:492
#define DFCS_SCROLLDOWN
Definition: winuser.h:490

Referenced by MyDrawFrameControl().

◆ 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];
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 {
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 {
589 SetBkColor(DC, scheme->crColor[COLOR_MENU]);
591 }
592 }
593 else
594 {
595 if (i == 1)
597 else
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}
char * Text
Definition: combotst.c:136
#define NULL
Definition: types.h:112
#define MENU_BAR_ITEMS_SPACE
Definition: draw.c:12
unsigned int BOOL
Definition: ntddk_ex.h:94
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
Definition: polytest.cpp:41
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
#define PS_SOLID
Definition: wingdi.h:586
int WINAPI FrameRect(_In_ HDC, _In_ LPCRECT, _In_ HBRUSH)
#define BDR_SUNKENOUTER
Definition: winuser.h:443
#define COLOR_MENU
Definition: winuser.h:917
#define COLOR_GRAYTEXT
Definition: winuser.h:932
#define DT_CENTER
Definition: winuser.h:527
int WINAPI GetMenuStringW(_In_ HMENU hMenu, _In_ UINT uIDItem, _Out_writes_opt_(cchMax) LPWSTR lpString, _In_ int cchMax, _In_ UINT flags)
#define COLOR_HIGHLIGHT
Definition: winuser.h:926
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define MF_BYPOSITION
Definition: winuser.h:203
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:927
#define COLOR_MENUTEXT
Definition: winuser.h:920
#define DT_CALCRECT
Definition: winuser.h:526
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define COLOR_3DFACE
Definition: winuser.h:929
__wchar_t WCHAR
Definition: xmlstorage.h:180

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

Referenced by OnPaint().

◆ MyIntDrawRectEdge()

static BOOL MyIntDrawRectEdge ( HDC  hdc,
LPRECT  rc,
UINT  uType,
UINT  uFlags,
COLOR_SCHEME scheme 
)
static

Definition at line 59 of file draw.c.

60{
61 signed char LTInnerI, LTOuterI;
62 signed char RBInnerI, RBOuterI;
63 HPEN LTInnerPen, LTOuterPen;
64 HPEN RBInnerPen, RBOuterPen;
65 RECT InnerRect = *rc;
66 POINT SavePoint;
67 HPEN SavePen;
68 int LBpenplus = 0;
69 int LTpenplus = 0;
70 int RTpenplus = 0;
71 int RBpenplus = 0;
72 HBRUSH hbr;
73
74 /* Init some vars */
75 LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN);
76 SavePen = (HPEN)SelectObject(hdc, LTInnerPen);
77
78 /* Determine the colors of the edges */
79 LTInnerI = LTInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
80 LTOuterI = LTOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
81 RBInnerI = RBInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
82 RBOuterI = RBOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
83
85 LBpenplus = 1;
87 RTpenplus = 1;
89 RBpenplus = 1;
90 if ((uFlags & BF_TOPLEFT) == BF_TOPLEFT)
91 LTpenplus = 1;
92
95 else
96 hbr = CreateSolidBrush(scheme->crColor[COLOR_BTNFACE]);
97
98 FillRect(hdc, &InnerRect, hbr);
99 DeleteObject(hbr);
100
101 MoveToEx(hdc, 0, 0, &SavePoint);
102
103 /* Draw the outer edge */
104 if (LTOuterI != -1)
105 {
106 LTOuterPen = GetStockObject(DC_PEN);
107 SelectObject(hdc, LTOuterPen);
108 SetDCPenColor(hdc, scheme->crColor[LTOuterI]);
109 if (uFlags & BF_TOP)
110 {
111 MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
112 LineTo(hdc, InnerRect.right, InnerRect.top);
113 }
114 if (uFlags & BF_LEFT)
115 {
116 MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
117 LineTo(hdc, InnerRect.left, InnerRect.bottom);
118 }
119 }
120
121 if (RBOuterI != -1)
122 {
123 RBOuterPen = GetStockObject(DC_PEN);
124 SelectObject(hdc, RBOuterPen);
125 SetDCPenColor(hdc, scheme->crColor[RBOuterI]);
126 if (uFlags & BF_BOTTOM)
127 {
128 MoveToEx(hdc, InnerRect.left, InnerRect.bottom-1, NULL);
129 LineTo(hdc, InnerRect.right, InnerRect.bottom-1);
130 }
131 if (uFlags & BF_RIGHT)
132 {
133 MoveToEx(hdc, InnerRect.right-1, InnerRect.top, NULL);
134 LineTo(hdc, InnerRect.right-1, InnerRect.bottom);
135 }
136 }
137
138 /* Draw the inner edge */
139 if (LTInnerI != -1)
140 {
141 LTInnerPen = GetStockObject(DC_PEN);
142 SelectObject(hdc, LTInnerPen);
143 SetDCPenColor(hdc, scheme->crColor[LTInnerI]);
144 if (uFlags & BF_TOP)
145 {
146 MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL);
147 LineTo(hdc, InnerRect.right-RTpenplus, InnerRect.top+1);
148 }
149 if (uFlags & BF_LEFT)
150 {
151 MoveToEx(hdc, InnerRect.left+1, InnerRect.top+LTpenplus, NULL);
152 LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus);
153 }
154 }
155
156 if (RBInnerI != -1)
157 {
158 RBInnerPen = GetStockObject(DC_PEN);
159 SelectObject(hdc, RBInnerPen);
160 SetDCPenColor(hdc, scheme->crColor[RBInnerI]);
161 if (uFlags & BF_BOTTOM)
162 {
163 MoveToEx(hdc, InnerRect.left+LBpenplus, InnerRect.bottom-2, NULL);
164 LineTo(hdc, InnerRect.right-RBpenplus, InnerRect.bottom-2);
165 }
166 if (uFlags & BF_RIGHT)
167 {
168 MoveToEx(hdc, InnerRect.right-2, InnerRect.top+RTpenplus, NULL);
169 LineTo(hdc, InnerRect.right-2, InnerRect.bottom-RBpenplus);
170 }
171 }
172
173 if (uFlags & BF_ADJUST)
174 {
175 int add = (LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0)
176 + (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0);
177
178 if (uFlags & BF_LEFT)
179 InnerRect.left += add;
180 if (uFlags & BF_RIGHT)
181 InnerRect.right -= add;
182 if (uFlags & BF_TOP)
183 InnerRect.top += add;
184 if (uFlags & BF_BOTTOM)
185 InnerRect.bottom -= add;
186
187 if (uFlags & BF_ADJUST)
188 *rc = InnerRect;
189 }
190
191 /* Cleanup */
192 SelectObject(hdc, SavePen);
193 MoveToEx(hdc, SavePoint.x, SavePoint.y, NULL);
194 return TRUE;
195}
static const signed char LTOuterNormal[]
Definition: draw.c:23
static const signed char LTRBInnerMono[]
Definition: draw.c:51
static const signed char RBOuterNormal[]
Definition: draw.c:37
static const signed char LTRBOuterMono[]
Definition: draw.c:44
static const signed char LTInnerNormal[]
Definition: draw.c:16
static const signed char RBInnerNormal[]
Definition: draw.c:30
#define MY_BF_ACTIVEBORDER
Definition: draw.h:16
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
COLORREF WINAPI SetDCPenColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: dc.c:941
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define NULL_PEN
Definition: wingdi.h:904
#define BDR_INNER
Definition: winuser.h:447
#define BF_LEFT
Definition: winuser.h:454
#define BF_ADJUST
Definition: winuser.h:470
#define BF_BOTTOM
Definition: winuser.h:457
#define BF_TOP
Definition: winuser.h:455
#define BF_BOTTOMRIGHT
Definition: winuser.h:461
#define BF_RIGHT
Definition: winuser.h:456
#define COLOR_ACTIVEBORDER
Definition: winuser.h:923
#define BF_TOPRIGHT
Definition: winuser.h:459
#define BF_TOPLEFT
Definition: winuser.h:458
#define BDR_OUTER
Definition: winuser.h:446
#define BF_BOTTOMLEFT
Definition: winuser.h:460
#define COLOR_BTNFACE
Definition: winuser.h:928

Referenced by MyDrawEdge(), MyDrawFrameButton(), MyDrawFrameCaption(), and MyDrawFrameScroll().

◆ MyMakeSquareRect()

static int MyMakeSquareRect ( LPRECT  src,
LPRECT  dst 
)
static

Definition at line 209 of file draw.c.

210{
211 int Width = src->right - src->left;
212 int Height = src->bottom - src->top;
213 int SmallDiam = Width > Height ? Height : Width;
214
215 *dst = *src;
216
217 /* Make it a square box */
218 if (Width < Height) /* SmallDiam == Width */
219 {
220 dst->top += (Height-Width)/2;
221 dst->bottom = dst->top + SmallDiam;
222 }
223 else if (Width > Height) /* SmallDiam == Height */
224 {
225 dst->left += (Width-Height)/2;
226 dst->right = dst->left + SmallDiam;
227 }
228
229 return SmallDiam;
230}
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88

Referenced by MyDrawFrameCaption(), and MyDrawFrameScroll().

Variable Documentation

◆ LTInnerNormal

const signed char LTInnerNormal[]
static
Initial value:
= {
-1, -1, -1, -1,
-1, -1, -1, -1
}
#define COLOR_3DDKSHADOW
Definition: winuser.h:939

Definition at line 16 of file draw.c.

Referenced by draw_diag_edge(), draw_rect_edge(), IntDrawDiagEdge(), IntDrawRectEdge(), and MyIntDrawRectEdge().

◆ LTOuterNormal

◆ LTRBInnerMono

const signed char LTRBInnerMono[]
static
Initial value:

Definition at line 51 of file draw.c.

Referenced by draw_diag_edge(), draw_rect_edge(), IntDrawDiagEdge(), IntDrawRectEdge(), and MyIntDrawRectEdge().

◆ LTRBOuterMono

◆ RBInnerNormal

const signed char RBInnerNormal[]
static
Initial value:
= {
-1, -1, -1, -1,
-1, -1, -1, -1
}

Definition at line 30 of file draw.c.

Referenced by draw_diag_edge(), draw_rect_edge(), IntDrawDiagEdge(), IntDrawRectEdge(), and MyIntDrawRectEdge().

◆ RBOuterNormal