Skip to content
Snippets Groups Projects
Commit bcd12226 authored by Maxime Bellengé's avatar Maxime Bellengé Committed by Alexandre Julliard
Browse files

Implemented TAB_SetMinTabWidth and TAB_HighlightItem.

parent e9ebbfc0
No related branches found
No related tags found
No related merge requests found
...@@ -58,6 +58,7 @@ typedef struct ...@@ -58,6 +58,7 @@ typedef struct
UINT uNumRows; /* number of tab rows */ UINT uNumRows; /* number of tab rows */
INT tabHeight; /* height of the tab row */ INT tabHeight; /* height of the tab row */
INT tabWidth; /* width of tabs */ INT tabWidth; /* width of tabs */
INT tabMinWidth; /* minimum width of items */
USHORT uHItemPadding; /* amount of horizontal padding, in pixels */ USHORT uHItemPadding; /* amount of horizontal padding, in pixels */
USHORT uVItemPadding; /* amount of vertical padding, in pixels */ USHORT uVItemPadding; /* amount of vertical padding, in pixels */
HFONT hFont; /* handle to the current font */ HFONT hFont; /* handle to the current font */
...@@ -1485,7 +1486,7 @@ TAB_DrawItemInterior ...@@ -1485,7 +1486,7 @@ TAB_DrawItemInterior
holdPen = SelectObject(hdc, htextPen); holdPen = SelectObject(hdc, htextPen);
oldBkMode = SetBkMode(hdc, TRANSPARENT); oldBkMode = SetBkMode(hdc, TRANSPARENT);
SetTextColor(hdc, (iItem == infoPtr->iHotTracked) ? SetTextColor(hdc, ( (iItem == infoPtr->iHotTracked) | (infoPtr->items[iItem].dwState & TCIS_HIGHLIGHTED)) ?
comctl32_color.clrHighlight : comctl32_color.clrBtnText); comctl32_color.clrHighlight : comctl32_color.clrBtnText);
...@@ -1562,7 +1563,7 @@ TAB_DrawItemInterior ...@@ -1562,7 +1563,7 @@ TAB_DrawItemInterior
* Setup for text output * Setup for text output
*/ */
oldBkMode = SetBkMode(hdc, TRANSPARENT); oldBkMode = SetBkMode(hdc, TRANSPARENT);
SetTextColor(hdc, (iItem == infoPtr->iHotTracked) ? SetTextColor(hdc, ((iItem == infoPtr->iHotTracked) | (infoPtr->items[iItem].dwState & TCIS_HIGHLIGHTED))?
comctl32_color.clrHighlight : comctl32_color.clrBtnText); comctl32_color.clrHighlight : comctl32_color.clrBtnText);
/* get the rectangle that the text fits in */ /* get the rectangle that the text fits in */
...@@ -2557,7 +2558,7 @@ TAB_SetItemSize (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -2557,7 +2558,7 @@ TAB_SetItemSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
lResult = MAKELONG(infoPtr->tabWidth, infoPtr->tabHeight); lResult = MAKELONG(infoPtr->tabWidth, infoPtr->tabHeight);
/* UNDOCUMENTED: If requested Width or Height is 0 this means that program wants to use default. */ /* UNDOCUMENTED: If requested Width or Height is 0 this means that program wants to use default. */
if (LOWORD(lParam)) infoPtr->tabWidth = (INT)LOWORD(lParam); if (LOWORD(lParam)) infoPtr->tabWidth = max((INT)LOWORD(lParam), infoPtr->tabMinWidth);
if (HIWORD(lParam)) infoPtr->tabHeight = (INT)HIWORD(lParam); if (HIWORD(lParam)) infoPtr->tabHeight = (INT)HIWORD(lParam);
TRACE("was h=%d,w=%d, now h=%d,w=%d\n", TRACE("was h=%d,w=%d, now h=%d,w=%d\n",
HIWORD(lResult), LOWORD(lResult), HIWORD(lResult), LOWORD(lResult),
...@@ -2568,6 +2569,40 @@ TAB_SetItemSize (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -2568,6 +2569,40 @@ TAB_SetItemSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
return lResult; return lResult;
} }
static LRESULT
TAB_SetMinTabWidth (HWND hwnd, LPARAM lParam)
{
TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
INT cx = (INT)lParam;
INT oldcx;
if (infoPtr) {
oldcx = infoPtr->tabMinWidth;
infoPtr->tabMinWidth = (cx==-1)?DEFAULT_TAB_WIDTH:cx;
} else
return 0;
return oldcx;
}
static LRESULT
TAB_HighlightItem (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
INT iItem = (INT)wParam;
BOOL fHighlight = (BOOL)LOWORD(lParam);
if ((infoPtr) && (iItem>=0) && (iItem<infoPtr->uNumItem)) {
if (fHighlight)
infoPtr->items[iItem].dwState |= TCIS_HIGHLIGHTED;
else
infoPtr->items[iItem].dwState &= ~TCIS_HIGHLIGHTED;
} else
return FALSE;
return TRUE;
}
static LRESULT static LRESULT
TAB_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) TAB_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
...@@ -2979,6 +3014,8 @@ TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -2979,6 +3014,8 @@ TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* Initialize the width of a tab. */ /* Initialize the width of a tab. */
infoPtr->tabWidth = DEFAULT_TAB_WIDTH; infoPtr->tabWidth = DEFAULT_TAB_WIDTH;
/* The minimum width is the default width at creation */
infoPtr->tabMinWidth = DEFAULT_TAB_WIDTH;
TRACE("tabH=%d, tabW=%d\n", infoPtr->tabHeight, infoPtr->tabWidth); TRACE("tabH=%d, tabW=%d\n", infoPtr->tabHeight, infoPtr->tabWidth);
...@@ -3101,8 +3138,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -3101,8 +3138,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return TAB_SetUnicodeFormat (hwnd, wParam); return TAB_SetUnicodeFormat (hwnd, wParam);
case TCM_HIGHLIGHTITEM: case TCM_HIGHLIGHTITEM:
FIXME("Unimplemented msg TCM_HIGHLIGHTITEM\n"); return TAB_HighlightItem (hwnd, wParam, lParam);
return 0;
case TCM_GETTOOLTIPS: case TCM_GETTOOLTIPS:
return TAB_GetToolTips (hwnd, wParam, lParam); return TAB_GetToolTips (hwnd, wParam, lParam);
...@@ -3117,8 +3153,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -3117,8 +3153,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return TAB_SetCurFocus (hwnd, wParam); return TAB_SetCurFocus (hwnd, wParam);
case TCM_SETMINTABWIDTH: case TCM_SETMINTABWIDTH:
FIXME("Unimplemented msg TCM_SETMINTABWIDTH\n"); return TAB_SetMinTabWidth(hwnd, lParam);
return 0;
case TCM_DESELECTALL: case TCM_DESELECTALL:
FIXME("Unimplemented msg TCM_DESELECTALL\n"); FIXME("Unimplemented msg TCM_DESELECTALL\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment