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
0f98b0bb
Commit
0f98b0bb
authored
Feb 14, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/listbox: Merge theming logic.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
04fe481d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
127 deletions
+52
-127
Makefile.in
dlls/comctl32/Makefile.in
+0
-1
listbox.c
dlls/comctl32/listbox.c
+52
-1
theme_listbox.c
dlls/comctl32/theme_listbox.c
+0
-116
theming.c
dlls/comctl32/theming.c
+0
-9
No files found.
dlls/comctl32/Makefile.in
View file @
0f98b0bb
...
...
@@ -37,7 +37,6 @@ C_SRCS = \
tab.c
\
taskdialog.c
\
theme_dialog.c
\
theme_listbox.c
\
theme_scrollbar.c
\
theming.c
\
toolbar.c
\
...
...
dlls/comctl32/listbox.c
View file @
0f98b0bb
...
...
@@ -2,6 +2,7 @@
* Listbox controls
*
* Copyright 1996 Alexandre Julliard
* Copyright 2005 Frank Richter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -30,6 +31,8 @@
#include "wingdi.h"
#include "winuser.h"
#include "commctrl.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "wine/unicode.h"
#include "wine/exception.h"
#include "wine/debug.h"
...
...
@@ -1072,6 +1075,38 @@ static LRESULT LISTBOX_Paint( LB_DESCR *descr, HDC hdc )
return
0
;
}
static
void
LISTBOX_NCPaint
(
LB_DESCR
*
descr
,
HRGN
region
)
{
DWORD
exstyle
=
GetWindowLongW
(
descr
->
self
,
GWL_EXSTYLE
);
HTHEME
theme
=
GetWindowTheme
(
descr
->
self
);
HRGN
cliprgn
=
region
;
int
cxEdge
,
cyEdge
;
HDC
hdc
;
RECT
r
;
if
(
!
theme
||
!
(
exstyle
&
WS_EX_CLIENTEDGE
))
return
;
cxEdge
=
GetSystemMetrics
(
SM_CXEDGE
),
cyEdge
=
GetSystemMetrics
(
SM_CYEDGE
);
GetWindowRect
(
descr
->
self
,
&
r
);
/* New clipping region passed to default proc to exclude border */
cliprgn
=
CreateRectRgn
(
r
.
left
+
cxEdge
,
r
.
top
+
cyEdge
,
r
.
right
-
cxEdge
,
r
.
bottom
-
cyEdge
);
if
(
region
!=
(
HRGN
)
1
)
CombineRgn
(
cliprgn
,
cliprgn
,
region
,
RGN_AND
);
OffsetRect
(
&
r
,
-
r
.
left
,
-
r
.
top
);
hdc
=
GetDCEx
(
descr
->
self
,
region
,
DCX_WINDOW
|
DCX_INTERSECTRGN
);
OffsetRect
(
&
r
,
-
r
.
left
,
-
r
.
top
);
if
(
IsThemeBackgroundPartiallyTransparent
(
theme
,
0
,
0
))
DrawThemeParentBackground
(
descr
->
self
,
hdc
,
&
r
);
DrawThemeBackground
(
theme
,
hdc
,
0
,
0
,
&
r
,
0
);
ReleaseDC
(
descr
->
self
,
hdc
);
}
/***********************************************************************
* LISTBOX_InvalidateItems
...
...
@@ -2500,6 +2535,8 @@ static BOOL LISTBOX_Create( HWND hwnd, LPHEADCOMBO lphc )
}
}
OpenThemeData
(
descr
->
self
,
WC_LISTBOXW
);
TRACE
(
"owner: %p, style: %08x, width: %d, height: %d
\n
"
,
descr
->
owner
,
descr
->
style
,
descr
->
width
,
descr
->
height
);
return
TRUE
;
}
...
...
@@ -2510,6 +2547,8 @@ static BOOL LISTBOX_Create( HWND hwnd, LPHEADCOMBO lphc )
*/
static
BOOL
LISTBOX_Destroy
(
LB_DESCR
*
descr
)
{
HTHEME
theme
=
GetWindowTheme
(
descr
->
self
);
CloseThemeData
(
theme
);
LISTBOX_ResetContent
(
descr
);
SetWindowLongPtrW
(
descr
->
self
,
0
,
0
);
HeapFree
(
GetProcessHeap
(),
0
,
descr
);
...
...
@@ -2523,7 +2562,8 @@ static BOOL LISTBOX_Destroy( LB_DESCR *descr )
static
LRESULT
CALLBACK
LISTBOX_WindowProc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
LB_DESCR
*
descr
=
(
LB_DESCR
*
)
GetWindowLongPtrW
(
hwnd
,
0
);
LPHEADCOMBO
lphc
=
0
;
HEADCOMBO
*
lphc
=
NULL
;
HTHEME
theme
;
LRESULT
ret
;
if
(
!
descr
)
...
...
@@ -2833,6 +2873,11 @@ static LRESULT CALLBACK LISTBOX_WindowProc( HWND hwnd, UINT msg, WPARAM wParam,
if
(
!
wParam
)
EndPaint
(
descr
->
self
,
&
ps
);
}
return
ret
;
case
WM_NCPAINT
:
LISTBOX_NCPaint
(
descr
,
(
HRGN
)
wParam
);
break
;
case
WM_SIZE
:
LISTBOX_UpdateSize
(
descr
);
return
0
;
...
...
@@ -2983,6 +3028,12 @@ static LRESULT CALLBACK LISTBOX_WindowProc( HWND hwnd, UINT msg, WPARAM wParam,
if
(
lphc
)
return
0
;
break
;
case
WM_THEMECHANGED
:
theme
=
GetWindowTheme
(
hwnd
);
CloseThemeData
(
theme
);
OpenThemeData
(
hwnd
,
WC_LISTBOXW
);
break
;
default:
if
((
msg
>=
WM_USER
)
&&
(
msg
<
0xc000
))
WARN
(
"[%p]: unknown msg %04x wp %08lx lp %08lx
\n
"
,
...
...
dlls/comctl32/theme_listbox.c
deleted
100644 → 0
View file @
04fe481d
/*
* Theming - List box control
*
* Copyright (c) 2005 by Frank Richter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "comctl32.h"
#include "wine/debug.h"
/* Draw themed border */
static
void
nc_paint
(
HTHEME
theme
,
HWND
hwnd
,
HRGN
region
)
{
HRGN
cliprgn
=
region
;
DWORD
exStyle
=
GetWindowLongW
(
hwnd
,
GWL_EXSTYLE
);
if
(
exStyle
&
WS_EX_CLIENTEDGE
)
{
HDC
dc
;
RECT
r
;
int
cxEdge
=
GetSystemMetrics
(
SM_CXEDGE
),
cyEdge
=
GetSystemMetrics
(
SM_CYEDGE
);
GetWindowRect
(
hwnd
,
&
r
);
/* New clipping region passed to default proc to exclude border */
cliprgn
=
CreateRectRgn
(
r
.
left
+
cxEdge
,
r
.
top
+
cyEdge
,
r
.
right
-
cxEdge
,
r
.
bottom
-
cyEdge
);
if
(
region
!=
(
HRGN
)
1
)
CombineRgn
(
cliprgn
,
cliprgn
,
region
,
RGN_AND
);
OffsetRect
(
&
r
,
-
r
.
left
,
-
r
.
top
);
dc
=
GetDCEx
(
hwnd
,
region
,
DCX_WINDOW
|
DCX_INTERSECTRGN
);
OffsetRect
(
&
r
,
-
r
.
left
,
-
r
.
top
);
if
(
IsThemeBackgroundPartiallyTransparent
(
theme
,
0
,
0
))
DrawThemeParentBackground
(
hwnd
,
dc
,
&
r
);
DrawThemeBackground
(
theme
,
dc
,
0
,
0
,
&
r
,
0
);
ReleaseDC
(
hwnd
,
dc
);
}
/* Call default proc to get the scrollbars etc. painted */
DefWindowProcW
(
hwnd
,
WM_NCPAINT
,
(
WPARAM
)
cliprgn
,
0
);
}
/**********************************************************************
* The list control subclass window proc.
*/
LRESULT
CALLBACK
THEMING_ListBoxSubclassProc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
,
ULONG_PTR
dwRefData
)
{
const
WCHAR
*
themeClass
=
WC_LISTBOXW
;
HTHEME
theme
;
LRESULT
result
;
switch
(
msg
)
{
case
WM_CREATE
:
result
=
THEMING_CallOriginalClass
(
hwnd
,
msg
,
wParam
,
lParam
);
OpenThemeData
(
hwnd
,
themeClass
);
return
result
;
case
WM_DESTROY
:
theme
=
GetWindowTheme
(
hwnd
);
CloseThemeData
(
theme
);
return
THEMING_CallOriginalClass
(
hwnd
,
msg
,
wParam
,
lParam
);
case
WM_THEMECHANGED
:
theme
=
GetWindowTheme
(
hwnd
);
CloseThemeData
(
theme
);
OpenThemeData
(
hwnd
,
themeClass
);
break
;
case
WM_SYSCOLORCHANGE
:
theme
=
GetWindowTheme
(
hwnd
);
if
(
!
theme
)
return
THEMING_CallOriginalClass
(
hwnd
,
msg
,
wParam
,
lParam
);
/* Do nothing. When themed, a WM_THEMECHANGED will be received, too,
* which will do the repaint. */
break
;
case
WM_NCPAINT
:
theme
=
GetWindowTheme
(
hwnd
);
if
(
!
theme
)
return
THEMING_CallOriginalClass
(
hwnd
,
msg
,
wParam
,
lParam
);
nc_paint
(
theme
,
hwnd
,
(
HRGN
)
wParam
);
break
;
default:
/* Call old proc */
return
THEMING_CallOriginalClass
(
hwnd
,
msg
,
wParam
,
lParam
);
}
return
0
;
}
dlls/comctl32/theming.c
View file @
0f98b0bb
...
...
@@ -36,13 +36,10 @@ typedef LRESULT (CALLBACK* THEMING_SUBCLASSPROC)(HWND, UINT, WPARAM, LPARAM,
extern
LRESULT
CALLBACK
THEMING_DialogSubclassProc
(
HWND
,
UINT
,
WPARAM
,
LPARAM
,
ULONG_PTR
)
DECLSPEC_HIDDEN
;
extern
LRESULT
CALLBACK
THEMING_ListBoxSubclassProc
(
HWND
,
UINT
,
WPARAM
,
LPARAM
,
ULONG_PTR
)
DECLSPEC_HIDDEN
;
extern
LRESULT
CALLBACK
THEMING_ScrollbarSubclassProc
(
HWND
,
UINT
,
WPARAM
,
LPARAM
,
ULONG_PTR
)
DECLSPEC_HIDDEN
;
static
const
WCHAR
dialogClass
[]
=
{
'#'
,
'3'
,
'2'
,
'7'
,
'7'
,
'0'
,
0
};
static
const
WCHAR
comboLboxClass
[]
=
{
'C'
,
'o'
,
'm'
,
'b'
,
'o'
,
'L'
,
'b'
,
'o'
,
'x'
,
0
};
static
const
struct
ThemingSubclass
{
...
...
@@ -51,8 +48,6 @@ static const struct ThemingSubclass
}
subclasses
[]
=
{
/* Note: list must be sorted by class name */
{
dialogClass
,
THEMING_DialogSubclassProc
},
{
comboLboxClass
,
THEMING_ListBoxSubclassProc
},
{
WC_LISTBOXW
,
THEMING_ListBoxSubclassProc
},
{
WC_SCROLLBARW
,
THEMING_ScrollbarSubclassProc
}
};
...
...
@@ -85,14 +80,10 @@ static LRESULT CALLBACK subclass_proc ## N (HWND wnd, UINT msg, \
MAKE_SUBCLASS_PROC
(
0
)
MAKE_SUBCLASS_PROC
(
1
)
MAKE_SUBCLASS_PROC
(
2
)
MAKE_SUBCLASS_PROC
(
3
)
static
const
WNDPROC
subclassProcs
[
NUM_SUBCLASSES
]
=
{
subclass_proc0
,
subclass_proc1
,
subclass_proc2
,
subclass_proc3
,
};
/***********************************************************************
...
...
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