- Support CCS_VERT as alternative for TBSTYLE_WRAPABLE.

- TB_INSERTBUTTONW was not as functional as the 'A' version. They now
  match.
This commit is contained in:
Guy L. Albertelli 2002-02-27 01:22:58 +00:00 committed by Alexandre Julliard
parent 1056953e2c
commit b2f0a6f5e9
1 changed files with 31 additions and 17 deletions

View File

@ -892,6 +892,9 @@ TOOLBAR_CalcStrings (HWND hwnd, LPSIZE lpSize)
* takes place in TOOLBAR_CalcToolbar. If the program wants to manage * takes place in TOOLBAR_CalcToolbar. If the program wants to manage
* the toolbar wrapping on its own, it can use the TBSTYLE_WRAPABLE * the toolbar wrapping on its own, it can use the TBSTYLE_WRAPABLE
* flag, and set the TBSTATE_WRAP flags manually on the appropriate items. * flag, and set the TBSTATE_WRAP flags manually on the appropriate items.
*
* Note: TBSTYLE_WRAPABLE or CCS_VERT can be used also to allow vertical
* toolbar lists.
*/ */
static void static void
@ -906,7 +909,7 @@ TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle )
/* When the toolbar window style is not TBSTYLE_WRAPABLE, */ /* When the toolbar window style is not TBSTYLE_WRAPABLE, */
/* no layout is necessary. Applications may use this style */ /* no layout is necessary. Applications may use this style */
/* to perform their own layout on the toolbar. */ /* to perform their own layout on the toolbar. */
if( !(dwStyle & TBSTYLE_WRAPABLE) ) if( !(dwStyle & TBSTYLE_WRAPABLE) && !(dwStyle & CCS_VERT) )
return; return;
btnPtr = infoPtr->buttons; btnPtr = infoPtr->buttons;
@ -3217,24 +3220,18 @@ TOOLBAR_InsertButtonW (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLBAR_DumpButton(infoPtr, (TBUTTON_INFO *)lpTbb, nIndex, FALSE); TOOLBAR_DumpButton(infoPtr, (TBUTTON_INFO *)lpTbb, nIndex, FALSE);
if (nIndex < 0) if (nIndex == -1) {
return FALSE; /* EPP: this seems to be an undocumented call (from my IE4)
* I assume in that case that:
TRACE("inserting button index=%d\n", nIndex); * - lpTbb->iString is a string pointer (not a string index in strings[] table
if (nIndex > infoPtr->nNumButtons) { * - index of insertion is at the end of existing buttons
* I only see this happen with nIndex == -1, but it could have a special
* meaning (like -nIndex (or ~nIndex) to get the real position of insertion).
*/
nIndex = infoPtr->nNumButtons; nIndex = infoPtr->nNumButtons;
TRACE("adjust index=%d\n", nIndex);
}
oldButtons = infoPtr->buttons;
infoPtr->nNumButtons++;
infoPtr->buttons = COMCTL32_Alloc (sizeof (TBUTTON_INFO) * infoPtr->nNumButtons);
/* pre insert copy */
if (nIndex > 0) {
memcpy (&infoPtr->buttons[0], &oldButtons[0],
nIndex * sizeof(TBUTTON_INFO));
}
} else if (nIndex < 0)
return FALSE;
/* If the string passed is not an index, assume address of string /* If the string passed is not an index, assume address of string
and do our own AddString */ and do our own AddString */
@ -3252,6 +3249,21 @@ TOOLBAR_InsertButtonW (HWND hwnd, WPARAM wParam, LPARAM lParam)
COMCTL32_Free(ptr); COMCTL32_Free(ptr);
} }
TRACE("inserting button index=%d\n", nIndex);
if (nIndex > infoPtr->nNumButtons) {
nIndex = infoPtr->nNumButtons;
TRACE("adjust index=%d\n", nIndex);
}
oldButtons = infoPtr->buttons;
infoPtr->nNumButtons++;
infoPtr->buttons = COMCTL32_Alloc (sizeof (TBUTTON_INFO) * infoPtr->nNumButtons);
/* pre insert copy */
if (nIndex > 0) {
memcpy (&infoPtr->buttons[0], &oldButtons[0],
nIndex * sizeof(TBUTTON_INFO));
}
/* insert new button */ /* insert new button */
infoPtr->buttons[nIndex].iBitmap = lpTbb->iBitmap; infoPtr->buttons[nIndex].iBitmap = lpTbb->iBitmap;
infoPtr->buttons[nIndex].idCommand = lpTbb->idCommand; infoPtr->buttons[nIndex].idCommand = lpTbb->idCommand;
@ -3287,6 +3299,8 @@ TOOLBAR_InsertButtonW (HWND hwnd, WPARAM wParam, LPARAM lParam)
COMCTL32_Free (oldButtons); COMCTL32_Free (oldButtons);
TOOLBAR_CalcToolbar (hwnd);
InvalidateRect (hwnd, NULL, TRUE); InvalidateRect (hwnd, NULL, TRUE);
return TRUE; return TRUE;