Commit d4515e73 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/combo: Simplify child controls position update helper.

parent fc4b0681
...@@ -1350,42 +1350,34 @@ static LRESULT COMBO_GetText( HEADCOMBO *lphc, INT count, LPWSTR buf ) ...@@ -1350,42 +1350,34 @@ static LRESULT COMBO_GetText( HEADCOMBO *lphc, INT count, LPWSTR buf )
* This function sets window positions according to the updated * This function sets window positions according to the updated
* component placement struct. * component placement struct.
*/ */
static void CBResetPos( static void CBResetPos(HEADCOMBO *combo)
LPHEADCOMBO lphc,
const RECT *rectEdit,
const RECT *rectLB,
BOOL bRedraw)
{ {
BOOL bDrop = (CB_GETTYPE(lphc) != CBS_SIMPLE); BOOL drop = CB_GETTYPE(combo) != CBS_SIMPLE;
/* NOTE: logs sometimes have WM_LBUTTONUP before a cascade of /* NOTE: logs sometimes have WM_LBUTTONUP before a cascade of
* sizing messages */ * sizing messages */
if (combo->wState & CBF_EDIT)
if( lphc->wState & CBF_EDIT ) SetWindowPos(combo->hWndEdit, 0, combo->textRect.left, combo->textRect.top,
SetWindowPos( lphc->hWndEdit, 0, combo->textRect.right - combo->textRect.left,
rectEdit->left, rectEdit->top, combo->textRect.bottom - combo->textRect.top,
rectEdit->right - rectEdit->left, SWP_NOZORDER | SWP_NOACTIVATE | (drop ? SWP_NOREDRAW : 0));
rectEdit->bottom - rectEdit->top,
SWP_NOZORDER | SWP_NOACTIVATE | ((bDrop) ? SWP_NOREDRAW : 0) ); SetWindowPos(combo->hWndLBox, 0, combo->droppedRect.left, combo->droppedRect.top,
combo->droppedRect.right - combo->droppedRect.left,
SetWindowPos( lphc->hWndLBox, 0, combo->droppedRect.bottom - combo->droppedRect.top,
rectLB->left, rectLB->top, SWP_NOACTIVATE | SWP_NOZORDER | (drop ? SWP_NOREDRAW : 0));
rectLB->right - rectLB->left,
rectLB->bottom - rectLB->top, if (drop)
SWP_NOACTIVATE | SWP_NOZORDER | ((bDrop) ? SWP_NOREDRAW : 0) ); {
if (combo->wState & CBF_DROPPED)
if( bDrop ) {
{ combo->wState &= ~CBF_DROPPED;
if( lphc->wState & CBF_DROPPED ) ShowWindow(combo->hWndLBox, SW_HIDE);
{ }
lphc->wState &= ~CBF_DROPPED;
ShowWindow( lphc->hWndLBox, SW_HIDE );
}
if( bRedraw && !(lphc->wState & CBF_NOREDRAW) ) if (!(combo->wState & CBF_NOREDRAW))
RedrawWindow( lphc->self, NULL, 0, RedrawWindow(combo->self, NULL, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW);
RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW ); }
}
} }
...@@ -1433,7 +1425,7 @@ static void COMBO_Size( LPHEADCOMBO lphc ) ...@@ -1433,7 +1425,7 @@ static void COMBO_Size( LPHEADCOMBO lphc )
CBCalcPlacement(lphc); CBCalcPlacement(lphc);
CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE ); CBResetPos(lphc);
} }
...@@ -1461,7 +1453,7 @@ static void COMBO_Font( LPHEADCOMBO lphc, HFONT hFont, BOOL bRedraw ) ...@@ -1461,7 +1453,7 @@ static void COMBO_Font( LPHEADCOMBO lphc, HFONT hFont, BOOL bRedraw )
{ {
CBCalcPlacement(lphc); CBCalcPlacement(lphc);
CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE ); CBResetPos(lphc);
} }
else else
{ {
...@@ -1490,7 +1482,7 @@ static LRESULT COMBO_SetItemHeight( LPHEADCOMBO lphc, INT index, INT height ) ...@@ -1490,7 +1482,7 @@ static LRESULT COMBO_SetItemHeight( LPHEADCOMBO lphc, INT index, INT height )
{ {
CBCalcPlacement(lphc); CBCalcPlacement(lphc);
CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE ); CBResetPos(lphc);
} }
else else
{ {
......
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