[BUG_FIXED] (Author: tns) Fix tab close button's color remains hovered while mouse leaves.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1150 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
35a496e519
commit
ad9fac22a3
|
@ -466,13 +466,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
|
||||||
// Get cursor position of "Screen"
|
// Get cursor position of "Screen"
|
||||||
// For using the function "WindowFromPoint" afterward!!!
|
// For using the function "WindowFromPoint" afterward!!!
|
||||||
::GetCursorPos(&_draggingPoint);
|
::GetCursorPos(&_draggingPoint);
|
||||||
/*
|
|
||||||
HWND h = ::WindowFromPoint(_draggingPoint);
|
|
||||||
::SetFocus(h);
|
|
||||||
*/
|
|
||||||
|
|
||||||
draggingCursor(_draggingPoint);
|
draggingCursor(_draggingPoint);
|
||||||
//::SendMessage(h, NPPM_INTERNAL_ISDRAGGING, 0, 0);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,31 +475,50 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
|
||||||
int xPos = LOWORD(lParam);
|
int xPos = LOWORD(lParam);
|
||||||
int yPos = HIWORD(lParam);
|
int yPos = HIWORD(lParam);
|
||||||
|
|
||||||
int index = getTabIndexAt(xPos, yPos);
|
int _currentHoverTabItemOld = _currentHoverTabItem;
|
||||||
|
RECT _currentHoverTabRectOld = _currentHoverTabRect;
|
||||||
if (index != -1)
|
bool _isCloseHoverOld = _isCloseHover;
|
||||||
{
|
|
||||||
// Reduce flicker by only redrawing needed tabs
|
|
||||||
|
|
||||||
bool oldVal = _isCloseHover;
|
|
||||||
int oldIndex = _currentHoverTabItem;
|
|
||||||
RECT oldRect;
|
|
||||||
|
|
||||||
::SendMessage(_hSelf, TCM_GETITEMRECT, index, (LPARAM)&_currentHoverTabRect);
|
_currentHoverTabItem = getTabIndexAt(xPos, yPos);
|
||||||
::SendMessage(_hSelf, TCM_GETITEMRECT, oldIndex, (LPARAM)&oldRect);
|
if (_currentHoverTabItem != -1)
|
||||||
_currentHoverTabItem = index;
|
{
|
||||||
|
::SendMessage(_hSelf, TCM_GETITEMRECT, _currentHoverTabItem, (LPARAM)&_currentHoverTabRect);
|
||||||
_isCloseHover = _closeButtonZone.isHit(xPos, yPos, _currentHoverTabRect);
|
_isCloseHover = _closeButtonZone.isHit(xPos, yPos, _currentHoverTabRect);
|
||||||
|
}
|
||||||
if (oldVal != _isCloseHover)
|
else
|
||||||
{
|
{
|
||||||
InvalidateRect(hwnd, &oldRect, FALSE);
|
SetRectEmpty(&_currentHoverTabRect);
|
||||||
|
_isCloseHover = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_currentHoverTabItem != _currentHoverTabItemOld || _isCloseHover != _isCloseHoverOld)
|
||||||
|
{
|
||||||
|
if (_isCloseHoverOld && (_currentHoverTabItem != _currentHoverTabItemOld || !_isCloseHover))
|
||||||
|
InvalidateRect(hwnd, &_currentHoverTabRectOld, FALSE);
|
||||||
|
if (_isCloseHover)
|
||||||
InvalidateRect(hwnd, &_currentHoverTabRect, FALSE);
|
InvalidateRect(hwnd, &_currentHoverTabRect, FALSE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_isCloseHover)
|
||||||
|
{
|
||||||
|
TRACKMOUSEEVENT tme = {};
|
||||||
|
tme.cbSize = sizeof(tme);
|
||||||
|
tme.dwFlags = TME_LEAVE;
|
||||||
|
tme.hwndTrack = hwnd;
|
||||||
|
TrackMouseEvent(&tme);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case WM_MOUSELEAVE:
|
||||||
|
if (_isCloseHover)
|
||||||
|
InvalidateRect(hwnd, &_currentHoverTabRect, FALSE);
|
||||||
|
_currentHoverTabItem = -1;
|
||||||
|
SetRectEmpty(&_currentHoverTabRect);
|
||||||
|
_isCloseHover = false;
|
||||||
|
break;
|
||||||
|
|
||||||
case WM_LBUTTONUP :
|
case WM_LBUTTONUP :
|
||||||
{
|
{
|
||||||
int xPos = LOWORD(lParam);
|
int xPos = LOWORD(lParam);
|
||||||
|
|
Loading…
Reference in New Issue