- Timestamp:
- Mar 31, 2000, 4:44:25 PM (25 years ago)
- Location:
- trunk/src/comctl32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/listview.cpp
r3250 r3285 1 /*$Id: listview.cpp,v 1. 9 2000-03-27 15:08:07cbratschi Exp $*/1 /*$Id: listview.cpp,v 1.10 2000-03-31 14:44:20 cbratschi Exp $*/ 2 2 /* 3 3 * Listview control … … 164 164 if ((infoPtr->uView == LVS_REPORT) && !(infoPtr->dwStyle & LVS_NOCOLUMNHEADER)) 165 165 { 166 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);167 166 RECT rect,rect2; 168 167 … … 3557 3556 static LRESULT LISTVIEW_GetExtendedListViewStyle(HWND hwnd) 3558 3557 { 3559 LISTVIEW_INFO *infoPtr; 3558 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 3559 3560 3560 /* make sure we can get the listview info */ 3561 if (! (infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd)))3562 3561 if (!infoPtr) 3562 return (0); 3563 3563 return (infoPtr->dwExStyle); 3564 3564 } … … 4039 4039 static LRESULT LISTVIEW_GetHotItem(HWND hwnd) 4040 4040 { 4041 LISTVIEW_INFO *infoPtr; 4041 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 4042 4042 4043 /* make sure we can get the listview info */ 4043 if (! (infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd)))4044 4044 if (!infoPtr) 4045 return (-1); 4045 4046 return (infoPtr->nHotItem); 4046 4047 } … … 5495 5496 static LRESULT LISTVIEW_SetColumnWidth(HWND hwnd, INT iCol, INT cx) 5496 5497 { 5497 LISTVIEW_INFO *infoPtr ;5498 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5498 5499 HDITEMA hdi; 5499 5500 LRESULT lret; 5501 5502 // make sure we can get the listview info 5503 if (!infoPtr) 5504 return (FALSE); 5500 5505 5501 5506 // set column width only if in report mode … … 5503 5508 return (FALSE); 5504 5509 5505 // make sure we can get the listview info5506 if (!(infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd)))5507 return (FALSE);5508 5510 if (!infoPtr->hwndHeader) // make sure we have a header 5509 5511 return (FALSE); … … 5542 5544 static LRESULT LISTVIEW_SetExtendedListViewStyle(HWND hwnd, DWORD dwMask, DWORD dwStyle) 5543 5545 { 5544 LISTVIEW_INFO *infoPtr ;5546 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5545 5547 DWORD dwOldStyle; 5548 5546 5549 /* make sure we can get the listview info */ 5547 if (! (infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd)))5548 5550 if (!infoPtr) 5551 return (0); 5549 5552 /* store previous style */ 5550 5553 dwOldStyle = infoPtr->dwExStyle; … … 5570 5573 static LRESULT LISTVIEW_SetHotItem(HWND hwnd, INT iIndex) 5571 5574 { 5572 LISTVIEW_INFO *infoPtr ;5575 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5573 5576 INT iOldIndex; 5577 5574 5578 /* make sure we can get the listview info */ 5575 if (! (infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd)))5579 if (!infoPtr) 5576 5580 return (-1); 5577 5581 /* store previous index */ … … 5926 5930 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5927 5931 INT nOldIndex = infoPtr->nSelectionMark; 5932 5928 5933 infoPtr->nSelectionMark = nIndex; 5929 5934 return nOldIndex; … … 7542 7547 static LRESULT LISTVIEW_Command(HWND hwnd, WPARAM wParam, LPARAM lParam) 7543 7548 { 7549 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 7550 7544 7551 switch (HIWORD(wParam)) 7545 7552 { … … 7550 7557 */ 7551 7558 char buffer[1024]; 7552 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);7553 7559 HDC hdc = GetDC(infoPtr->hwndEdit); 7554 7560 HFONT hFont, hOldFont = 0; -
trunk/src/comctl32/tooltips.cpp
r3280 r3285 1 /* $Id: tooltips.cpp,v 1. 6 2000-03-30 15:39:09cbratschi Exp $ */1 /* $Id: tooltips.cpp,v 1.7 2000-03-31 14:44:23 cbratschi Exp $ */ 2 2 /* 3 3 * Tool tip control … … 2084 2084 if (infoPtr->nTrackTool > -1) 2085 2085 { 2086 DWORD code = 0; 2087 2088 switch (uMsg) 2089 { 2090 case WM_LBUTTONDOWN: 2091 code = NM_CLICK; 2092 break; 2093 2094 case WM_LBUTTONDBLCLK: 2095 code = NM_DBLCLK; 2096 break; 2097 2098 case WM_RBUTTONDOWN: 2099 code = NM_RCLICK; 2100 break; 2101 2102 case WM_RBUTTONDBLCLK: 2103 code = NM_RDBLCLK; 2104 break; 2105 } 2106 2107 if (code) 2108 { 2109 TTTOOL_INFO *toolPtr = &infoPtr->tools[infoPtr->nTrackTool]; 2110 NMHDR hdr; 2111 2112 hdr.hwndFrom = hwnd; 2113 hdr.idFrom = toolPtr->uId; 2114 hdr.code = code; 2115 SendMessageA(toolPtr->hwnd,WM_NOTIFY,(WPARAM)toolPtr->uId,(LPARAM)&hdr); 2116 } 2086 //CB: tocheck: tracking tool without TTF_TRANSPARENT style 2117 2087 } else 2118 2088 { -
trunk/src/comctl32/treeview.cpp
r3280 r3285 1 /* $Id: treeview.cpp,v 1. 5 2000-03-30 15:39:10cbratschi Exp $ */1 /* $Id: treeview.cpp,v 1.6 2000-03-31 14:44:25 cbratschi Exp $ */ 2 2 /* Treeview control 3 3 * … … 30 30 */ 31 31 32 /* CB: todo 32 /* CB: todo/bugs 33 - startup: missing WM_SIZE messages -> i.e. wrong info tip calculation 33 34 - bug in SetScrollInfo/ShowScrollBar: WM_SIZE and WM_NCPAINT problems (i.e. RegEdit) 34 35 - VK_LEFT in WinHlp32 displays expanded icon … … 84 85 static VOID TREEVIEW_ISearch(HWND hwnd,CHAR ch); 85 86 static VOID TREEVIEW_CheckInfoTip(HWND hwnd); 87 static VOID TREEVIEW_HideInfoTip(HWND hwnd,TREEVIEW_INFO *infoPtr); 86 88 87 89 static LRESULT CALLBACK TREEVIEW_Edit_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); … … 1359 1361 if (infoPtr->uInternalStatus & TV_CALCALL) 1360 1362 { 1363 TREEVIEW_HideInfoTip(hwnd,infoPtr); 1361 1364 itemHeight = 0; 1362 1365 ImageList_GetIconSize (infoPtr->himlNormal, &x, &itemHeight); … … 2784 2787 infoPtr->hwndToolTip = 0; 2785 2788 if (!(dwStyle & TVS_NOTOOLTIPS)) 2786 infoPtr->hwndToolTip = createToolTip(hwnd,TTF_TRACK | TTF_ABSOLUTE,TRUE); 2789 { 2790 infoPtr->hwndToolTip = createToolTip(hwnd,TTF_TRACK | TTF_ABSOLUTE | TTF_TRANSPARENT,TRUE); 2791 SendMessageA(infoPtr->hwndToolTip,WM_SETFONT,infoPtr->hFont,0); 2792 } 2787 2793 2788 2794 if (dwStyle & TVS_CHECKBOXES) … … 3754 3760 } 3755 3761 3762 HTREEITEM TREEVIEW_GetInfoTipItem(HWND hwnd,TREEVIEW_INFO *infoPtr,POINT pt) 3763 { 3764 TVHITTESTINFO ht; 3765 3766 ht.pt = pt; 3767 TREEVIEW_HitTest(hwnd,&ht,FALSE); 3768 3769 if (ht.hItem && (ht.flags & TVHT_ONITEM)) 3770 { 3771 TREEVIEW_ITEM *item; 3772 3773 item = &infoPtr->items[(INT)ht.hItem]; 3774 if (item->visible && ((item->text.left < 0) || (item->text.right > infoPtr->uVisibleWidth))) 3775 return ht.hItem; 3776 } 3777 3778 //check tool rect -> no flickering on tip frame 3779 if (infoPtr->tipItem) 3780 { 3781 POINT pt2 = pt; 3782 RECT rect; 3783 3784 GetWindowRect(infoPtr->hwndToolTip,&rect); 3785 ClientToScreen(hwnd,&pt2); 3786 return PtInRect(&rect,pt2) ? infoPtr->tipItem:0; 3787 } 3788 3789 return 0; 3790 } 3791 3756 3792 VOID TREEVIEW_ShowInfoTip(HWND hwnd,TREEVIEW_INFO *infoPtr,TREEVIEW_ITEM *item) 3757 3793 { … … 3762 3798 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 3763 3799 3764 if (dwStyle & TVS_INFOTIP)3800 if (dwStyle & TVS_INFOTIP) 3765 3801 { 3766 3802 NMTVGETINFOTIPW tvgit; … … 3800 3836 ti.hinst = 0; 3801 3837 ti.lpszText = text; 3838 SendMessageA(infoPtr->hwndToolTip,TTM_TRACKACTIVATE,(WPARAM)FALSE,(LPARAM)&ti); 3802 3839 pt.x = item->text.left; 3803 3840 pt.y = item->text.top; … … 3831 3868 { 3832 3869 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); 3833 TVHITTESTINFO ht; 3834 3835 GetCursorPos(&ht.pt); 3836 ScreenToClient(hwnd,&ht.pt); 3837 TREEVIEW_HitTest(hwnd,&ht,TRUE); 3838 3839 if ((ht.hItem != infoPtr->tipItem) || !(ht.flags & TVHT_ONITEMLABEL)) 3870 HTREEITEM hItem; 3871 POINT pt; 3872 3873 GetCursorPos(&pt); 3874 ScreenToClient(hwnd,&pt); 3875 hItem = TREEVIEW_GetInfoTipItem(hwnd,infoPtr,pt); 3876 3877 if (hItem != infoPtr->tipItem) 3840 3878 TREEVIEW_HideInfoTip(hwnd,infoPtr); 3841 3879 } … … 3844 3882 { 3845 3883 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); 3846 TVHITTESTINFO ht; 3847 TREEVIEW_ITEM *item; 3848 3849 ht.pt.x = (INT)LOWORD(lParam); 3850 ht.pt.y = (INT)HIWORD(lParam); 3851 3852 TREEVIEW_HitTest(hwnd,&ht,FALSE); 3853 3854 if (ht.hItem) 3855 { 3856 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 3857 3858 item = &infoPtr->items[(INT)ht.hItem]; 3859 3860 if (infoPtr->hwndToolTip && (ht.flags & TVHT_ONITEMLABEL) && 3861 ((item->text.left < 0) || (item->text.right > infoPtr->uVisibleWidth) || (item->text.top < 0) || (item->text.bottom > infoPtr->uVisibleHeight)) && 3862 (infoPtr->tipItem != item->hItem)) 3863 TREEVIEW_ShowInfoTip(hwnd,infoPtr,item); 3864 else 3865 TREEVIEW_HideInfoTip(hwnd,infoPtr); 3866 3867 if (dwStyle & TVS_TRACKSELECT) 3868 { 3869 //CB: todo: hottracking 3884 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 3885 POINT pt; 3886 3887 pt.x = (INT)LOWORD(lParam); 3888 pt.y = (INT)HIWORD(lParam); 3889 3890 if (infoPtr->hwndToolTip) 3891 { 3892 HTREEITEM hItem = TREEVIEW_GetInfoTipItem(hwnd,infoPtr,pt); 3893 3894 if (infoPtr->tipItem != hItem) 3895 { 3896 if (hItem) 3897 { 3898 TREEVIEW_ITEM *item; 3899 3900 item = &infoPtr->items[(INT)hItem]; 3901 TREEVIEW_ShowInfoTip(hwnd,infoPtr,item); 3902 } else TREEVIEW_HideInfoTip(hwnd,infoPtr); 3870 3903 } 3904 } 3905 3906 if (dwStyle & TVS_TRACKSELECT) 3907 { 3908 //CB: todo: hottracking 3871 3909 } 3872 3910 … … 4235 4273 infoPtr->hBoldFont = CreateFontIndirectA (&logFont); 4236 4274 4275 SendMessageA(infoPtr->hwndToolTip,WM_SETFONT,infoPtr->hFont,1); 4237 4276 infoPtr->uInternalStatus |= TV_CALCALL; 4238 4277 TREEVIEW_CalcItems(hwnd,0,infoPtr); … … 4295 4334 INT scrollY = infoPtr->lefttop.y-newY; 4296 4335 4336 TREEVIEW_HideInfoTip(hwnd,infoPtr); 4297 4337 infoPtr->lefttop.y = newY; 4298 4338 if (!TREEVIEW_UnqueueRefresh(hwnd,TRUE,TRUE)) … … 4361 4401 if (lastPos != infoPtr->lefttop.x) 4362 4402 { 4403 TREEVIEW_HideInfoTip(hwnd,infoPtr); 4363 4404 if (!TREEVIEW_UnqueueRefresh(hwnd,TRUE,TRUE)) 4364 4405 TREEVIEW_CalcItems(hwnd,0,infoPtr); … … 4803 4844 } 4804 4845 4805 static LRESULT TREEVIEW_Notify(HWND hwnd,WPARAM wParam,LPARAM lParam)4806 {4807 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);4808 LPNMHDR hdr = (LPNMHDR)lParam;4809 4810 if (hdr->hwndFrom == infoPtr->hwndToolTip)4811 {4812 LPARAM lp = (LPARAM)GetMessagePos();4813 POINT pt;4814 4815 pt.x = (INT)LOWORD(lp);4816 pt.y = (INT)HIWORD(lp);4817 ScreenToClient(hwnd,&pt);4818 lp = MAKELONG(pt.x,pt.y);4819 4820 if (hdr->code == (UINT)NM_CLICK)4821 TREEVIEW_LButtonDown(hwnd,0,lp);4822 else if (hdr->code == (UINT)NM_RCLICK)4823 TREEVIEW_RButtonDown(hwnd,0,lp);4824 else if (hdr->code == (UINT)NM_DBLCLK)4825 TREEVIEW_LButtonDoubleClick(hwnd,0,lp);4826 else if (hdr->code == (UINT)NM_RDBLCLK)4827 TREEVIEW_RButtonDoubleClick(hwnd,0,lp);4828 }4829 4830 return 0;4831 }4832 4833 4846 static LRESULT WINAPI 4834 4847 TREEVIEW_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) … … 5024 5037 case WM_RBUTTONDBLCLK: 5025 5038 return TREEVIEW_RButtonDoubleClick(hwnd,wParam,lParam); 5026 5027 case WM_NOTIFY:5028 return TREEVIEW_Notify(hwnd,wParam,lParam);5029 5039 5030 5040 case WM_STYLECHANGED:
Note:
See TracChangeset
for help on using the changeset viewer.