Michael Kaufmann : static control: Support SS_REALSIZEIMAGE.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Jan 17 09:29:38 CST 2006
Module: wine
Branch: refs/heads/master
Commit: 46d007cedb89b37122217c50f8cc8fe17edb25a6
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=46d007cedb89b37122217c50f8cc8fe17edb25a6
Author: Michael Kaufmann <hallo at michael-kaufmann.ch>
Date: Tue Jan 17 16:04:40 2006 +0100
static control: Support SS_REALSIZEIMAGE.
- Support SS_REALSIZEIMAGE (this flag means "it's not necessary to
load icons in the default icon size").
- SS_ICON: Ability to display cursors.
---
dlls/user/static.c | 43 ++++++++++++++++++++++++++++++++-----------
1 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/dlls/user/static.c b/dlls/user/static.c
index 0b8cb29..4281a6a 100644
--- a/dlls/user/static.c
+++ b/dlls/user/static.c
@@ -29,7 +29,6 @@
* TODO:
*
* Styles
- * - SS_REALSIZEIMAGE
* - SS_RIGHTJUST
*
* Notifications
@@ -206,12 +205,23 @@ static HENHMETAFILE STATIC_SetEnhMetaFil
*
* Load the icon for an SS_ICON control.
*/
-static HICON STATIC_LoadIconA( HWND hwnd, LPCSTR name )
+static HICON STATIC_LoadIconA( HWND hwnd, LPCSTR name, DWORD style )
{
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
- HICON hicon = LoadIconA( hInstance, name );
- if (!hicon) hicon = LoadIconA( 0, name );
- return hicon;
+ if ((style & SS_REALSIZEIMAGE) != 0)
+ {
+ return LoadImageA(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED);
+ }
+ else
+ {
+ HICON hicon = LoadIconA( hInstance, name );
+ if (!hicon) hicon = LoadCursorA( hInstance, name );
+ if (!hicon) hicon = LoadIconA( 0, name );
+ /* Windows doesn't try to load a standard cursor,
+ probably because most IDs for standard cursors conflict
+ with the IDs for standard icons anyway */
+ return hicon;
+ }
}
/***********************************************************************
@@ -219,12 +229,23 @@ static HICON STATIC_LoadIconA( HWND hwnd
*
* Load the icon for an SS_ICON control.
*/
-static HICON STATIC_LoadIconW( HWND hwnd, LPCWSTR name )
+static HICON STATIC_LoadIconW( HWND hwnd, LPCWSTR name, DWORD style )
{
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
- HICON hicon = LoadIconW( hInstance, name );
- if (!hicon) hicon = LoadIconW( 0, name );
- return hicon;
+ if ((style & SS_REALSIZEIMAGE) != 0)
+ {
+ return LoadImageW(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED);
+ }
+ else
+ {
+ HICON hicon = LoadIconW( hInstance, name );
+ if (!hicon) hicon = LoadCursorW( hInstance, name );
+ if (!hicon) hicon = LoadIconW( 0, name );
+ /* Windows doesn't try to load a standard cursor,
+ probably because most IDs for standard cursors conflict
+ with the IDs for standard icons anyway */
+ return hicon;
+ }
}
/***********************************************************************
@@ -368,9 +389,9 @@ static LRESULT StaticWndProc_common( HWN
{
HICON hIcon;
if(unicode)
- hIcon = STATIC_LoadIconW(hwnd, (LPCWSTR)lParam);
+ hIcon = STATIC_LoadIconW(hwnd, (LPCWSTR)lParam, full_style);
else
- hIcon = STATIC_LoadIconA(hwnd, (LPCSTR)lParam);
+ hIcon = STATIC_LoadIconA(hwnd, (LPCSTR)lParam, full_style);
/* FIXME : should we also return the previous hIcon here ??? */
STATIC_SetIcon(hwnd, hIcon, full_style);
break;
More information about the wine-cvs
mailing list