Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
7d00bb38
Commit
7d00bb38
authored
Jul 27, 2005
by
Frank Richter
Committed by
Alexandre Julliard
Jul 27, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some generic code to allow subclassing (for the purpose of
theming) of standard controls.
parent
7b416af6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
166 additions
and
0 deletions
+166
-0
Makefile.in
dlls/comctl32/Makefile.in
+1
-0
comctl32.h
dlls/comctl32/comctl32.h
+4
-0
commctrl.c
dlls/comctl32/commctrl.c
+3
-0
theming.c
dlls/comctl32/theming.c
+158
-0
No files found.
dlls/comctl32/Makefile.in
View file @
7d00bb38
...
...
@@ -35,6 +35,7 @@ C_SRCS = \
status.c
\
syslink.c
\
tab.c
\
theming.c
\
toolbar.c
\
tooltips.c
\
trackbar.c
\
...
...
dlls/comctl32/comctl32.h
View file @
7d00bb38
...
...
@@ -249,4 +249,8 @@ static inline void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to)
to
->
wMilliseconds
=
from
->
wMilliseconds
;
}
extern
void
THEMING_Initialize
(
void
);
extern
LRESULT
THEMING_CallOriginalClass
(
HWND
,
UINT
,
WPARAM
,
LPARAM
);
extern
void
THEMING_SetSubclassData
(
HWND
,
ULONG_PTR
);
#endif
/* __WINE_COMCTL32_H */
dlls/comctl32/commctrl.c
View file @
7d00bb38
...
...
@@ -144,6 +144,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
TRACKBAR_Register
();
TREEVIEW_Register
();
UPDOWN_Register
();
/* subclass user32 controls */
THEMING_Initialize
();
break
;
case
DLL_PROCESS_DETACH
:
...
...
dlls/comctl32/theming.c
0 → 100644
View file @
7d00bb38
/*
* Theming - Initialization
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "comctl32.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
theming
);
typedef
LRESULT
(
CALLBACK
*
THEMING_SUBCLASSPROC
)(
HWND
,
UINT
,
WPARAM
,
LPARAM
,
ULONG_PTR
);
static
const
struct
ThemingSubclass
{
const
WCHAR
*
className
;
THEMING_SUBCLASSPROC
subclassProc
;
}
subclasses
[]
=
{
/* Note: list must be sorted by class name */
};
#define NUM_SUBCLASSES (sizeof(subclasses)/sizeof(subclasses[0]))
static
WNDPROC
originalProcs
[
NUM_SUBCLASSES
];
static
ATOM
atRefDataProp
;
static
ATOM
atSubclassProp
;
/***********************************************************************
* THEMING_SubclassProc
*
* The window proc registered to the subclasses. Fetches the subclass
* proc and ref data and call the proc.
*/
static
LRESULT
CALLBACK
THEMING_SubclassProc
(
HWND
wnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
int
subclass
=
(
int
)
GetPropW
(
wnd
,
MAKEINTATOMW
(
atSubclassProp
))
-
1
;
LRESULT
result
;
ULONG_PTR
refData
;
if
(
subclass
==
-
1
)
{
/* Means this is the first time this proc is called for this window.
* Determine the index of the subclass */
WCHAR
className
[
32
];
int
l
=
0
,
r
=
NUM_SUBCLASSES
;
GetClassNameW
(
wnd
,
className
,
sizeof
(
className
)
/
sizeof
(
WCHAR
));
while
(
l
<
r
)
{
int
d
,
m
=
(
l
+
r
)
/
2
;
d
=
lstrcmpiW
(
className
,
subclasses
[
m
].
className
);
if
(
d
==
0
)
{
subclass
=
m
;
break
;
}
if
(
d
<
0
)
r
=
m
;
else
l
=
m
+
1
;
}
if
(
subclass
==
-
1
)
ERR
(
"Couldn't find subclass info for %s!
\n
"
,
debugstr_w
(
className
));
SetPropW
(
wnd
,
MAKEINTATOMW
(
atSubclassProp
),
(
HANDLE
)(
subclass
+
1
));
}
refData
=
(
ULONG_PTR
)
GetPropW
(
wnd
,
MAKEINTATOMW
(
atRefDataProp
));
TRACE
(
"%d; (%p, %x, %x, %lx, %lx)"
,
subclass
,
wnd
,
msg
,
wParam
,
lParam
,
refData
);
result
=
subclasses
[
subclass
].
subclassProc
(
wnd
,
msg
,
wParam
,
lParam
,
refData
);
TRACE
(
" = %lx
\n
"
,
result
);
return
result
;
}
/***********************************************************************
* THEMING_Initialize
*
* Register classes for standard controls that will shadow the system
* classes.
*/
void
THEMING_Initialize
(
void
)
{
int
i
;
static
const
WCHAR
subclassPropName
[]
=
{
'C'
,
'C'
,
'3'
,
'2'
,
'T'
,
'h'
,
'e'
,
'm'
,
'i'
,
'n'
,
'g'
,
'S'
,
'u'
,
'b'
,
'C'
,
'l'
,
0
};
static
const
WCHAR
refDataPropName
[]
=
{
'C'
,
'C'
,
'3'
,
'2'
,
'T'
,
'h'
,
'e'
,
'm'
,
'i'
,
'n'
,
'g'
,
'D'
,
'a'
,
't'
,
'a'
,
0
};
atSubclassProp
=
GlobalAddAtomW
(
subclassPropName
);
atRefDataProp
=
GlobalAddAtomW
(
refDataPropName
);
for
(
i
=
0
;
i
<
NUM_SUBCLASSES
;
i
++
)
{
WNDCLASSEXW
class
;
class
.
cbSize
=
sizeof
(
class
);
class
.
style
|=
CS_GLOBALCLASS
;
GetClassInfoExW
(
NULL
,
subclasses
[
i
].
className
,
&
class
);
originalProcs
[
i
]
=
class
.
lpfnWndProc
;
class
.
lpfnWndProc
=
THEMING_SubclassProc
;
if
(
!
RegisterClassExW
(
&
class
))
{
ERR
(
"Could not re-register class %s: %lx
\n
"
,
debugstr_w
(
subclasses
[
i
].
className
),
GetLastError
());
}
else
{
TRACE
(
"Re-registered class %s
\n
"
,
debugstr_w
(
subclasses
[
i
].
className
));
}
}
}
/***********************************************************************
* THEMING_CallOriginalClass
*
* Determines the original window proc and calls it.
*/
LRESULT
THEMING_CallOriginalClass
(
HWND
wnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
int
subclass
=
(
int
)
GetPropW
(
wnd
,
MAKEINTATOMW
(
atSubclassProp
))
-
1
;
WNDPROC
oldProc
=
originalProcs
[
subclass
];
return
CallWindowProcW
(
oldProc
,
wnd
,
msg
,
wParam
,
lParam
);
}
/***********************************************************************
* THEMING_SetSubclassData
*
* Update the "refData" value of the subclassed window.
*/
void
THEMING_SetSubclassData
(
HWND
wnd
,
ULONG_PTR
refData
)
{
SetPropW
(
wnd
,
MAKEINTATOMW
(
atRefDataProp
),
(
HANDLE
)
refData
);
}
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