- Restructure PaintText code to remove FillRect from owner-drawn path.

- Change SetFocus to indicate focus set only after Notify is sent to owner.
- Get more info in a trace.
This commit is contained in:
Guy L. Albertelli 2001-02-20 01:53:12 +00:00 committed by Alexandre Julliard
parent 0a78857956
commit 79413eda91
1 changed files with 23 additions and 15 deletions

View File

@ -778,22 +778,16 @@ static void CBPaintText(
*/ */
InflateRect( &rectEdit, -1, -1 ); InflateRect( &rectEdit, -1, -1 );
if ( (lphc->wState & CBF_FOCUSED) &&
!(lphc->wState & CBF_DROPPED) )
{
/* highlight */
FillRect( hdc, &rectEdit, GetSysColorBrush(COLOR_HIGHLIGHT) );
SetBkColor( hdc, GetSysColor( COLOR_HIGHLIGHT ) );
SetTextColor( hdc, GetSysColor( COLOR_HIGHLIGHTTEXT ) );
itemState |= ODS_SELECTED | ODS_FOCUS;
}
if( CB_OWNERDRAWN(lphc) ) if( CB_OWNERDRAWN(lphc) )
{ {
DRAWITEMSTRUCT dis; DRAWITEMSTRUCT dis;
HRGN clipRegion; HRGN clipRegion;
/* setup state for DRAWITEM message. Owner will highlight */
if ( (lphc->wState & CBF_FOCUSED) &&
!(lphc->wState & CBF_DROPPED) )
itemState |= ODS_SELECTED | ODS_FOCUS;
/* /*
* Save the current clip region. * Save the current clip region.
* To retrieve the clip region, we need to create one "dummy" * To retrieve the clip region, we need to create one "dummy"
@ -838,7 +832,17 @@ static void CBPaintText(
} }
else else
{ {
static const WCHAR empty_stringW[] = { 0 }; static const WCHAR empty_stringW[] = { 0 };
if ( (lphc->wState & CBF_FOCUSED) &&
!(lphc->wState & CBF_DROPPED) ) {
/* highlight */
FillRect( hdc, &rectEdit, GetSysColorBrush(COLOR_HIGHLIGHT) );
SetBkColor( hdc, GetSysColor( COLOR_HIGHLIGHT ) );
SetTextColor( hdc, GetSysColor( COLOR_HIGHLIGHTTEXT ) );
}
ExtTextOutW( hdc, ExtTextOutW( hdc,
rectEdit.left + 1, rectEdit.left + 1,
rectEdit.top + 1, rectEdit.top + 1,
@ -1197,19 +1201,21 @@ static void CBRollUp( LPHEADCOMBO lphc, BOOL ok, BOOL bButton )
{ {
HWND hWnd = lphc->self->hwndSelf; HWND hWnd = lphc->self->hwndSelf;
TRACE("[%04x]: sel ok? [%i] dropped? [%i]\n",
CB_HWND(lphc), (INT)ok, (INT)(lphc->wState & CBF_DROPPED));
CB_NOTIFY( lphc, (ok) ? CBN_SELENDOK : CBN_SELENDCANCEL ); CB_NOTIFY( lphc, (ok) ? CBN_SELENDOK : CBN_SELENDCANCEL );
if( IsWindow( hWnd ) && CB_GETTYPE(lphc) != CBS_SIMPLE ) if( IsWindow( hWnd ) && CB_GETTYPE(lphc) != CBS_SIMPLE )
{ {
TRACE("[%04x]: roll up [%i]\n", CB_HWND(lphc), (INT)ok );
if( lphc->wState & CBF_DROPPED ) if( lphc->wState & CBF_DROPPED )
{ {
RECT rect; RECT rect;
lphc->wState &= ~CBF_DROPPED; lphc->wState &= ~CBF_DROPPED;
ShowWindow( lphc->hWndLBox, SW_HIDE ); ShowWindow( lphc->hWndLBox, SW_HIDE );
if(GetCapture() == lphc->hWndLBox) if(GetCapture() == lphc->hWndLBox)
{ {
ReleaseCapture(); ReleaseCapture();
@ -1277,7 +1283,9 @@ static void COMBO_SetFocus( LPHEADCOMBO lphc )
if( CB_GETTYPE(lphc) == CBS_DROPDOWNLIST ) if( CB_GETTYPE(lphc) == CBS_DROPDOWNLIST )
SendMessageW(lphc->hWndLBox, LB_CARETON, 0, 0); SendMessageW(lphc->hWndLBox, LB_CARETON, 0, 0);
lphc->wState |= CBF_FOCUSED; /* This is wrong. Message sequences seem to indicate that this
is set *after* the notify. */
/* lphc->wState |= CBF_FOCUSED; */
if( !(lphc->wState & CBF_EDIT) ) if( !(lphc->wState & CBF_EDIT) )
InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE); InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);