Added context menu on right click in treeviews
[reactos.git] / reactos / dll / win32 / comctl32 / comctl32_ros.diff
1 Index: commctrl.c
2 ===================================================================
3 --- commctrl.c (revision 23123)
4 +++ commctrl.c (working copy)
5 @@ -1620,7 +1620,7 @@
6 *
7 * Draw text with shadow.
8 */
9 +int WINAPI DrawShadowText(HDC hdc, LPCWSTR pszText, UINT cch, const RECT *rect, DWORD dwFlags,
10 -int WINAPI DrawShadowText(HDC hdc, LPCWSTR pszText, UINT cch, RECT *rect, DWORD dwFlags,
11 COLORREF crText, COLORREF crShadow, int ixOffset, int iyOffset)
12 {
13 FIXME("(%p, %s, %d, %p, %d, 0x%08x, 0x%08x, %d, %d): stub\n", hdc, debugstr_w(pszText), cch, rect, dwFlags,
14 Index: listview.c
15 ===================================================================
16 --- listview.c (revision 23123)
17 +++ listview.c (working copy)
18 @@ -3810,9 +3810,8 @@
19 if (himl && lvItem.iImage >= 0 && !IsRectEmpty(&rcIcon))
20 {
21 TRACE("iImage=%d\n", lvItem.iImage);
22 + ImageList_Draw(himl, lvItem.iImage, hdc, rcIcon.left, rcIcon.top,
23 + (lvItem.state & LVIS_SELECTED) && (infoPtr->bFocus) ? ILD_SELECTED : ILD_NORMAL);
24 - ImageList_DrawEx(himl, lvItem.iImage, hdc, rcIcon.left, rcIcon.top,
25 - rcIcon.right - rcIcon.left, rcIcon.bottom - rcIcon.top, infoPtr->clrBk, CLR_DEFAULT,
26 - (lvItem.state & LVIS_SELECTED) && (infoPtr->bFocus) ? ILD_SELECTED : ILD_NORMAL);
27 }
28
29 /* Don't bother painting item being edited */
30 Index: propsheet.c
31 ===================================================================
32 --- propsheet.c (revision 25766)
33 +++ propsheet.c (working copy)
34 @@ -2434,6 +2434,28 @@
35 return FALSE;
36 }
37
38 +BOOL CALLBACK
39 +EnumChildProc(HWND hwnd, LPARAM lParam)
40 +{
41 + WCHAR szType[20];
42 + RealGetWindowClassW(hwnd, szType, 20);
43 +
44 + if (strcmpW(szType, WC_EDITW) == 0)
45 + {
46 + if (IsWindowEnabled(hwnd) && IsWindowVisible(hwnd))
47 + {
48 + SetFocus(hwnd);
49 + return FALSE;
50 + }
51 + }
52 + else
53 + {
54 + EnumChildWindows(hwnd, EnumChildProc, 0);
55 + }
56 +
57 + return TRUE;
58 +}
59 +
60 /******************************************************************************
61 * PROPSHEET_SetWizButtons
62 *
63 @@ -2456,17 +2478,6 @@
64 EnableWindow(hwndNext, FALSE);
65 EnableWindow(hwndFinish, FALSE);
66
67 - /* set the default pushbutton to an enabled button */
68 - if (((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH))
69 - SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0);
70 - else if (dwFlags & PSWIZB_NEXT)
71 - SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0);
72 - else if (dwFlags & PSWIZB_BACK)
73 - SendMessageW(hwndDlg, DM_SETDEFID, IDC_BACK_BUTTON, 0);
74 - else
75 - SendMessageW(hwndDlg, DM_SETDEFID, IDCANCEL, 0);
76 -
77 -
78 if (dwFlags & PSWIZB_BACK)
79 EnableWindow(hwndBack, TRUE);
80
81 @@ -2496,6 +2507,32 @@
82 }
83 else if (!(dwFlags & PSWIZB_DISABLEDFINISH))
84 EnableWindow(hwndFinish, TRUE);
85 +
86 + /* set the default pushbutton to an enabled button and give it focus */
87 + if (((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH))
88 + {
89 + SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0);
90 + SetFocus(hwndFinish);
91 + }
92 + else if (dwFlags & PSWIZB_NEXT)
93 + {
94 + SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0);
95 + SetFocus(hwndNext);
96 + }
97 + else if (dwFlags & PSWIZB_BACK)
98 + {
99 + SendMessageW(hwndDlg, DM_SETDEFID, IDC_BACK_BUTTON, 0);
100 + SetFocus(hwndBack);
101 + }
102 + else
103 + {
104 + SendMessageW(hwndDlg, DM_SETDEFID, IDCANCEL, 0);
105 + SetFocus(GetDlgItem(hwndDlg, IDCANCEL));
106 + }
107 +
108 + /* Now try to find an edit control that deserves focus */
109 + EnumChildWindows(PropSheet_GetCurrentPageHwnd(hwndDlg), EnumChildProc, 0);
110 +
111 }
112
113 /******************************************************************************
114 @@ -3555,6 +3558,8 @@
115 * from which to switch to the next page */
116 SendMessageW(hwndTabCtrl, TCM_SETCURSEL, psInfo->active_page, 0);
117
118 + PROPSHEET_UnChanged(hwnd, (HWND)wParam);
119 +
120 return TRUE;
121 }
122
123 Index: tooltips.c
124 ===================================================================
125 --- tooltips.c (revision 25790)
126 +++ tooltips.c (working copy)
127 @@ -2471,7 +2471,34 @@
128 TOOLTIPS_NotifyFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
129 {
130 FIXME ("hwnd=%p wParam=%lx lParam=%lx\n", hwnd, wParam, lParam);
131 + TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
132 + TTTOOL_INFO *toolPtr = infoPtr->tools;
133 + INT nResult;
134
135 + if (lParam == NF_QUERY)
136 + {
137 + if (toolPtr->bNotifyUnicode)
138 + {
139 + return NFR_UNICODE;
140 + } else {
141 + return NFR_ANSI;
142 + }
143 + }
144 + else if (lParam == NF_REQUERY)
145 + {
146 + nResult = (INT) SendMessageW (toolPtr->hwnd, WM_NOTIFYFORMAT,
147 + (WPARAM)hwnd, (LPARAM)NF_QUERY);
148 + if (nResult == NFR_ANSI) {
149 + toolPtr->bNotifyUnicode = FALSE;
150 + TRACE(" -- WM_NOTIFYFORMAT returns: NFR_ANSI\n");
151 + } else if (nResult == NFR_UNICODE) {
152 + toolPtr->bNotifyUnicode = TRUE;
153 + TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
154 + } else {
155 + TRACE (" -- WM_NOTIFYFORMAT returns: error!\n");
156 + }
157 + return nResult;
158 + }
159 return 0;
160 }
161
162 Index: treeview.c
163 ===================================================================
164 --- treeview.c (revision 27134)
165 +++ treeview.c (working copy)
166 @@ -2844,8 +2844,6 @@
167 }
168 }
169
170 - TREEVIEW_UpdateScrollBars(infoPtr);
171 -
172 if (infoPtr->cdmode & CDRF_NOTIFYPOSTPAINT)
173 infoPtr->cdmode =
174 TREEVIEW_SendCustomDrawNotify(infoPtr, CDDS_POSTPAINT, hdc, rect);
175 @@ -4160,6 +4158,22 @@
176 static LRESULT
177 TREEVIEW_RButtonUp(const TREEVIEW_INFO *infoPtr, const POINT *pPt)
178 {
179 + TVHITTESTINFO ht;
180 +
181 + ht.pt = *pPt;
182 +
183 + TREEVIEW_HitTest(infoPtr, &ht);
184 +
185 + if (ht.hItem)
186 + {
187 + /* Change to screen coordinate for WM_CONTEXTMENU */
188 + ClientToScreen(infoPtr->hwnd, &ht.pt);
189 +
190 + /* Send a WM_CONTEXTMENU message in response to the RBUTTONUP */
191 + SendMessageW(infoPtr->hwnd, WM_CONTEXTMENU,
192 + (WPARAM)infoPtr->hwnd, MAKELPARAM(ht.pt.x, ht.pt.y));
193 + }
194 +
195 return 0;
196 }
197