Move notifies around to match native

Robert Shearman rob at codeweavers.com
Thu Apr 14 12:50:50 CDT 2005


Vitaliy Margolen wrote:

>Tuesday, April 12, 2005, 10:57:02 PM, you wrote:
>  
>
>>On Tue, Apr 12, 2005 at 04:13:32PM -0600, Vitaliy Margolen wrote:
>>    
>>
>>>Well, yes and no. This is custom draw callback/notify. It shouldn't change
>>>control's parameters, such as color. At least on a permanent basis. This is what
>>>set color messages for.
>>>      
>>>
>>Agreed. But judging by what listview is doing, we do need to use them when
>>we are drawing the item (or whatever). But I agree, we must not change
>>those parameters permanently.
>>    
>>
>
>Ok, I need help here. I spend half a day trying to fix this. I moved send notify
>after color and font setup in TREEVIEW_DrawItem. It's getting closer to native.
>But! No matter what I try, I can't set background color from within Delphi App
>on DrawItemNotify. Which does work on windows.
>
>Am I missing something? I changed text mode to opaque, so it should use current
>brush color for background. But when I printing GetDCBrushColor it stays the
>same! Could we have a problem somewhere in GDI?
>  
>

It seems fairly simple to me. You need to make a note of what the app 
changed the nmtvcd.clrTextBk field to (I do this in the toolbar control 
by passing the notify structure around), and then changes some lines in 
TREEVIEW_DrawItem:
            hbrBk = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
->
            if (nmtvcd->clrTextBk != CLR_NONE)
                hbrBk = CreateSolidBrush(nmtvcd->clrTextBk);
            else
                hbrBk = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));

and then further down:
        if ((infoPtr->dwStyle & TVS_TRACKSELECT) && (wineItem == 
infoPtr->hotItem))
->
        if (nmtvcd->clrTextBk != CLR_NONE)
            hbrBk = CreateSolidBrush(nmtvcd->clrTextBk);
        if ((infoPtr->dwStyle & TVS_TRACKSELECT) && (wineItem == 
infoPtr->hotItem))

Rob



More information about the wine-devel mailing list