Commit 479dc1d8 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

shell32: Add support for SHIL_EXTRALARGE list.

parent 0075b05a
...@@ -61,7 +61,7 @@ typedef struct ...@@ -61,7 +61,7 @@ typedef struct
static HDPA sic_hdpa; static HDPA sic_hdpa;
static INIT_ONCE sic_init_once = INIT_ONCE_STATIC_INIT; static INIT_ONCE sic_init_once = INIT_ONCE_STATIC_INIT;
static HIMAGELIST shell_imagelists[SHIL_SMALL+1]; static HIMAGELIST shell_imagelists[SHIL_EXTRALARGE+1];
static CRITICAL_SECTION SHELL32_SicCS; static CRITICAL_SECTION SHELL32_SicCS;
static CRITICAL_SECTION_DEBUG critsect_debug = static CRITICAL_SECTION_DEBUG critsect_debug =
...@@ -347,7 +347,7 @@ static INT SIC_IconAppend (const WCHAR *sourcefile, INT src_index, HICON *hicons ...@@ -347,7 +347,7 @@ static INT SIC_IconAppend (const WCHAR *sourcefile, INT src_index, HICON *hicons
static BOOL get_imagelist_icon_size(int list, SIZE *size) static BOOL get_imagelist_icon_size(int list, SIZE *size)
{ {
if (list < SHIL_LARGE || list > SHIL_SMALL) return FALSE; if (list < 0 || list >= ARRAY_SIZE(shell_imagelists)) return FALSE;
return ImageList_GetIconSize( shell_imagelists[list], &size->cx, &size->cy ); return ImageList_GetIconSize( shell_imagelists[list], &size->cx, &size->cy );
} }
...@@ -360,7 +360,7 @@ static BOOL get_imagelist_icon_size(int list, SIZE *size) ...@@ -360,7 +360,7 @@ static BOOL get_imagelist_icon_size(int list, SIZE *size)
*/ */
static INT SIC_LoadIcon (const WCHAR *sourcefile, INT index, DWORD flags) static INT SIC_LoadIcon (const WCHAR *sourcefile, INT index, DWORD flags)
{ {
HICON hicons[SHIL_SMALL+1] = { 0 }; HICON hicons[ARRAY_SIZE(shell_imagelists)] = { 0 };
HICON hshortcuts[ARRAY_SIZE(hicons)] = { 0 }; HICON hshortcuts[ARRAY_SIZE(hicons)] = { 0 };
unsigned int i; unsigned int i;
SIZE size; SIZE size;
...@@ -431,59 +431,61 @@ static int get_shell_icon_size(void) ...@@ -431,59 +431,61 @@ static int get_shell_icon_size(void)
*/ */
static BOOL WINAPI SIC_Initialize( INIT_ONCE *once, void *param, void **context ) static BOOL WINAPI SIC_Initialize( INIT_ONCE *once, void *param, void **context )
{ {
HICON hicons[SHIL_SMALL+1]; HICON hicons[ARRAY_SIZE(shell_imagelists)];
int cx_small, cy_small; SIZE sizes[ARRAY_SIZE(shell_imagelists)];
int cx_large, cy_large; BOOL failed = FALSE;
unsigned int i; unsigned int i;
if (!IsProcessDPIAware()) if (!IsProcessDPIAware())
{ {
cx_large = cy_large = get_shell_icon_size(); sizes[SHIL_LARGE].cx = sizes[SHIL_LARGE].cy = get_shell_icon_size();
cx_small = GetSystemMetrics( SM_CXSMICON ); sizes[SHIL_SMALL].cx = GetSystemMetrics( SM_CXSMICON );
cy_small = GetSystemMetrics( SM_CYSMICON ); sizes[SHIL_SMALL].cy = GetSystemMetrics( SM_CYSMICON );
} }
else else
{ {
cx_large = GetSystemMetrics( SM_CXICON ); sizes[SHIL_LARGE].cx = GetSystemMetrics( SM_CXICON );
cy_large = GetSystemMetrics( SM_CYICON ); sizes[SHIL_LARGE].cy = GetSystemMetrics( SM_CYICON );
cx_small = cx_large / 2; sizes[SHIL_SMALL].cx = sizes[SHIL_LARGE].cx / 2;
cy_small = cy_large / 2; sizes[SHIL_SMALL].cy = sizes[SHIL_LARGE].cy / 2;
} }
TRACE("large %dx%d small %dx%d\n", cx_large, cy_large, cx_small, cx_small); sizes[SHIL_EXTRALARGE].cx = (GetSystemMetrics( SM_CXICON ) * 3) / 2;
sizes[SHIL_EXTRALARGE].cy = (GetSystemMetrics( SM_CYICON ) * 3) / 2;
sic_hdpa = DPA_Create(16); TRACE("large %dx%d small %dx%d\n", sizes[SHIL_LARGE].cx, sizes[SHIL_LARGE].cy, sizes[SHIL_SMALL].cx, sizes[SHIL_SMALL].cy);
if (!sic_hdpa) sic_hdpa = DPA_Create(16);
{ if (!sic_hdpa)
return(FALSE); return(FALSE);
}
shell_imagelists[SHIL_SMALL] = ImageList_Create(cx_small, cy_small, ILC_COLOR32 | ILC_MASK, 0, 0x20);
shell_imagelists[SHIL_LARGE] = ImageList_Create(cx_large, cy_large, ILC_COLOR32 | ILC_MASK, 0, 0x20);
for (i = 0; i < ARRAY_SIZE(shell_imagelists); i++) for (i = 0; i < ARRAY_SIZE(shell_imagelists); i++)
ImageList_SetBkColor(shell_imagelists[i], CLR_NONE); {
shell_imagelists[i] = ImageList_Create(sizes[i].cx, sizes[i].cy, ILC_COLOR32 | ILC_MASK, 0, 0x20);
ImageList_SetBkColor(shell_imagelists[i], CLR_NONE);
/* Load the document icon, which is used as the default if an icon isn't found. */ /* Load the document icon, which is used as the default if an icon isn't found. */
hicons[SHIL_SMALL] = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(IDI_SHELL_DOCUMENT), if (!(hicons[i] = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(IDI_SHELL_DOCUMENT),
IMAGE_ICON, cx_small, cy_small, LR_SHARED); IMAGE_ICON, sizes[i].cx, sizes[i].cy, LR_SHARED)))
hicons[SHIL_LARGE] = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(IDI_SHELL_DOCUMENT),
IMAGE_ICON, cx_large, cy_large, LR_SHARED);
if (!hicons[SHIL_SMALL] || !hicons[SHIL_LARGE])
{ {
FIXME("Failed to load IDI_SHELL_DOCUMENT icon!\n"); failed = TRUE;
return FALSE;
} }
}
SIC_IconAppend (swShell32Name, IDI_SHELL_DOCUMENT-1, hicons, 0); if (failed)
SIC_IconAppend (swShell32Name, -IDI_SHELL_DOCUMENT, hicons, 0); {
FIXME("Failed to load IDI_SHELL_DOCUMENT icon!\n");
return FALSE;
}
SIC_IconAppend(swShell32Name, IDI_SHELL_DOCUMENT - 1, hicons, 0);
SIC_IconAppend(swShell32Name, -IDI_SHELL_DOCUMENT, hicons, 0);
TRACE("small list=%p, large list=%p\n", shell_imagelists[SHIL_SMALL], shell_imagelists[SHIL_LARGE]); TRACE("small list=%p, large list=%p\n", shell_imagelists[SHIL_SMALL], shell_imagelists[SHIL_LARGE]);
return TRUE; return TRUE;
} }
/************************************************************************* /*************************************************************************
* SIC_Destroy * SIC_Destroy
* *
...@@ -1035,8 +1037,7 @@ HRESULT WINAPI SHGetStockIconInfo(SHSTOCKICONID id, UINT flags, SHSTOCKICONINFO ...@@ -1035,8 +1037,7 @@ HRESULT WINAPI SHGetStockIconInfo(SHSTOCKICONID id, UINT flags, SHSTOCKICONINFO
*/ */
HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv) HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv)
{ {
/* Wine currently only maintains large and small image lists */ if (iImageList < 0 || iImageList > SHIL_SYSSMALL)
if ((iImageList != SHIL_LARGE) && (iImageList != SHIL_SMALL) && (iImageList != SHIL_SYSSMALL))
{ {
FIXME("Unsupported image list %i requested\n", iImageList); FIXME("Unsupported image list %i requested\n", iImageList);
return E_FAIL; return E_FAIL;
......
...@@ -1417,7 +1417,7 @@ static void test_SHGetImageList(void) ...@@ -1417,7 +1417,7 @@ static void test_SHGetImageList(void)
for (i = 0; i <= SHIL_LAST; i++) for (i = 0; i <= SHIL_LAST; i++)
{ {
hr = SHGetImageList( i, &IID_IImageList, (void **)&list ); hr = SHGetImageList( i, &IID_IImageList, (void **)&list );
todo_wine_if(i == SHIL_EXTRALARGE || i == SHIL_JUMBO) todo_wine_if(i == SHIL_JUMBO)
ok( hr == S_OK || ok( hr == S_OK ||
broken( i == SHIL_JUMBO && hr == E_INVALIDARG ), /* XP and 2003 */ broken( i == SHIL_JUMBO && hr == E_INVALIDARG ), /* XP and 2003 */
"%d: got %08x\n", i, hr ); "%d: got %08x\n", i, hr );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment