Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
6d4b9602
Commit
6d4b9602
authored
Mar 26, 2011
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 28, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/monthcal: Cache brush handles.
parent
eb2dc5c9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
16 deletions
+20
-16
monthcal.c
dlls/comctl32/monthcal.c
+20
-16
No files found.
dlls/comctl32/monthcal.c
View file @
6d4b9602
...
...
@@ -95,6 +95,7 @@ typedef struct
DWORD
dwStyle
;
/* cached GWL_STYLE */
COLORREF
colors
[
MCSC_TRAILINGTEXT
+
1
];
HBRUSH
brushes
[
MCSC_MONTHBK
+
1
];
HFONT
hFont
;
HFONT
hBoldFont
;
...
...
@@ -754,13 +755,10 @@ static void MONTHCAL_PaintTitle(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRU
RECT
*
title
=
&
infoPtr
->
calendars
[
calIdx
].
title
;
const
SYSTEMTIME
*
st
=
&
infoPtr
->
calendars
[
calIdx
].
month
;
WCHAR
buf_month
[
80
],
buf_fmt
[
80
];
HBRUSH
hbr
;
SIZE
sz
;
/* fill header box */
hbr
=
CreateSolidBrush
(
infoPtr
->
colors
[
MCSC_TITLEBK
]);
FillRect
(
hdc
,
title
,
hbr
);
DeleteObject
(
hbr
);
FillRect
(
hdc
,
title
,
infoPtr
->
brushes
[
MCSC_TITLEBK
]);
/* month/year string */
SetBkColor
(
hdc
,
infoPtr
->
colors
[
MCSC_TITLEBK
]);
...
...
@@ -792,7 +790,6 @@ static void MONTHCAL_PaintWeeknumbers(const MONTHCAL_INFO *infoPtr, HDC hdc, con
INT
i
,
prev_month
;
SYSTEMTIME
st
;
WCHAR
buf
[
80
];
HBRUSH
hbr
;
RECT
r
;
if
(
!
(
infoPtr
->
dwStyle
&
MCS_WEEKNUMBERS
))
return
;
...
...
@@ -864,9 +861,7 @@ static void MONTHCAL_PaintWeeknumbers(const MONTHCAL_INFO *infoPtr, HDC hdc, con
r
=
infoPtr
->
calendars
[
calIdx
].
weeknums
;
/* erase whole week numbers area */
hbr
=
CreateSolidBrush
(
infoPtr
->
colors
[
MCSC_MONTHBK
]);
FillRect
(
hdc
,
&
r
,
hbr
);
DeleteObject
(
hbr
);
FillRect
(
hdc
,
&
r
,
infoPtr
->
brushes
[
MCSC_MONTHBK
]);
/* reduce rectangle to one week number */
r
.
bottom
=
r
.
top
+
infoPtr
->
height_increment
;
...
...
@@ -994,7 +989,6 @@ static void MONTHCAL_PaintCalendar(const MONTHCAL_INFO *infoPtr, HDC hdc, const
RECT
r
,
fill_bk_rect
;
SYSTEMTIME
st
;
WCHAR
buf
[
80
];
HBRUSH
hbr
;
int
mask
;
/* fill whole days area - from week days area to today note rectangle */
...
...
@@ -1002,9 +996,7 @@ static void MONTHCAL_PaintCalendar(const MONTHCAL_INFO *infoPtr, HDC hdc, const
fill_bk_rect
.
bottom
=
infoPtr
->
calendars
[
calIdx
].
days
.
bottom
+
(
infoPtr
->
todayrect
.
bottom
-
infoPtr
->
todayrect
.
top
);
hbr
=
CreateSolidBrush
(
infoPtr
->
colors
[
MCSC_MONTHBK
]);
FillRect
(
hdc
,
&
fill_bk_rect
,
hbr
);
DeleteObject
(
hbr
);
FillRect
(
hdc
,
&
fill_bk_rect
,
infoPtr
->
brushes
[
MCSC_MONTHBK
]);
/* draw line under day abbreviations */
MoveToEx
(
hdc
,
infoPtr
->
calendars
[
calIdx
].
days
.
left
+
3
,
...
...
@@ -1136,6 +1128,13 @@ MONTHCAL_SetColor(MONTHCAL_INFO *infoPtr, UINT index, COLORREF color)
prev
=
infoPtr
->
colors
[
index
];
infoPtr
->
colors
[
index
]
=
color
;
/* update cached brush */
if
(
index
==
MCSC_BACKGROUND
||
index
==
MCSC_TITLEBK
||
index
==
MCSC_MONTHBK
)
{
DeleteObject
(
infoPtr
->
brushes
[
index
]);
infoPtr
->
brushes
[
index
]
=
CreateSolidBrush
(
color
);
}
InvalidateRect
(
infoPtr
->
hwndSelf
,
NULL
,
index
==
MCSC_BACKGROUND
?
TRUE
:
FALSE
);
return
prev
;
}
...
...
@@ -2237,15 +2236,12 @@ MONTHCAL_Paint(MONTHCAL_INFO *infoPtr, HDC hdc_paint)
static
LRESULT
MONTHCAL_EraseBkgnd
(
const
MONTHCAL_INFO
*
infoPtr
,
HDC
hdc
)
{
HBRUSH
hbr
;
RECT
rc
;
if
(
!
GetClipBox
(
hdc
,
&
rc
))
return
FALSE
;
/* fill background */
hbr
=
CreateSolidBrush
(
infoPtr
->
colors
[
MCSC_BACKGROUND
]);
FillRect
(
hdc
,
&
rc
,
hbr
);
DeleteObject
(
hbr
);
FillRect
(
hdc
,
&
rc
,
infoPtr
->
brushes
[
MCSC_BACKGROUND
]);
return
TRUE
;
}
...
...
@@ -2538,6 +2534,10 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs)
infoPtr
->
colors
[
MCSC_MONTHBK
]
=
comctl32_color
.
clrWindow
;
infoPtr
->
colors
[
MCSC_TRAILINGTEXT
]
=
comctl32_color
.
clrGrayText
;
infoPtr
->
brushes
[
MCSC_BACKGROUND
]
=
CreateSolidBrush
(
infoPtr
->
colors
[
MCSC_BACKGROUND
]);
infoPtr
->
brushes
[
MCSC_TITLEBK
]
=
CreateSolidBrush
(
infoPtr
->
colors
[
MCSC_TITLEBK
]);
infoPtr
->
brushes
[
MCSC_MONTHBK
]
=
CreateSolidBrush
(
infoPtr
->
colors
[
MCSC_MONTHBK
]);
infoPtr
->
minSel
=
infoPtr
->
todaysDate
;
infoPtr
->
maxSel
=
infoPtr
->
todaysDate
;
infoPtr
->
calendars
[
0
].
month
=
infoPtr
->
todaysDate
;
...
...
@@ -2571,6 +2571,10 @@ MONTHCAL_Destroy(MONTHCAL_INFO *infoPtr)
CloseThemeData
(
GetWindowTheme
(
infoPtr
->
hwndSelf
));
DeleteObject
(
infoPtr
->
brushes
[
MCSC_BACKGROUND
]);
DeleteObject
(
infoPtr
->
brushes
[
MCSC_TITLEBK
]);
DeleteObject
(
infoPtr
->
brushes
[
MCSC_MONTHBK
]);
Free
(
infoPtr
);
return
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment