summaryrefslogtreecommitdiff
path: root/win
diff options
context:
space:
mode:
authorleo2004-10-01 07:32:23 +0000
committerleo2004-10-01 07:32:23 +0000
commitaf000cf32dd8ca77103a5efbae5b72eac99f4cdc (patch)
tree585a6272cf24a2ddbc21292cb3a79fa05afa5373 /win
parent92205f43a642bb255e5141d9c471e49e01ac6cb3 (diff)
Fixed tooltip not updating correctly in some cases.
git-svn-id: http://svn.leocad.org/trunk@360 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'win')
-rw-r--r--win/Piecelst.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/win/Piecelst.cpp b/win/Piecelst.cpp
index 2ff0861..4996dfb 100644
--- a/win/Piecelst.cpp
+++ b/win/Piecelst.cpp
@@ -109,6 +109,50 @@ void CPiecesList::OnItemchanged(NMHDR* pNMHDR, LRESULT* pResult)
if (pBar->m_bGroups)
m_nLastPieces[pBar->m_nCurGroup] = pNMListView->iItem;
+
+ CRect Rect;
+ POINT MousePos;
+
+ GetCursorPos(&MousePos);
+ GetItemRect(pNMListView->iItem, &Rect, LVIR_BOUNDS);
+ ScreenToClient(&MousePos);
+
+ if (Rect.PtInRect(MousePos))
+ {
+ int row, col;
+ RECT cellrect;
+ row = CellRectFromPoint (CPoint(MousePos), &cellrect, &col);
+ if (row != -1)
+ {
+ int offset = 7;
+ if( col == 0 )
+ {
+ CRect rcLabel;
+ GetItemRect(row, &rcLabel, LVIR_LABEL);
+ offset = rcLabel.left - cellrect.left + offset / 2;
+ }
+ cellrect.top--;
+
+ m_TitleTip.ShowWindow(SW_HIDE);
+ m_TitleTip.Show (cellrect, GetItemText(row, col), offset-1, GetItemState (row, LVIS_FOCUSED));
+ }
+ }
+ }
+ else if (pNMListView->uOldState & LVIS_SELECTED)
+ {
+ CWnd* CaptureWnd = GetCapture();
+ if ((CaptureWnd != NULL) && (CaptureWnd ->m_hWnd == m_TitleTip.m_hWnd))
+ ReleaseCapture();
+
+ CRect Rect;
+ POINT MousePos;
+
+ GetCursorPos(&MousePos);
+ GetItemRect(pNMListView->iItem, &Rect, LVIR_BOUNDS);
+ ScreenToClient(&MousePos);
+
+ if (Rect.PtInRect(MousePos))
+ m_TitleTip.ShowWindow(SW_HIDE);
}
*pResult = 0;