*
*/
-#include <assert.h>
-#include <stdarg.h>
-#include <string.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-#include "winnls.h"
-#include "commctrl.h"
#include "comctl32.h"
-#include "uxtheme.h"
-#include "vssym32.h"
-#include "wine/debug.h"
-#include <math.h>
WINE_DEFAULT_DEBUG_CHANNEL(tab);
TRACE("(%p %d)\n", infoPtr, iItem);
- if (iItem < 0)
- infoPtr->iSelected = -1;
- else if (iItem >= infoPtr->uNumItem)
+ if (iItem >= (INT)infoPtr->uNumItem)
return -1;
- else {
- if (prevItem != iItem) {
- if (prevItem != -1)
- TAB_GetItem(infoPtr, prevItem)->dwState &= ~TCIS_BUTTONPRESSED;
- TAB_GetItem(infoPtr, iItem)->dwState |= TCIS_BUTTONPRESSED;
+ if (prevItem != iItem) {
+ if (prevItem != -1)
+ TAB_GetItem(infoPtr, prevItem)->dwState &= ~TCIS_BUTTONPRESSED;
+
+ if (iItem >= 0)
+ {
+ TAB_GetItem(infoPtr, iItem)->dwState |= TCIS_BUTTONPRESSED;
infoPtr->iSelected = iItem;
infoPtr->uFocus = iItem;
- TAB_EnsureSelectionVisible(infoPtr);
- TAB_InvalidateTabArea(infoPtr);
}
+ else
+ {
+ infoPtr->iSelected = -1;
+ infoPtr->uFocus = -1;
+ }
+
+ TAB_EnsureSelectionVisible(infoPtr);
+ TAB_InvalidateTabArea(infoPtr);
}
+
return prevItem;
}
(itemIndex < infoPtr->leftmostVisible)))
{
TRACE("Not Visible\n");
- /* need to initialize these to empty rects */
- if (itemRect)
- {
- memset(itemRect,0,sizeof(RECT));
- itemRect->bottom = infoPtr->tabHeight;
- }
- if (selectedRect)
- memset(selectedRect,0,sizeof(RECT));
+ SetRect(itemRect, 0, 0, 0, infoPtr->tabHeight);
+ SetRectEmpty(selectedRect);
return FALSE;
}
/* Now, calculate the position of the item as if it were selected. */
if (selectedRect!=NULL)
{
- CopyRect(selectedRect, itemRect);
+ *selectedRect = *itemRect;
/* The rectangle of a selected item is a bit wider. */
if(infoPtr->dwStyle & TCS_VERTICAL)
/*
* Calculate the position of the scroll control.
*/
- if(infoPtr->dwStyle & TCS_VERTICAL)
- {
- controlPos.right = clientRect->right;
- controlPos.left = controlPos.right - 2 * GetSystemMetrics(SM_CXHSCROLL);
+ controlPos.right = clientRect->right;
+ controlPos.left = controlPos.right - 2 * GetSystemMetrics(SM_CXHSCROLL);
- if (infoPtr->dwStyle & TCS_BOTTOM)
- {
- controlPos.top = clientRect->bottom - infoPtr->tabHeight;
- controlPos.bottom = controlPos.top + GetSystemMetrics(SM_CYHSCROLL);
- }
- else
- {
- controlPos.bottom = clientRect->top + infoPtr->tabHeight;
- controlPos.top = controlPos.bottom - GetSystemMetrics(SM_CYHSCROLL);
- }
+ if (infoPtr->dwStyle & TCS_BOTTOM)
+ {
+ controlPos.top = clientRect->bottom - infoPtr->tabHeight;
+ controlPos.bottom = controlPos.top + GetSystemMetrics(SM_CYHSCROLL);
}
else
{
- controlPos.right = clientRect->right;
- controlPos.left = controlPos.right - 2 * GetSystemMetrics(SM_CXHSCROLL);
-
- if (infoPtr->dwStyle & TCS_BOTTOM)
- {
- controlPos.top = clientRect->bottom - infoPtr->tabHeight;
- controlPos.bottom = controlPos.top + GetSystemMetrics(SM_CYHSCROLL);
- }
- else
- {
- controlPos.bottom = clientRect->top + infoPtr->tabHeight;
- controlPos.top = controlPos.bottom - GetSystemMetrics(SM_CYHSCROLL);
- }
+ controlPos.bottom = clientRect->top + infoPtr->tabHeight;
+ controlPos.top = controlPos.bottom - GetSystemMetrics(SM_CYHSCROLL);
}
/*
tabwidth = max(tabwidth, infoPtr->tabMinWidth);
curr->rect.right = curr->rect.left + tabwidth;
- TRACE("for <%s>, l,r=%d,%d\n",
- debugstr_w(curr->pszText), curr->rect.left, curr->rect.right);
+ TRACE("for <%s>, rect %s\n", debugstr_w(curr->pszText), wine_dbgstr_rect(&curr->rect));
}
/*
curr->rect.left = 0;
curItemRowCount++;
- TRACE("wrapping <%s>, l,r=%d,%d\n", debugstr_w(curr->pszText),
- curr->rect.left, curr->rect.right);
+ TRACE("wrapping <%s>, rect %s\n", debugstr_w(curr->pszText), wine_dbgstr_rect(&curr->rect));
}
curr->rect.bottom = 0;
else
curItemLeftPos = curr->rect.right;
- TRACE("arranging <%s>, l,r=%d,%d, row=%d\n",
- debugstr_w(curr->pszText), curr->rect.left,
- curr->rect.right, curr->rect.top);
+ TRACE("arranging <%s>, rect %s\n", debugstr_w(curr->pszText), wine_dbgstr_rect(&curr->rect));
}
/*
item->rect.left += iCount * widthDiff;
item->rect.right += (iCount + 1) * widthDiff;
- TRACE("adjusting 1 <%s>, l,r=%d,%d\n",
- debugstr_w(item->pszText),
- item->rect.left, item->rect.right);
+ TRACE("adjusting 1 <%s>, rect %s\n", debugstr_w(item->pszText), wine_dbgstr_rect(&item->rect));
}
TAB_GetItem(infoPtr, iIndex - 1)->rect.right += remainder;
start->rect.left = clientRect.left;
start->rect.right = clientRect.right - 4;
- TRACE("adjusting 2 <%s>, l,r=%d,%d\n",
- debugstr_w(start->pszText),
- start->rect.left, start->rect.right);
-
+ TRACE("adjusting 2 <%s>, rect %s\n", debugstr_w(start->pszText), wine_dbgstr_rect(&start->rect));
}
-
iIndexStart = iIndexEnd;
}
}
HPEN holdPen;
INT oldBkMode;
HFONT hOldFont;
+#ifdef __REACTOS__
+HTHEME theme = GetWindowTheme (infoPtr->hwnd);
+#endif
/* if (drawRect == NULL) */
{
}
}
else
- {
- drawRect->left += 2;
- drawRect->top += 2;
- drawRect->right -= 2;
- drawRect->bottom -= 2;
- }
+ InflateRect(drawRect, -2, -2);
}
else
{
if (iItem != infoPtr->iSelected)
{
drawRect->left += 2;
- drawRect->top += 2;
- drawRect->bottom -= 2;
+ InflateRect(drawRect, 0, -2);
}
}
else if (infoPtr->dwStyle & TCS_VERTICAL)
}
else
{
- drawRect->top += 2;
drawRect->right -= 2;
- drawRect->bottom -= 2;
+ InflateRect(drawRect, 0, -2);
}
}
else if (infoPtr->dwStyle & TCS_BOTTOM)
drawRect->top += 2;
drawRect->right -= 1;
if ( iItem == infoPtr->iSelected )
- {
- drawRect->right -= 1;
- drawRect->left += 1;
- }
+ InflateRect(drawRect, -1, 0);
id = (UINT)GetWindowLongPtrW( infoPtr->hwnd, GWLP_ID );
dis.itemState |= ODS_FOCUS;
dis.hwndItem = infoPtr->hwnd;
dis.hDC = hdc;
- CopyRect(&dis.rcItem,drawRect);
+ dis.rcItem = *drawRect;
/* when extra data fits ULONG_PTR, store it directly */
if (infoPtr->cbInfo > sizeof(LPARAM))
rcImage = *drawRect;
rcTemp = *drawRect;
-
- rcText.left = rcText.top = rcText.right = rcText.bottom = 0;
+ SetRectEmpty(&rcText);
/* get the rectangle that the text fits in */
if (item->pszText)
/* Draw the text */
if(infoPtr->dwStyle & TCS_VERTICAL) /* if we are vertical rotate the text and each character */
{
- static const WCHAR ArialW[] = { 'A','r','i','a','l',0 };
LOGFONTW logfont;
- HFONT hFont = 0;
+ HFONT hFont;
INT nEscapement = 900;
INT nOrientation = 900;
}
/* to get a font with the escapement and orientation we are looking for, we need to */
- /* call CreateFontIndirectA, which requires us to set the values of the logfont we pass in */
- if (!GetObjectW((infoPtr->hFont) ?
- infoPtr->hFont : GetStockObject(SYSTEM_FONT),
- sizeof(LOGFONTW),&logfont))
- {
- INT iPointSize = 9;
-
- lstrcpyW(logfont.lfFaceName, ArialW);
- logfont.lfHeight = -MulDiv(iPointSize, GetDeviceCaps(hdc, LOGPIXELSY),
- 72);
- logfont.lfWeight = FW_NORMAL;
- logfont.lfItalic = 0;
- logfont.lfUnderline = 0;
- logfont.lfStrikeOut = 0;
- }
+ /* call CreateFontIndirect, which requires us to set the values of the logfont we pass in */
+ if (!GetObjectW(infoPtr->hFont, sizeof(logfont), &logfont))
+ GetObjectW(GetStockObject(DEFAULT_GUI_FONT), sizeof(logfont), &logfont);
logfont.lfEscapement = nEscapement;
logfont.lfOrientation = nOrientation;
TRACE("for <%s>, c_o_h=%d, c_o_v=%d, draw=(%s), textlen=%d\n",
debugstr_w(item->pszText), center_offset_h, center_offset_v,
wine_dbgstr_rect(drawRect), (rcText.right-rcText.left));
+#ifdef __REACTOS__
+ if (theme && item->pszText)
+ {
+ int partIndex = iItem == infoPtr->iSelected ? TABP_TABITEM : TABP_TOPTABITEM;
+ int stateId = TIS_NORMAL;
+
+ if (iItem == infoPtr->iSelected)
+ stateId = TIS_SELECTED;
+ else if (iItem == infoPtr->iHotTracked)
+ stateId = TIS_HOT;
+ else if (iItem == infoPtr->uFocus)
+ stateId = TIS_FOCUSED;
+
+ DrawThemeText(theme,
+ hdc,
+ partIndex,
+ stateId,
+ item->pszText,
+ lstrlenW(item->pszText),
+ DT_LEFT | DT_SINGLELINE, 0, drawRect);
+ }
+ else
+#endif
if (item->pszText)
{
DrawTextW
if (iItem < 0 || iItem >= infoPtr->uNumItem) return FALSE;
+ TAB_InvalidateTabArea(infoPtr);
item = TAB_GetItem(infoPtr, iItem);
Free(item->pszText);
Free(item);
infoPtr->uNumItem--;
DPA_DeletePtr(infoPtr->items, iItem);
- TAB_InvalidateTabArea(infoPtr);
-
if (infoPtr->uNumItem == 0)
{
if (infoPtr->iHotTracked >= 0)
TEXTMETRICW fontMetrics;
HDC hdc;
HFONT hOldFont;
- DWORD dwStyle;
+ DWORD style;
infoPtr = Alloc (sizeof(TAB_INFO));
/* The tab control always has the WS_CLIPSIBLINGS style. Even
if you don't specify it in CreateWindow. This is necessary in
order for paint to work correctly. This follows windows behaviour. */
- dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
- SetWindowLongW(hwnd, GWL_STYLE, dwStyle|WS_CLIPSIBLINGS);
+ style = GetWindowLongW(hwnd, GWL_STYLE);
+ if (style & TCS_VERTICAL) style |= TCS_MULTILINE;
+ style |= WS_CLIPSIBLINGS;
+ SetWindowLongW(hwnd, GWL_STYLE, style);
- infoPtr->dwStyle = dwStyle | WS_CLIPSIBLINGS;
- infoPtr->exStyle = (dwStyle & TCS_FLATBUTTONS) ? TCS_EX_FLATSEPARATORS : 0;
+ infoPtr->dwStyle = style;
+ infoPtr->exStyle = (style & TCS_FLATBUTTONS) ? TCS_EX_FLATSEPARATORS : 0;
if (infoPtr->dwStyle & TCS_TOOLTIPS) {
/* Create tooltip control */