mirror of
https://github.com/reactos/reactos.git
synced 2024-10-01 06:57:08 +00:00
- Don't use LoadIcon, it's broken as it incorrectly calls LoadImage
- This fixes the ugly treeview icons - *note, cursor/icon loading code needs revising svn path=/trunk/; revision=35242
This commit is contained in:
parent
2ca0e5562e
commit
bca74ffa16
|
@ -24,14 +24,12 @@
|
||||||
/* Image_Open, Image_Closed, and Image_Root - integer variables for indexes of the images. */
|
/* Image_Open, Image_Closed, and Image_Root - integer variables for indexes of the images. */
|
||||||
/* CX_ICON and CY_ICON - width and height of an icon. */
|
/* CX_ICON and CY_ICON - width and height of an icon. */
|
||||||
/* NUM_ICON - number of icons to add to the image list. */
|
/* NUM_ICON - number of icons to add to the image list. */
|
||||||
int Image_Open;
|
static int Image_Open = 0;
|
||||||
int Image_Closed;
|
static int Image_Closed = 0;
|
||||||
int Image_Root;
|
static int Image_Root = 0;
|
||||||
|
|
||||||
static LPTSTR pathBuffer;
|
static LPTSTR pathBuffer;
|
||||||
|
|
||||||
#define CX_ICON 16
|
|
||||||
#define CY_ICON 16
|
|
||||||
#define NUM_ICONS 3
|
#define NUM_ICONS 3
|
||||||
|
|
||||||
static BOOL get_item_path(HWND hwndTV, HTREEITEM hItem, HKEY* phKey, LPTSTR* pKeyPath, int* pPathLen, int* pMaxLen)
|
static BOOL get_item_path(HWND hwndTV, HTREEITEM hItem, HKEY* phKey, LPTSTR* pKeyPath, int* pPathLen, int* pMaxLen)
|
||||||
|
@ -415,24 +413,57 @@ static BOOL InitTreeViewImageLists(HWND hwndTV)
|
||||||
HICON hico; /* handle to icon */
|
HICON hico; /* handle to icon */
|
||||||
|
|
||||||
/* Create the image list. */
|
/* Create the image list. */
|
||||||
if ((himl = ImageList_Create(CX_ICON, CY_ICON,
|
if ((himl = ImageList_Create(GetSystemMetrics(SM_CXSMICON),
|
||||||
ILC_MASK|ILC_COLOR32, 0, NUM_ICONS)) == NULL)
|
GetSystemMetrics(SM_CYSMICON),
|
||||||
|
ILC_MASK | ILC_COLOR32,
|
||||||
|
0,
|
||||||
|
NUM_ICONS)) == NULL)
|
||||||
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Add the open file, closed file, and document bitmaps. */
|
/* Add the open file, closed file, and document bitmaps. */
|
||||||
hico = LoadIcon(hInst, MAKEINTRESOURCE(IDI_OPEN_FILE));
|
hico = LoadImage(hInst,
|
||||||
Image_Open = ImageList_AddIcon(himl, hico);
|
MAKEINTRESOURCE(IDI_OPEN_FILE),
|
||||||
|
IMAGE_ICON,
|
||||||
|
GetSystemMetrics(SM_CXSMICON),
|
||||||
|
GetSystemMetrics(SM_CYSMICON),
|
||||||
|
0);
|
||||||
|
if (hico)
|
||||||
|
{
|
||||||
|
Image_Open = ImageList_AddIcon(himl, hico);
|
||||||
|
DestroyIcon(hico);
|
||||||
|
}
|
||||||
|
|
||||||
hico = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CLOSED_FILE));
|
hico = LoadImage(hInst,
|
||||||
Image_Closed = ImageList_AddIcon(himl, hico);
|
MAKEINTRESOURCE(IDI_CLOSED_FILE),
|
||||||
|
IMAGE_ICON,
|
||||||
|
GetSystemMetrics(SM_CXSMICON),
|
||||||
|
GetSystemMetrics(SM_CYSMICON),
|
||||||
|
0);
|
||||||
|
if (hico)
|
||||||
|
{
|
||||||
|
Image_Closed = ImageList_AddIcon(himl, hico);
|
||||||
|
DestroyIcon(hico);
|
||||||
|
}
|
||||||
|
|
||||||
hico = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ROOT));
|
hico = LoadImage(hInst,
|
||||||
Image_Root = ImageList_AddIcon(himl, hico);
|
MAKEINTRESOURCE(IDI_ROOT),
|
||||||
|
IMAGE_ICON,
|
||||||
|
GetSystemMetrics(SM_CXSMICON),
|
||||||
|
GetSystemMetrics(SM_CYSMICON),
|
||||||
|
0);
|
||||||
|
if (hico)
|
||||||
|
{
|
||||||
|
Image_Root = ImageList_AddIcon(himl, hico);
|
||||||
|
DestroyIcon(hico);
|
||||||
|
}
|
||||||
|
|
||||||
/* Fail if not all of the images were added. */
|
/* Fail if not all of the images were added. */
|
||||||
if (ImageList_GetImageCount(himl) < NUM_ICONS)
|
if (ImageList_GetImageCount(himl) < NUM_ICONS)
|
||||||
{
|
{
|
||||||
return FALSE;
|
ImageList_Destroy(himl);
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Associate the image list with the tree view control. */
|
/* Associate the image list with the tree view control. */
|
||||||
|
|
Loading…
Reference in a new issue