Resend : Implements MIIM_BITMAP state in menus

Alexandre Julliard julliard at winehq.org
Mon Mar 7 12:52:26 CST 2005


Maxime Bellengé <maxime.bellenge at wanadoo.fr> writes:

> + * drawhbmbitmap : True to draw the hbmbitmap(MIIM_BITMAP)/False to draw the MF_BITMAP
>   */
> -static void MENU_DrawBitmapItem( HDC hdc, MENUITEM *lpitem, const RECT *rect, BOOL menuBar )
> +static void MENU_DrawBitmapItem( HDC hdc, MENUITEM *lpitem, const RECT *rect, BOOL menuBar, BOOL drawhbmbitmap )

What's the point of passing the drawhbmbitmap flag since you always
set it to TRUE?

> @@ -762,14 +773,15 @@
>      int h = rect->bottom - rect->top;
>      int bmp_xoffset = 0;
>      int left, top;
> +    HBITMAP swtch = (drawhbmbitmap)?lpitem->hbmpItem:(HBITMAP)lpitem->text;    

That's a strange variable name for a bitmap...

> +	/* New style MIIM_BITMAP */
> +	if (lpitem->hbmpItem) 
> +	{
> +	    if (lpitem->hbmpItem == HBMMENU_CALLBACK)
> +	    {
> +		MEASUREITEMSTRUCT measItem;
> +		measItem.CtlType = ODT_MENU;
> +		measItem.CtlID = 0;
> +		measItem.itemID = lpitem->wID;
> +		measItem.itemWidth = lpitem->rect.right - lpitem->rect.left;
> +		measItem.itemHeight = lpitem->rect.bottom - lpitem->rect.top;
> +		measItem.itemData = lpitem->dwItemData;
> +		
> +		SendMessageW( hwndOwner, WM_MEASUREITEM, lpitem->wID, (LPARAM)&measItem);
> +	    
> +		/* Keep the size of the bitmap in callback mode to be able to draw it correctly */
> +		lppop->bmpSize.cx = max(lppop->bmpSize.cx, measItem.itemWidth - (lpitem->rect.right - lpitem->rect.left));
> +		lppop->bmpSize.cy = max(lppop->bmpSize.cy, measItem.itemHeight - (lpitem->rect.bottom - lpitem->rect.top));

Why do you store the bitmap size in the parent popup? What if there
are multiple items with bitmaps?

-- 
Alexandre Julliard
julliard at winehq.org




More information about the wine-devel mailing list