ReactOS 0.4.17-dev-684-ga6524ef
CMenuToolbars.cpp
Go to the documentation of this file.
1/*
2 * Shell Menu Band
3 *
4 * Copyright 2014 David Quintana
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20#include "shellmenu.h"
21#include <commoncontrols.h>
22#include <shlwapi_undoc.h>
23#include <uxtheme.h>
24#include <vssym32.h>
25
26#include "CMenuBand.h"
27#include "CMenuToolbars.h"
28
29#define IDS_MENU_EMPTY 34561
30
32
33// FIXME: Enable if/when wine comctl supports this flag properly
34#define USE_TBSTYLE_EX_VERTICAL 0
35
36// User-defined timer ID used while hot-tracking around the menu
37#define TIMERID_HOTTRACK 1
38
40{
41 LRESULT lr;
42 bHandled = OnWinEvent(m_hWnd, uMsg, wParam, lParam, &lr) != S_FALSE;
43 return lr;
44}
45
47{
48 NMHDR * hdr;
49 HRESULT hr;
51
52 if (theResult)
53 *theResult = 0;
54 switch (uMsg)
55 {
56 case WM_COMMAND:
57 //return OnCommand(wParam, lParam, theResult);
58 return S_OK;
59
60 case WM_NOTIFY:
61 hdr = reinterpret_cast<LPNMHDR>(lParam);
62 switch (hdr->code)
63 {
65 return OnDeletingButton(reinterpret_cast<LPNMTOOLBAR>(hdr));
66
67 case PGN_CALCSIZE:
68 return OnPagerCalcSize(reinterpret_cast<LPNMPGCALCSIZE>(hdr));
69
70 case TBN_DROPDOWN:
71 return ProcessClick(reinterpret_cast<LPNMTOOLBAR>(hdr)->iItem);
72
74 //return OnHotItemChange(reinterpret_cast<LPNMTBHOTITEM>(hdr), theResult);
75 return S_OK;
76
77 case NM_CUSTOMDRAW:
78 hr = OnCustomDraw(reinterpret_cast<LPNMTBCUSTOMDRAW>(hdr), &result);
79 if (theResult)
80 *theResult = result;
81 return hr;
82
83 case TBN_GETINFOTIP:
84 return OnGetInfoTip(reinterpret_cast<LPNMTBGETINFOTIP>(hdr));
85
86 // Silence unhandled items so that they don't print as unknown
87 case RBN_CHILDSIZE:
88 return S_OK;
89
90 case TTN_GETDISPINFO:
91 return S_OK;
92
94 break;
95
96 case NM_CLICK:
97 case NM_RDOWN:
98 case NM_LDOWN:
99 break;
100
101 case TBN_GETDISPINFO:
102 break;
103
104 case TBN_BEGINDRAG:
105 case TBN_ENDDRAG:
106 break;
107
109 break;
110
111 case TBN_DRAGOUT: return S_FALSE;
112
113 default:
114 TRACE("WM_NOTIFY unknown code %d, %d\n", hdr->code, hdr->idFrom);
115 return S_OK;
116 }
117 return S_FALSE;
118 case WM_WININICHANGE:
119 if (wParam == SPI_SETFLATMENU)
120 {
121 SystemParametersInfo(SPI_GETFLATMENU, 0, &m_useFlatMenus, 0);
122 }
123 }
124
125 return S_FALSE;
126}
127
129{
130 if (m_disableMouseTrack != bDisable)
131 {
132 m_disableMouseTrack = bDisable;
133 TRACE("DisableMouseTrack %d\n", bDisable);
134 }
135 return S_OK;
136}
137
139{
140 SIZE tbs;
141 GetSizes(NULL, &tbs, NULL);
142 if (csize->dwFlag == PGF_CALCHEIGHT)
143 {
144 csize->iHeight = tbs.cy;
145 }
146 else if (csize->dwFlag == PGF_CALCWIDTH)
147 {
148 csize->iWidth = tbs.cx;
149 }
150 return S_OK;
151}
152
154{
155 bool isHot, isPopup, isActive;
156 TBBUTTONINFO btni;
157
158 switch (cdraw->nmcd.dwDrawStage)
159 {
160 case CDDS_PREPAINT:
161 *theResult = CDRF_NOTIFYITEMDRAW;
162 return S_OK;
163
165
166 HWND tlw;
168
169 // The item with an active submenu gets the CHECKED flag.
170 isHot = m_hotBar == this && (int) cdraw->nmcd.dwItemSpec == m_hotItem;
171 isPopup = m_popupBar == this && (int) cdraw->nmcd.dwItemSpec == m_popupItem;
172 isActive = (GetForegroundWindow() == tlw) || (m_popupBar == this);
173
174 if (m_hotItem < 0 && isPopup)
175 isHot = TRUE;
176
177 if ((m_useFlatMenus && isHot) || (m_initFlags & SMINIT_VERTICAL))
178 {
179 COLORREF clrText;
180 HBRUSH bgBrush;
181 RECT rc = cdraw->nmcd.rc;
182 HDC hdc = cdraw->nmcd.hdc;
183
184 // Remove HOT and CHECKED flags (will restore HOT if necessary)
185 cdraw->nmcd.uItemState &= ~(CDIS_HOT | CDIS_CHECKED);
186
187 // Decide on the colors
188 if (isHot)
189 {
190 cdraw->nmcd.uItemState |= CDIS_HOT;
191
193 bgBrush = GetSysColorBrush(m_useFlatMenus ? COLOR_MENUHILIGHT : COLOR_HIGHLIGHT);
194 }
195 else
196 {
197 clrText = GetSysColor(COLOR_MENUTEXT);
198 bgBrush = GetSysColorBrush(COLOR_MENU);
199 }
200
201 // Paint the background color with the selected color
202 FillRect(hdc, &rc, bgBrush);
203
204 // Set the text color in advance, this color will be assigned when the ITEMPOSTPAINT triggers
205 SetTextColor(hdc, clrText);
206
207 // Set the text color, will be used by the internal drawing code
208 cdraw->clrText = clrText;
209 cdraw->iListGap += 4;
210
211 // Tell the default drawing code we don't want any fanciness, not even a background.
212 *theResult = CDRF_NOTIFYPOSTPAINT | TBCDRF_NOBACKGROUND | TBCDRF_NOEDGES | TBCDRF_NOOFFSET | TBCDRF_NOMARK | 0x00800000; // FIXME: the last bit is Vista+, useful for debugging only
213 }
214 else
215 {
216 // Set the text color, will be used by the internal drawing code
217 cdraw->clrText = GetSysColor(isActive ? COLOR_MENUTEXT : COLOR_GRAYTEXT);
218
219 // Remove HOT and CHECKED flags (will restore HOT if necessary)
220 cdraw->nmcd.uItemState &= ~CDIS_HOT;
221
222 // Decide on the colors
223 if (isHot)
224 {
225 cdraw->nmcd.uItemState |= CDIS_HOT;
226 }
227
228 *theResult = 0;
229 }
230
231 return S_OK;
232
234
235 // Fetch the button style
236 btni.cbSize = sizeof(btni);
237 btni.dwMask = TBIF_STYLE;
238 GetButtonInfo(cdraw->nmcd.dwItemSpec, &btni);
239
240 // Check if we need to draw a submenu arrow
241 if (btni.fsStyle & BTNS_DROPDOWN)
242 {
243 // TODO: Support RTL text modes by drawing a leftwards arrow aligned to the left of the control
244
245 // "8" is the rightwards dropdown arrow in the Marlett font
246 WCHAR text [] = L"8";
247
248 // Configure the font to draw with Marlett, keeping the current background color as-is
249 HGDIOBJ hFontOld = SelectObject(cdraw->nmcd.hdc, m_marlett);
250 SetBkMode(cdraw->nmcd.hdc, TRANSPARENT);
251
252 // Tweak the alignment by 1 pixel so the menu draws like the Windows start menu.
253 RECT rc = cdraw->nmcd.rc;
254 rc.right += 1;
255
256 // The arrow is drawn at the right of the item's rect, aligned vertically.
258
259 SelectObject(cdraw->nmcd.hdc, hFontOld);
260 }
261 *theResult = TRUE;
262 return S_OK;
263
264 default:
265 *theResult = 0L;
266 break;
267 }
268 return S_OK;
269}
270
272 m_pager(WC_PAGESCROLLER, this),
273 m_useFlatMenus(FALSE),
274 m_disableMouseTrack(FALSE),
275 m_timerEnabled(FALSE),
276 m_menuBand(menuBand),
277 m_dwMenuFlags(0),
278 m_hasSizes(FALSE),
279 m_usePager(usePager),
280 m_hotBar(NULL),
281 m_hotItem(-1),
282 m_popupBar(NULL),
283 m_popupItem(-1),
284 m_isTrackingPopup(FALSE),
285 m_cancelingPopup(FALSE)
286{
287 m_idealSize.cx = 0;
288 m_idealSize.cy = 0;
289 m_itemSize.cx = 0;
290 m_itemSize.cy = 0;
292 0, 0, 0, 0, 0, 0, 0, 0, DEFAULT_CHARSET,
294 DEFAULT_QUALITY, FF_DONTCARE, L"Marlett");
295}
296
298{
299 if (m_hWnd)
300 {
301 ClearToolbar();
303 }
304
305 if (m_pager.m_hWnd)
306 m_pager.DestroyWindow();
307
309}
310
312{
314}
315
317{
318 if (m_hWnd == NULL)
319 return S_FALSE;
320
321 ShowWindow(fShow ? SW_SHOW : SW_HIDE);
322
323 // Ensure that the right image list is assigned to the toolbar
325
326 // For custom-drawing
327 SystemParametersInfo(SPI_GETFLATMENU, 0, &m_useFlatMenus, 0);
328
329 return S_OK;
330}
331
333{
334 if ((m_initFlags & (SMINIT_TOPLEVEL | SMINIT_VERTICAL)) == SMINIT_TOPLEVEL) // not vertical.
335 {
336 // No image list, prevents the buttons from having a margin at the left side
338 return S_OK;
339 }
340
341 // Assign the correct imagelist and padding based on the current icon size
342
343 int shiml;
344 if (m_menuBand->UseBigIcons())
345 {
346 shiml = SHIL_LARGE;
347 SetPadding(4, 0);
348 }
349 else
350 {
351 shiml = SHIL_SMALL;
352 SetPadding(4, 4);
353 }
354
355 IImageList * piml;
358 {
360 }
361 else
362 {
364 }
365 return S_OK;
366}
367
369{
370 if (m_hWnd)
372
373 if (m_pager.m_hWnd)
374 m_pager.DestroyWindow();
375
376 return S_OK;
377}
378
380{
385
386 if (dwFlags & SMINIT_VERTICAL)
387 {
388 // Activate vertical semantics
389 tbStyles |= CCS_VERT;
390
391#if USE_TBSTYLE_EX_VERTICAL
392 tbExStyles |= TBSTYLE_EX_VERTICAL;
393#endif
394 }
395
397
398 // Get a temporary rect to use while creating the toolbar window.
399 // Ensure that it is not a null rect.
400 RECT rc;
401 if (!::GetClientRect(hwndParent, &rc) ||
402 (rc.left == rc.right) ||
403 (rc.top == rc.bottom))
404 {
405 rc.left = 0;
406 rc.top = 0;
407 rc.right = 1;
408 rc.bottom = 1;
409 }
410
411 // HACK & FIXME: CORE-17505
412 HWND toolbar = CToolbar::Create(hwndParent, tbStyles, tbExStyles);
413 m_hWnd = NULL;
414 SubclassWindow(toolbar);
415
416 SetWindowTheme(m_hWnd, L"", L"");
417
418 SystemParametersInfo(SPI_GETFLATMENU, 0, &m_useFlatMenus, 0);
419
421
422 // If needed, create the pager.
423 if (m_usePager)
424 {
425 LONG pgStyles = PGS_VERT | WS_CHILD | WS_VISIBLE;
426 LONG pgExStyles = 0;
427
428 HWND hwndPager = CreateWindowEx(
429 pgExStyles, WC_PAGESCROLLER, NULL,
430 pgStyles, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
431 hwndParent, NULL, _AtlBaseModule.GetModuleInstance(), 0);
432
433 m_pager.SubclassWindow(hwndPager);
434
435 ::SetParent(m_hWnd, hwndPager);
436
437 m_pager.SendMessageW(PGM_SETCHILD, 0, reinterpret_cast<LPARAM>(m_hWnd));
438 }
439
440 // Configure the image lists
442
443 return S_OK;
444}
445
446HRESULT CMenuToolbarBase::GetSizes(SIZE* pMinSize, SIZE* pMaxSize, SIZE* pIntegralSize)
447{
448 if (pMinSize)
449 *pMinSize = m_idealSize;
450 if (pMaxSize)
451 *pMaxSize = m_idealSize;
452 if (pIntegralSize)
453 *pIntegralSize = m_itemSize;
454
455 if (m_hasSizes)
456 return S_OK;
457
458 TRACE("Sizes out of date, recalculating.\n");
459
460 if (!m_hWnd)
461 {
462 return S_OK;
463 }
464
465 // Obtain the ideal size, to be used as min and max
466 GetMaxSize(&m_idealSize);
467 GetIdealSize((m_initFlags & SMINIT_VERTICAL) != 0, &m_idealSize);
468
469 TRACE("Ideal Size: (%d, %d) for %d buttons\n", m_idealSize, GetButtonCount());
470
471 // Obtain the button size, to be used as the integral size
472 DWORD size = GetButtonSize();
476
477 if (pMinSize)
478 *pMinSize = m_idealSize;
479 if (pMaxSize)
480 *pMaxSize = m_idealSize;
481 if (pIntegralSize)
482 *pIntegralSize = m_itemSize;
483
484 return S_OK;
485}
486
488{
489 // Update the toolbar or pager to fit the requested rect
490 // If we have a pager, set the toolbar height to the ideal height of the toolbar
491 if (m_pager.m_hWnd)
492 {
494 m_pager.SetWindowPos(NULL, x, y, cx, cy, 0);
495 }
496 else
497 {
498 SetWindowPos(NULL, x, y, cx, cy, 0);
499 }
500
501 // In a vertical menu, resize the buttons to fit the width
502 if (m_initFlags & SMINIT_VERTICAL)
503 {
504 DWORD btnSize = GetButtonSize();
505 SetButtonSize(cx, GET_Y_LPARAM(btnSize));
506 }
507
508 return S_OK;
509}
510
512{
513 if (m_hWnd && m_hWnd == hwnd) return S_OK;
514 if (m_pager.m_hWnd && m_pager.m_hWnd == hwnd) return S_OK;
515 return S_FALSE;
516}
517
519{
520 if (!phwnd)
521 return E_FAIL;
522
523 if (m_pager.m_hWnd)
524 *phwnd = m_pager.m_hWnd;
525 else
526 *phwnd = m_hWnd;
527
528 return S_OK;
529}
530
532{
533 INT index;
535
536 INT iItem = tip->iItem;
537
538 GetDataFromId(iItem, &index, &dwData);
539
540 return InternalGetTooltip(iItem, index, dwData, tip->pszText, tip->cchTextMax);
541}
542
544{
546 {
547 bHandled = FALSE;
548 return 0;
549 }
550
552
553 if (!m_timerEnabled)
554 return 0;
555
557
558 if (m_hotItem < 0)
559 return 0;
560
561 // Returns S_FALSE if the current item did not show a submenu
563 if (hr != S_FALSE)
564 return 0;
565
566 // If we didn't switch submenus, cancel the current popup regardless
567 if (m_popupBar)
568 {
571 return 0;
572 }
573
574 return 0;
575}
576
578{
579 if (m_timerEnabled)
580 {
583 return S_OK;
584 }
585 return S_FALSE;
586}
587
589{
590 // Ignore the change if it already matches the stored info
591 if (m_hotBar == toolbar && m_hotItem == item)
592 return S_FALSE;
593
594 // Prevent a change of hot item if the change was triggered by the mouse,
595 // and mouse tracking is disabled.
597 {
598 TRACE("Hot item change prevented by DisableMouseTrack\n");
599 return S_OK;
600 }
601
602 // Notify the toolbar if the hot-tracking left this toolbar
603 if (m_hotBar == this && toolbar != this)
604 {
605 SetHotItem(-1);
606 }
607
608 TRACE("Hot item changed from %p %p, to %p %p\n", m_hotBar, m_hotItem, toolbar, item);
609 m_hotBar = toolbar;
610 m_hotItem = item;
611
612 if (m_hotBar == this)
613 {
614 if (m_isTrackingPopup && !(m_initFlags & SMINIT_VERTICAL))
615 {
616 // If the menubar has an open submenu, switch to the new item's submenu immediately
618 }
619 else if (dwFlags & HICF_MOUSE)
620 {
621 // Vertical menus show/hide the submenu after a delay,
622 // but only with the mouse.
623 if (m_initFlags & SMINIT_VERTICAL)
624 {
625 DWORD elapsed = 0;
626 SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &elapsed, 0);
627 SetTimer(TIMERID_HOTTRACK, elapsed);
629 TRACE("SetTimer called with m_hotItem=%d\n", m_hotItem);
630 }
631 }
632 else
633 {
635 info.cbSize = sizeof(info);
636 info.dwMask = 0;
637
638 int index = GetButtonInfo(item, &info);
639
640 SetHotItem(index);
641 }
642 }
643
645 return S_OK;
646}
647
649{
650 // Ignore the change if it already matches the stored info
651 if (m_popupBar == toolbar && m_popupItem == item)
652 return S_FALSE;
653
654 // Notify the toolbar if the popup-tracking this toolbar
655 if (m_popupBar == this && toolbar != this)
656 {
657 CheckButton(m_popupItem, FALSE);
659 }
660
661 m_popupBar = toolbar;
663
664 if (m_popupBar == this)
665 {
666 CheckButton(m_popupItem, TRUE);
667 }
668
670 return S_OK;
671}
672
674{
675 TBBUTTON btn;
676 INT idx = (INT)wParam;
677
678 if (m_hotBar != this)
679 return S_FALSE;
680
681 if (idx < 0)
682 return S_FALSE;
683
684 if (!GetButton(idx, &btn))
685 return E_FAIL;
686
687 if (m_hotItem == btn.idCommand)
688 return S_OK;
689
690 if (m_popupItem == btn.idCommand)
691 return S_OK;
692
693 return S_FALSE;
694}
695
697{
698 TBBUTTON btn;
699 BOOL wasTracking = LOWORD(lParam);
700 BOOL mouse = HIWORD(lParam);
701 INT idx = (INT)wParam;
702
703 if (idx < 0)
704 {
707 }
708
709 if (!GetButton(idx, &btn))
710 return E_FAIL;
711
712 TRACE("ChangeTrackedItem %d, %d\n", idx, wasTracking);
713 m_isTrackingPopup = wasTracking;
714 return m_menuBand->_ChangeHotItem(this, btn.idCommand, mouse ? HICF_MOUSE : 0);
715}
716
718{
719 // Calculate the submenu position and exclude area
720 RECT rc = { 0 };
721
722 if (!GetItemRect(index, &rc))
723 return E_FAIL;
724
725 POINT a = { rc.left, rc.top };
726 POINT b = { rc.right, rc.bottom };
727
730
731 POINTL pt = { a.x, b.y };
732 RECTL rcl = { a.x, a.y, b.x, b.y };
733
734 if (m_initFlags & SMINIT_VERTICAL)
735 {
736 // FIXME: Hardcoding this here feels hacky.
737 if (IsAppThemed())
738 {
739 pt.x = b.x - 1;
740 pt.y = a.y - 1;
741 }
742 else
743 {
744 pt.x = b.x - 3;
745 pt.y = a.y - 3;
746 }
747 }
748
749 // Display the submenu
751
752 m_menuBand->_ChangePopupItem(this, iItem);
753 m_menuBand->_OnPopupSubMenu(childShellMenu, &pt, &rcl, keyInitiated);
754
755 return S_OK;
756}
757
759{
760 // Calculate the submenu position and exclude area
761 RECT rc = { 0 };
762
763 if (!GetItemRect(index, &rc))
764 return E_FAIL;
765
766 POINT a = { rc.left, rc.top };
767 POINT b = { rc.right, rc.bottom };
768
771
772 POINT pt = { a.x, b.y };
773 RECT rcl = { a.x, a.y, b.x, b.y };
774
775 if (m_initFlags & SMINIT_VERTICAL)
776 {
777 pt.x = b.x;
778 pt.y = a.y;
779 }
780
781 HMENU popup = GetSubMenu(menu, index);
782
783 // Display the submenu
785 m_menuBand->_ChangePopupItem(this, iItem);
786 m_menuBand->_TrackSubMenu(popup, pt.x, pt.y, rcl);
789
790 return S_OK;
791}
792
794{
795 // Cancel submenus
797 if (m_popupBar)
799
800 // Display the context menu
801 return m_menuBand->_TrackContextMenu(contextMenu, pt.x, pt.y);
802}
803
805{
807 TRACE("BeforeCancelPopup\n");
808 return S_OK;
809}
810
812{
814 {
815 TRACE("Item click prevented by DisableMouseTrack\n");
816 return S_OK;
817 }
818
819 // If a button is clicked while a submenu was open, cancel the submenu.
820 if (!(m_initFlags & SMINIT_VERTICAL) && m_isTrackingPopup)
821 {
822 TRACE("OnCommand cancelled because it was tracking submenu.\n");
823 return S_FALSE;
824 }
825
826 if (PopupItem(iItem, FALSE) == S_OK)
827 {
828 TRACE("PopupItem returned S_OK\n");
829 return S_FALSE;
830 }
831
832 TRACE("Executing...\n");
833
834 return m_menuBand->_MenuItemSelect(MPOS_EXECUTE);
835}
836
838{
839 INT index;
841
842 GetDataFromId(iItem, &index, &data);
843
846
847 return InternalContextMenu(iItem, index, data, pt);
848}
849
851{
852 TBBUTTON btn;
853
854 GetButton(iIndex, &btn);
855
856 // Ignore disabled items
857 if (!(btn.fsState & TBSTATE_ENABLED))
858 return S_OK;
859
860 if ((m_initFlags & SMINIT_VERTICAL)
861 || m_popupBar
863 {
865 return S_OK;
866 }
867
868 return ProcessClick(btn.idCommand);
869}
870
872{
873 TBBUTTON btn;
874
876
877 if (!(m_initFlags & SMINIT_VERTICAL))
878 return S_OK;
879
880 GetButton(iIndex, &btn);
881
882 // Ignore disabled items
883 if (!(btn.fsState & TBSTATE_ENABLED))
884 return S_OK;
885
886 if (isLButton)
887 return ProcessClick(btn.idCommand);
888 else
889 return ProcessContextMenu(btn.idCommand);
890}
891
893{
895
896 m_executeItem = iItem;
898}
899
901{
903}
904
906{
907 int prev = m_hotItem;
908 int index = -1;
909
910 if (dwSelectType != 0xFFFFFFFF)
911 {
912 int count = GetButtonCount();
913
914 if (dwSelectType == VK_HOME)
915 {
916 index = 0;
917 dwSelectType = VK_DOWN;
918 }
919 else if (dwSelectType == VK_END)
920 {
921 index = count - 1;
922 dwSelectType = VK_UP;
923 }
924 else
925 {
926 if (m_hotItem >= 0)
927 {
928 TBBUTTONINFO info = { 0 };
929 info.cbSize = sizeof(TBBUTTONINFO);
930 info.dwMask = 0;
931 index = GetButtonInfo(m_hotItem, &info);
932 }
933
934 if (index < 0)
935 {
936 if (dwSelectType == VK_UP)
937 {
938 index = count - 1;
939 }
940 else if (dwSelectType == VK_DOWN)
941 {
942 index = 0;
943 }
944 }
945 else
946 {
947 if (dwSelectType == VK_UP)
948 {
949 index--;
950 }
951 else if (dwSelectType == VK_DOWN)
952 {
953 index++;
954 }
955 }
956 }
957
958 TBBUTTON btn = { 0 };
959 while (index >= 0 && index < count)
960 {
961 DWORD res = GetButton(index, &btn);
962 if (!res)
963 return E_FAIL;
964
965 if (btn.dwData)
966 {
967 if (prev != btn.idCommand)
968 {
969 TRACE("Setting Hot item to %d\n", index);
970 if (!(m_initFlags & SMINIT_VERTICAL) && m_isTrackingPopup)
971 {
972 HWND tlw;
974 ::SendMessageW(tlw, WM_CANCELMODE, 0, 0);
976 }
977 else
978 m_menuBand->_ChangeHotItem(this, btn.idCommand, 0);
979 }
980 return S_OK;
981 }
982
983 if (dwSelectType == VK_UP)
984 {
985 index--;
986 }
987 else if (dwSelectType == VK_DOWN)
988 {
989 index++;
990 }
991 }
992
993 return S_FALSE;
994 }
995
996 if (prev != -1)
997 {
998 TRACE("Setting Hot item to null\n");
1000 }
1001
1002 return S_FALSE;
1003}
1004
1005HRESULT CMenuToolbarBase::AddButton(DWORD commandId, LPCWSTR caption, BOOL hasSubMenu, INT iconId, DWORD_PTR buttonData, BOOL last)
1006{
1007 TBBUTTON tbb = { 0 };
1008
1010#if !USE_TBSTYLE_EX_VERTICAL
1011 if (!last && (m_initFlags & SMINIT_VERTICAL))
1012 tbb.fsState |= TBSTATE_WRAP;
1013#endif
1015
1016 if (hasSubMenu && (m_initFlags & SMINIT_VERTICAL))
1017 tbb.fsStyle |= BTNS_DROPDOWN;
1018
1019 if (!(m_initFlags & SMINIT_VERTICAL))
1020 tbb.fsStyle |= BTNS_AUTOSIZE;
1021
1022 tbb.iString = (INT_PTR) caption;
1023 tbb.idCommand = commandId;
1024
1025 tbb.iBitmap = iconId;
1026 tbb.dwData = buttonData;
1027
1028 m_hasSizes = FALSE;
1029
1030 if (!AddButtons(1, &tbb))
1032 return S_OK;
1033}
1034
1036{
1037 TBBUTTON tbb = { 0 };
1038
1040#if !USE_TBSTYLE_EX_VERTICAL
1041 if (!last && (m_initFlags & SMINIT_VERTICAL))
1042 tbb.fsState |= TBSTATE_WRAP;
1043#endif
1044 tbb.fsStyle = BTNS_SEP;
1045 tbb.iBitmap = 0;
1046
1047 m_hasSizes = FALSE;
1048
1049 if (!AddButtons(1, &tbb))
1051
1052 return S_OK;
1053}
1054
1056{
1057 TBBUTTON tbb = { 0 };
1058 WCHAR MenuString[128];
1059
1060 LoadStringW(GetModuleHandle(L"shell32.dll"), IDS_MENU_EMPTY, MenuString, _countof(MenuString));
1061
1062 tbb.fsState = 0;
1063 tbb.fsStyle = 0;
1064 tbb.iString = (INT_PTR) MenuString;
1065 tbb.iBitmap = -1;
1066
1067 m_hasSizes = FALSE;
1068
1069 if (!AddButtons(1, &tbb))
1071
1072 return S_OK;
1073}
1074
1076{
1077 while (DeleteButton(0))
1078 {
1079 // empty;
1080 }
1081 m_hasSizes = FALSE;
1082 return S_OK;
1083}
1084
1086{
1087 if (pData)
1088 *pData = NULL;
1089
1090 if (pIndex)
1091 *pIndex = -1;
1092
1093 if (iItem < 0)
1094 return S_OK;
1095
1096 TBBUTTONINFO info = { 0 };
1097
1098 info.cbSize = sizeof(TBBUTTONINFO);
1099 info.dwMask = TBIF_COMMAND | TBIF_LPARAM;
1100
1101 int index = GetButtonInfo(iItem, &info);
1102 if (index < 0)
1103 return E_FAIL;
1104
1105 if (pIndex)
1106 *pIndex = index;
1107
1108 if (pData)
1109 *pData = info.lParam;
1110
1111 return S_OK;
1112}
1113
1115{
1117}
1118
1120{
1121 INT index;
1123
1124 if (iItem < 0)
1125 return S_OK;
1126
1127 if (m_popupBar == this && m_popupItem == iItem)
1128 return S_OK;
1129
1130 GetDataFromId(iItem, &index, &dwData);
1131
1133 if (hr != S_OK)
1134 return hr;
1135
1136 if (m_popupBar)
1137 {
1140 return hr;
1141 }
1142
1143 if (!(m_initFlags & SMINIT_VERTICAL))
1144 {
1145 TRACE("PopupItem non-vertical %d %d\n", index, iItem);
1146 m_menuBand->_ChangeHotItem(this, iItem, 0);
1147 }
1148
1149 return InternalPopupItem(iItem, index, dwData, keyInitiated);
1150}
1151
1153 CMenuToolbarBase(menuBand, FALSE),
1154 m_hmenu(NULL),
1155 m_hwndMenu(NULL)
1156{
1157}
1158
1160{
1161}
1162
1164 _Out_opt_ HMENU *phmenu,
1165 _Out_opt_ HWND *phwnd,
1166 _Out_opt_ DWORD *pdwFlags)
1167{
1168 if (phmenu)
1169 *phmenu = m_hmenu;
1170 if (phwnd)
1171 *phwnd = m_hwndMenu;
1172 if (pdwFlags)
1173 *pdwFlags = m_dwMenuFlags;
1174
1175 return S_OK;
1176}
1177
1179 HMENU hmenu,
1180 HWND hwnd,
1181 DWORD dwFlags)
1182{
1183 m_hmenu = hmenu;
1184 m_hwndMenu = hwnd;
1186
1187 if (IsWindow())
1188 ClearToolbar();
1189
1190 return S_OK;
1191}
1192
1194{
1195 int i;
1196 int ic = GetMenuItemCount(m_hmenu);
1197
1198 if (clearFirst)
1199 {
1200 ClearToolbar();
1201 }
1202
1203 int count = 0;
1204 for (i = 0; i < ic; i++)
1205 {
1206 BOOL last = i + 1 == ic;
1207
1209
1210 info.cbSize = sizeof(info);
1211 info.dwTypeData = NULL;
1212 info.fMask = MIIM_FTYPE | MIIM_STRING | MIIM_ID;
1213
1215 {
1216 TRACE("Error obtaining info for menu item at pos=%d\n", i);
1217 continue;
1218 }
1219
1220 count++;
1221
1222 if (info.fType & MFT_SEPARATOR)
1223 {
1225 }
1226 else if (!(info.fType & MFT_BITMAP))
1227 {
1228 info.cch++;
1229 info.dwTypeData = (PWSTR) HeapAlloc(GetProcessHeap(), 0, (info.cch + 1) * sizeof(WCHAR));
1230
1233
1234 SMINFO * sminfo = new SMINFO();
1235 sminfo->dwMask = SMIM_ICON | SMIM_FLAGS;
1236
1237 HRESULT hr = m_menuBand->_CallCBWithItemId(info.wID, SMC_GETINFO, 0, reinterpret_cast<LPARAM>(sminfo));
1239 {
1240 delete sminfo;
1241 return hr;
1242 }
1243
1244 AddButton(info.wID, info.dwTypeData, info.hSubMenu != NULL, sminfo->iIcon, reinterpret_cast<DWORD_PTR>(sminfo), last);
1245
1246 HeapFree(GetProcessHeap(), 0, info.dwTypeData);
1247 }
1248 }
1249
1250 return S_OK;
1251}
1252
1254{
1255 //SMINFO * info = reinterpret_cast<SMINFO*>(dwData);
1257 return E_NOTIMPL;
1258}
1259
1261{
1262 delete reinterpret_cast<SMINFO*>(tb->tbButton.dwData);
1263 return S_OK;
1264}
1265
1267{
1268 CComPtr<IContextMenu> contextMenu;
1269 HRESULT hr = m_menuBand->_CallCBWithItemId(iItem, SMC_GETOBJECT,
1270 reinterpret_cast<WPARAM>(&IID_IContextMenu), reinterpret_cast<LPARAM>(&contextMenu));
1271 if (hr != S_OK)
1272 return hr;
1273
1274 return TrackContextMenu(contextMenu, pt);
1275}
1276
1278{
1279 return m_menuBand->_CallCBWithItemId(iItem, SMC_EXEC, 0, 0);
1280}
1281
1283{
1284 SMINFO * nfo = reinterpret_cast<SMINFO*>(dwData);
1285 if (!nfo)
1286 return E_FAIL;
1287
1288 if (nfo->dwFlags&SMIF_TRACKPOPUP)
1289 {
1290 return PopupSubMenu(iItem, index, m_hmenu);
1291 }
1292 else
1293 {
1294 CComPtr<IShellMenu> shellMenu;
1295 HRESULT hr = m_menuBand->_CallCBWithItemId(iItem, SMC_GETOBJECT, reinterpret_cast<WPARAM>(&IID_IShellMenu), reinterpret_cast<LPARAM>(&shellMenu));
1297 return hr;
1298
1299 return PopupSubMenu(iItem, index, shellMenu, keyInitiated);
1300 }
1301}
1302
1304{
1305 return ::GetSubMenu(m_hmenu, index) ? S_OK : S_FALSE;
1306}
1307
1309 CMenuToolbarBase(menuBand, TRUE),
1310 m_shellFolder(NULL),
1311 m_idList(NULL),
1312 m_hKey(NULL)
1313{
1314}
1315
1317{
1318}
1319
1321{
1322 IShellFolder * psf = (IShellFolder*) lParam;
1325 HRESULT hr = psf->CompareIDs(0, pidl1, pidl2);
1326 if (FAILED(hr))
1327 {
1328 // No way to cancel, so sort to equal.
1329 return 0;
1330 }
1331 return (int)(short)LOWORD(hr);
1332}
1333
1335{
1336 WCHAR szTarget[MAX_PATH], szPath[MAX_PATH];
1337 if (!SHGetPathFromIDListW(pidlTarget, szTarget))
1338 return FALSE;
1340 if (lstrcmpiW(szTarget, szPath) == 0)
1341 return TRUE;
1343 return (lstrcmpiW(szTarget, szPath) == 0);
1344}
1345
1347{
1348 HRESULT hr;
1349
1350 CComPtr<IEnumIDList> eidl;
1351 hr = m_shellFolder->EnumObjects(GetToolbar(), SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &eidl);
1353 return hr;
1354
1355 HDPA dpaSort = DPA_Create(10);
1356
1358 hr = eidl->Next(1, &item, NULL);
1359 while (hr == S_OK)
1360 {
1361 if (m_menuBand->_CallCBWithItemPidl(item, 0x10000000, 0, 0) == S_FALSE)
1362 {
1363 DPA_AppendPtr(dpaSort, item);
1364 }
1365 else
1366 {
1368 }
1369
1370 hr = eidl->Next(1, &item, NULL);
1371 }
1372
1373 // If no items were added, show the "empty" placeholder
1374 if (DPA_GetPtrCount(dpaSort) == 0)
1375 {
1376 DPA_Destroy(dpaSort);
1377 return AddPlaceholder();
1378 }
1379
1380 TRACE("FillToolbar added %d items to the DPA\n", DPA_GetPtrCount(dpaSort));
1381
1383
1384 BOOL StartMenuAdminTools = SHRegGetBoolUSValueW(
1385 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
1386 L"StartMenuAdminTools", FALSE, TRUE);
1387
1388 BOOL bMustHideAdminTools = IsPidlPrograms(m_idList) && !StartMenuAdminTools;
1389 TRACE("StartMenuAdminTools: %d\n", StartMenuAdminTools);
1390 TRACE("bMustHideAdminTools: %d\n", bMustHideAdminTools);
1391
1392 WCHAR szAdminTools[MAX_PATH];
1393 if (bMustHideAdminTools)
1394 {
1396 szAdminTools, _countof(szAdminTools));
1397 }
1398
1399 for (int i = 0; i<DPA_GetPtrCount(dpaSort);)
1400 {
1401 item = (LPITEMIDLIST)DPA_GetPtr(dpaSort, i);
1402
1403 STRRET sr = { STRRET_CSTR };
1404 hr = m_shellFolder->GetDisplayNameOf(item, SIGDN_NORMALDISPLAY, &sr);
1406 {
1407 DPA_Destroy(dpaSort);
1408 return hr;
1409 }
1410
1411 PWSTR MenuString;
1412 StrRetToStr(&sr, NULL, &MenuString);
1413
1414 if (bMustHideAdminTools && lstrcmpiW(MenuString, szAdminTools) == 0)
1415 {
1416 ++i;
1417 CoTaskMemFree(MenuString);
1418 continue;
1419 }
1420
1421 INT indexOpen = 0;
1423
1424 LPCITEMIDLIST itemc = item;
1425
1426 SFGAOF attrs = SFGAO_FOLDER;
1427 hr = m_shellFolder->GetAttributesOf(1, &itemc, &attrs);
1428
1429 DWORD_PTR dwData = reinterpret_cast<DWORD_PTR>(item);
1430
1431 // Fetch next item already, so we know if the current one is the last
1432 i++;
1433
1434 AddButton(i, MenuString, attrs & SFGAO_FOLDER, index, dwData, i >= DPA_GetPtrCount(dpaSort));
1435
1436 CoTaskMemFree(MenuString);
1437 }
1438
1439 DPA_Destroy(dpaSort);
1440 return hr;
1441}
1442
1444{
1445 //ITEMIDLIST * pidl = reinterpret_cast<LPITEMIDLIST>(dwData);
1447 return E_NOTIMPL;
1448}
1449
1451{
1452 ILFree(reinterpret_cast<LPITEMIDLIST>(tb->tbButton.dwData));
1453 return S_OK;
1454}
1455
1457{
1458 m_shellFolder = psf;
1459 m_idList = ILClone(pidlFolder);
1460 m_hKey = hKey;
1462
1463 if (IsWindow())
1464 ClearToolbar();
1465
1466 return S_OK;
1467}
1468
1470{
1471 HRESULT hr;
1472
1473 hr = m_shellFolder->QueryInterface(riid, ppv);
1475 return hr;
1476
1477 if (pdwFlags)
1478 *pdwFlags = m_dwMenuFlags;
1479
1480 if (ppidl)
1481 {
1482 LPITEMIDLIST pidl = NULL;
1483
1484 if (m_idList)
1485 {
1486 pidl = ILClone(m_idList);
1487 if (!pidl)
1488 {
1489 ERR("ILClone failed!\n");
1490 (*reinterpret_cast<IUnknown**>(ppv))->Release();
1491 return E_FAIL;
1492 }
1493 }
1494
1495 *ppidl = pidl;
1496 }
1497
1498 return hr;
1499}
1500
1502{
1503 HRESULT hr;
1504 CComPtr<IContextMenu> contextMenu = NULL;
1505 LPCITEMIDLIST pidl = reinterpret_cast<LPCITEMIDLIST>(dwData);
1506
1507 hr = m_shellFolder->GetUIObjectOf(GetToolbar(), 1, &pidl, IID_NULL_PPV_ARG(IContextMenu, &contextMenu));
1509 {
1510 return hr;
1511 }
1512
1513 hr = TrackContextMenu(contextMenu, pt);
1514
1515 return hr;
1516}
1517
1519{
1520 return m_menuBand->_CallCBWithItemPidl(reinterpret_cast<LPITEMIDLIST>(data), SMC_SFEXEC, 0, 0);
1521}
1522
1524{
1525 HRESULT hr;
1526 UINT uId;
1527 UINT uIdAncestor;
1528 DWORD flags;
1529 CComPtr<IShellMenuCallback> psmc;
1530 CComPtr<IShellMenu> shellMenu;
1531
1532 LPITEMIDLIST pidl = reinterpret_cast<LPITEMIDLIST>(dwData);
1533
1534 if (!pidl)
1535 return E_FAIL;
1536
1539 return hr;
1540
1541 m_menuBand->GetMenuInfo(&psmc, &uId, &uIdAncestor, &flags);
1542
1543 // FIXME: not sure what to use as uId/uIdAncestor here
1544 hr = shellMenu->Initialize(psmc, 0, uId, SMINIT_VERTICAL);
1546 return hr;
1547
1548 CComPtr<IShellFolder> childFolder;
1549 hr = m_shellFolder->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder, &childFolder));
1551 return hr;
1552
1553 hr = shellMenu->SetShellFolder(childFolder, NULL, NULL, SMSET_TOP);
1555 return hr;
1556
1557 return PopupSubMenu(iItem, index, shellMenu, keyInitiated);
1558}
1559
1561{
1562 HRESULT hr;
1563 LPCITEMIDLIST pidl = reinterpret_cast<LPITEMIDLIST>(dwData);
1564
1565 SFGAOF attrs = SFGAO_FOLDER;
1566 hr = m_shellFolder->GetAttributesOf(1, &pidl, &attrs);
1568 return hr;
1569
1570 return (attrs & SFGAO_FOLDER) ? S_OK : S_FALSE;
1571}
#define IDS_MENU_EMPTY
int CALLBACK PidlListSort(void *item1, void *item2, LPARAM lParam)
static BOOL IsPidlPrograms(LPCITEMIDLIST pidlTarget)
#define TIMERID_HOTTRACK
#define WM_USER_CHANGETRACKEDITEM
Definition: CMenuToolbars.h:26
HWND hWnd
Definition: settings.c:17
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define index(s, c)
Definition: various.h:29
#define ERR(fmt,...)
Definition: precomp.h:57
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
HRESULT _CallCBWithItemPidl(LPITEMIDLIST pidl, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CMenuBand.cpp:775
HRESULT _OnPopupSubMenu(IShellMenu *childShellMenu, POINTL *pAt, RECTL *pExclude, BOOL mouseInitiated)
Definition: CMenuBand.cpp:1066
HRESULT _GetTopLevelWindow(HWND *topLevel)
Definition: CMenuBand.cpp:885
HRESULT _TrackContextMenu(IContextMenu *popup, INT x, INT y)
Definition: CMenuBand.cpp:823
HRESULT _TrackSubMenu(HMENU popup, INT x, INT y, RECT &rcExclude)
Definition: CMenuBand.cpp:802
BOOL UseBigIcons()
Definition: CMenuBand.h:207
HRESULT _KillPopupTimers()
Definition: CMenuBand.cpp:1130
HRESULT _MenuItemSelect(DWORD changeType)
Definition: CMenuBand.cpp:965
HRESULT _CancelCurrentPopup()
Definition: CMenuBand.cpp:1049
HRESULT _CallCBWithItemId(UINT Id, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CMenuBand.cpp:770
HRESULT _ChangeHotItem(CMenuToolbarBase *tb, INT id, DWORD dwFlags)
Definition: CMenuBand.cpp:891
HRESULT AdjustForTheme(BOOL bFlatStyle)
Definition: CMenuBand.cpp:1167
HRESULT _ChangePopupItem(CMenuToolbarBase *tb, INT id)
Definition: CMenuBand.cpp:910
STDMETHOD() GetMenuInfo(IShellMenuCallback **ppsmc, UINT *puId, UINT *puIdAncestor, DWORD *pdwFlags) override
Definition: CMenuBand.cpp:91
virtual HRESULT InternalGetTooltip(INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax) override
virtual HRESULT InternalPopupItem(INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated) override
virtual HRESULT InternalContextMenu(INT iItem, INT index, DWORD_PTR dwData, POINT pt) override
HRESULT SetShellFolder(IShellFolder *psf, LPCITEMIDLIST pidlFolder, HKEY hKey, DWORD dwFlags)
virtual HRESULT FillToolbar(BOOL clearFirst=FALSE) override
HRESULT GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv)
virtual ~CMenuSFToolbar()
virtual HRESULT OnDeletingButton(const NMTOOLBAR *tb) override
virtual HRESULT InternalHasSubMenu(INT iItem, INT index, DWORD_PTR dwData) override
CMenuSFToolbar(CMenuBand *menuBand)
LPCITEMIDLIST m_idList
virtual HRESULT InternalExecuteItem(INT iItem, INT index, DWORD_PTR dwData) override
CComPtr< IShellFolder > m_shellFolder
CMenuStaticToolbar(CMenuBand *menuBand)
virtual HRESULT InternalExecuteItem(INT iItem, INT index, DWORD_PTR dwData) override
HRESULT GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags)
virtual HRESULT OnDeletingButton(const NMTOOLBAR *tb) override
virtual HRESULT InternalGetTooltip(INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax) override
HRESULT SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags)
virtual ~CMenuStaticToolbar()
virtual HRESULT InternalContextMenu(INT iItem, INT index, DWORD_PTR dwData, POINT pt) override
virtual HRESULT InternalPopupItem(INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated) override
virtual HRESULT FillToolbar(BOOL clearFirst=FALSE) override
virtual HRESULT InternalHasSubMenu(INT iItem, INT index, DWORD_PTR dwData) override
HRESULT PopupSubMenu(UINT itemId, UINT index, IShellMenu *childShellMenu, BOOL keyInitiated)
HRESULT UpdateImageLists()
HRESULT GetSizes(SIZE *pMinSize, SIZE *pMaxSize, SIZE *pIntegralSize)
LRESULT ChangeTrackedItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
DWORD_PTR m_executeData
Definition: CMenuToolbars.h:55
HRESULT PopupItem(INT iItem, BOOL keyInitiated)
HRESULT AddPlaceholder()
LRESULT OnWinEventWrap(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
HRESULT KillPopupTimer()
HRESULT ProcessContextMenu(INT iItem)
CContainedWindow m_pager
Definition: CMenuToolbars.h:31
HRESULT OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
virtual HRESULT InternalGetTooltip(INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax) PURE
CMenuToolbarBase * m_popupBar
Definition: CMenuToolbars.h:47
virtual HRESULT OnDeletingButton(const NMTOOLBAR *tb) PURE
HRESULT CancelCurrentPopup()
LRESULT IsTrackedItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
HRESULT KeyboardItemChange(DWORD changeType)
CMenuToolbarBase(CMenuBand *menuBand, BOOL usePager)
HRESULT IsWindowOwner(HWND hwnd)
HRESULT OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT *theResult)
HRESULT ChangePopupItem(CMenuToolbarBase *toolbar, INT item)
HRESULT OnGetInfoTip(NMTBGETINFOTIP *tip)
HRESULT DisableMouseTrack(BOOL bDisable)
virtual ~CMenuToolbarBase()
HRESULT PrepareExecuteItem(INT iItem)
HRESULT MenuBarMouseUp(INT iIndex, BOOL isLButton)
HRESULT ShowDW(BOOL fShow)
HRESULT TrackContextMenu(IContextMenu *contextMenu, POINT pt)
HRESULT CreateToolbar(HWND hwndParent, DWORD dwFlags)
HRESULT ProcessClick(INT iItem)
virtual HRESULT InternalExecuteItem(INT iItem, INT index, DWORD_PTR dwData) PURE
HRESULT MenuBarMouseDown(INT iIndex, BOOL isLButton)
HRESULT GetDataFromId(INT iItem, INT *pIndex, DWORD_PTR *pData)
HRESULT SetPosSize(int x, int y, int cx, int cy)
HRESULT OnPopupTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
HRESULT ChangeHotItem(CMenuToolbarBase *toolbar, INT item, DWORD dwFlags)
HRESULT OnPagerCalcSize(LPNMPGCALCSIZE csize)
virtual HRESULT InternalPopupItem(INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated) PURE
virtual HRESULT InternalHasSubMenu(INT iItem, INT index, DWORD_PTR dwData) PURE
HRESULT GetWindow(HWND *phwnd)
CMenuToolbarBase * m_hotBar
Definition: CMenuToolbars.h:45
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
HRESULT BeforeCancelPopup()
HRESULT AddSeparator(BOOL last)
HRESULT AddButton(DWORD commandId, LPCWSTR caption, BOOL hasSubMenu, INT iconId, DWORD_PTR buttonData, BOOL last)
virtual HRESULT InternalContextMenu(INT iItem, INT index, DWORD_PTR dwData, POINT pt) PURE
HWND Create(HWND hWndParent, DWORD dwStyles=0, DWORD dwExStyles=0)
Definition: rosctrls.h:256
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static HWND hwndParent
Definition: cryptui.c:299
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int idx
Definition: utils.c:41
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
BOOL WINAPI DPA_Sort(HDPA hdpa, PFNDPACOMPARE pfnCompare, LPARAM lParam)
Definition: dpa.c:813
BOOL WINAPI DPA_Destroy(HDPA hdpa)
Definition: dpa.c:396
HDPA WINAPI DPA_Create(INT nGrow)
Definition: dpa.c:950
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4171
BOOL WINAPI SHRegGetBoolUSValueW(const WCHAR *subkey, const WCHAR *value, BOOL ignore_hkcu, BOOL default_value)
Definition: registry.c:4139
const WCHAR * text
Definition: package.c:1794
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:3220
#define FAILED_UNEXPECTEDLY
Definition: utils.cpp:33
BOOL WINAPI IsAppThemed(void)
Definition: system.c:620
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define pt(x, y)
Definition: drawing.c:79
#define L(x)
Definition: resources.c:13
static IShellFolder IShellItem **static IBindCtx LPITEMIDLIST SFGAOF
Definition: ebrowser.c:83
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
pKey DeleteObject()
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint res
Definition: glext.h:9613
GLsizeiptr size
Definition: glext.h:5919
GLuint index
Definition: glext.h:6031
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLbitfield flags
Definition: glext.h:7161
GLuint64EXT * result
Definition: glext.h:11304
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: sysinfo.c:13
int WINAPI SHMapPIDLToSystemImageListIndex(IShellFolder *sh, LPCITEMIDLIST pidl, int *pIndex)
Definition: iconcache.cpp:772
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT CompareIDs([in] LPARAM lParam, [in] PCUIDLIST_RELATIVE pidl1, [in] PCUIDLIST_RELATIVE pidl2)
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
char hdr[14]
Definition: iptest.cpp:33
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
LPCWSTR szPath
Definition: env.c:37
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
static const LARGE_INTEGER *static const HANDLE const LARGE_INTEGER *static PSLIST_ENTRY PSLIST_ENTRY last
Definition: sync.c:64
static const WCHAR tb[]
Definition: suminfo.c:285
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define menu
Definition: input.c:3282
static HMENU hmenu
Definition: win.c:78
static const struct metadata_item item1[]
Definition: metadata.c:3603
static const struct metadata_item item2[]
Definition: metadata.c:3608
static VOID SetImageList(HWND hwnd)
Definition: mplay32.c:238
_Out_ PULONG _Out_ PULONG pIndex
Definition: ndis.h:4565
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
#define _Out_opt_
Definition: no_sal2.h:214
static HANDLE ULONG_PTR dwData
Definition: pipe.c:111
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
short WCHAR
Definition: pedump.c:58
#define WS_VISIBLE
Definition: pedump.c:620
long LONG
Definition: pedump.c:60
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:238
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:1051
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1496
#define INT
Definition: polytest.cpp:20
#define NM_RELEASEDCAPTURE
Definition: commctrl.h:141
#define CDDS_ITEMPOSTPAINT
Definition: commctrl.h:286
#define RBN_CHILDSIZE
Definition: commctrl.h:1636
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define PGS_VERT
Definition: commctrl.h:4507
#define HICF_MOUSE
Definition: commctrl.h:1326
#define TBN_ENDDRAG
Definition: commctrl.h:1308
#define BTNS_AUTOSIZE
Definition: commctrl.h:1004
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:285
#define NM_LDOWN
Definition: commctrl.h:145
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:989
#define WC_PAGESCROLLER
Definition: commctrl.h:4505
#define TBBUTTONINFO
Definition: commctrl.h:1254
#define NMTBGETINFOTIP
Definition: commctrl.h:1393
#define BTNS_SEP
Definition: commctrl.h:999
#define TBCDRF_NOEDGES
Definition: commctrl.h:1033
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:275
#define TBN_HOTITEMCHANGE
Definition: commctrl.h:1336
#define TBIF_LPARAM
Definition: commctrl.h:1223
#define TBSTYLE_LIST
Definition: commctrl.h:993
#define TBCDRF_NOOFFSET
Definition: commctrl.h:1035
#define PGM_SETCHILD
Definition: commctrl.h:4521
_Out_opt_ int * cx
Definition: commctrl.h:585
#define NM_TOOLTIPSCREATED
Definition: commctrl.h:144
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:274
#define TTN_GETDISPINFO
Definition: commctrl.h:1883
#define TBIF_STYLE
Definition: commctrl.h:1222
#define NM_CLICK
Definition: commctrl.h:130
#define LPNMTOOLBAR
Definition: commctrl.h:1457
#define PGN_CALCSIZE
Definition: commctrl.h:4585
#define CCS_VERT
Definition: commctrl.h:2254
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define NMTOOLBAR
Definition: commctrl.h:1456
#define TBSTYLE_EX_DOUBLEBUFFER
Definition: commctrl.h:1014
#define TBCDRF_NOBACKGROUND
Definition: commctrl.h:1040
#define TBSTYLE_TRANSPARENT
Definition: commctrl.h:996
#define CDIS_CHECKED
Definition: commctrl.h:294
#define CCS_NODIVIDER
Definition: commctrl.h:2253
#define TBN_GETDISPINFO
Definition: commctrl.h:1420
#define CCS_TOP
Definition: commctrl.h:2247
#define TBSTYLE_REGISTERDROP
Definition: commctrl.h:995
#define TBSTATE_ENABLED
Definition: commctrl.h:974
#define CDDS_PREPAINT
Definition: commctrl.h:280
#define TBSTYLE_FLAT
Definition: commctrl.h:992
#define TBN_DRAGOUT
Definition: commctrl.h:1337
#define TBN_GETINFOTIP
Definition: commctrl.h:1392
#define BTNS_DROPDOWN
Definition: commctrl.h:1003
#define TBN_BEGINDRAG
Definition: commctrl.h:1307
#define DPA_AppendPtr(hdpa, pitem)
Definition: commctrl.h:4975
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2251
#define DPA_GetPtrCount(hdpa)
Definition: commctrl.h:4972
#define CCS_NORESIZE
Definition: commctrl.h:2250
#define PGF_CALCWIDTH
Definition: commctrl.h:4587
#define TBSTYLE_CUSTOMERASE
Definition: commctrl.h:994
#define TBSTATE_WRAP
Definition: commctrl.h:977
#define TBSTYLE_EX_VERTICAL
Definition: commctrl.h:1011
#define BTNS_CHECKGROUP
Definition: commctrl.h:1002
#define PGF_CALCHEIGHT
Definition: commctrl.h:4588
#define CDIS_HOT
Definition: commctrl.h:297
#define LPNMTBGETINFOTIP
Definition: commctrl.h:1394
#define TBN_DROPDOWN
Definition: commctrl.h:1316
#define TBIF_COMMAND
Definition: commctrl.h:1224
#define TBN_DELETINGBUTTON
Definition: commctrl.h:1338
#define NM_RDOWN
Definition: commctrl.h:146
#define TBCDRF_NOMARK
Definition: commctrl.h:1036
#define REFIID
Definition: guiddef.h:118
#define StrRetToStr
Definition: shlwapi.h:1252
#define WM_NOTIFY
Definition: richedit.h:61
#define LoadStringW
Definition: utils.h:64
#define SHIL_SMALL
Definition: shellapi.h:185
#define SHIL_LARGE
Definition: shellapi.h:184
#define CMenuBand_CreateInstance
Definition: shellmenu.h:80
HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv)
Definition: shellord.c:2760
#define CSIDL_COMMON_PROGRAMS
Definition: shlobj.h:2213
#define CSIDL_PROGRAMS
Definition: shlobj.h:2193
@ SMIM_ICON
Definition: shobjidl.idl:2830
@ SMIM_FLAGS
Definition: shobjidl.idl:2829
@ SMIF_TRACKPOPUP
Definition: shobjidl.idl:2849
struct tagSMINFO SMINFO
#define IDS_ADMINISTRATIVETOOLS
Definition: shresdef.h:278
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
@ STRRET_CSTR
Definition: shtypes.idl:87
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwFlag
Definition: commctrl.h:4592
Definition: dpa.c:49
NMCUSTOMDRAW nmcd
Definition: commctrl.h:1017
COLORREF clrText
Definition: commctrl.h:1021
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
BYTE fsState
Definition: commctrl.h:951
INT_PTR iString
Definition: commctrl.h:959
int idCommand
Definition: commctrl.h:950
DWORD_PTR dwData
Definition: commctrl.h:958
int iBitmap
Definition: commctrl.h:949
BYTE fsStyle
Definition: commctrl.h:952
DWORD_PTR dwItemSpec
Definition: commctrl.h:307
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
DWORD dwMask
Definition: shobjidl.idl:2811
DWORD dwFlags
Definition: shobjidl.idl:2813
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
uint16_t * PWSTR
Definition: typedefs.h:56
int32_t INT_PTR
Definition: typedefs.h:64
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint32_t DWORD_PTR
Definition: typedefs.h:65
uint16_t * LPWSTR
Definition: typedefs.h:56
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
#define SMC_EXEC
Definition: undocshell.h:872
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define GetModuleHandle
Definition: winbase.h:3548
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
DWORD COLORREF
Definition: windef.h:100
#define SubclassWindow(hwnd, lpfn)
Definition: windowsx.h:542
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
#define DPA_GetPtr
Definition: commctrl.h:5
#define S_FALSE
Definition: winerror.h:3451
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define DEFAULT_QUALITY
Definition: wingdi.h:436
#define FF_DONTCARE
Definition: wingdi.h:448
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define DEFAULT_CHARSET
Definition: wingdi.h:384
#define TRANSPARENT
Definition: wingdi.h:950
#define OUT_DEFAULT_PRECIS
Definition: wingdi.h:415
#define CreateFont
Definition: wingdi.h:4889
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:426
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:917
#define CreateWindowEx
Definition: winuser.h:5921
DWORD WINAPI GetSysColor(_In_ int)
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define SW_HIDE
Definition: winuser.h:779
#define MIIM_STRING
Definition: winuser.h:738
#define MIIM_ID
Definition: winuser.h:733
#define COLOR_MENU
Definition: winuser.h:928
#define MAKELPARAM(l, h)
Definition: winuser.h:4116
#define COLOR_GRAYTEXT
Definition: winuser.h:943
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
DWORD WINAPI GetMessagePos(void)
Definition: message.c:1351
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
#define COLOR_HIGHLIGHT
Definition: winuser.h:937
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define WM_CANCELMODE
Definition: winuser.h:1663
#define DT_SINGLELINE
Definition: winuser.h:540
#define WM_COMMAND
Definition: winuser.h:1768
#define WM_WININICHANGE
Definition: winuser.h:1658
#define MIIM_FTYPE
Definition: winuser.h:740
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define VK_UP
Definition: winuser.h:2261
#define DT_NOCLIP
Definition: winuser.h:536
#define MFT_SEPARATOR
Definition: winuser.h:755
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define MIIM_SUBMENU
Definition: winuser.h:734
#define VK_END
Definition: winuser.h:2258
#define VK_HOME
Definition: winuser.h:2259
#define MFT_BITMAP
Definition: winuser.h:749
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:938
#define DT_VCENTER
Definition: winuser.h:543
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define VK_DOWN
Definition: winuser.h:2263
#define SW_SHOW
Definition: winuser.h:786
#define DT_RIGHT
Definition: winuser.h:538
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define COLOR_MENUTEXT
Definition: winuser.h:931
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define SystemParametersInfo
Definition: winuser.h:6024
BOOL WINAPI DestroyWindow(_In_ HWND)
#define DrawTextEx
Definition: winuser.h:5938
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IID_PPV_ARG(Itype, ppType)
#define IID_NULL_PPV_ARG(Itype, ppType)