ReactOS  0.4.13-dev-73-gcfe54aa
startmenu.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2003, 2004 Martin Fuchs
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 
20  //
21  // Explorer clone
22  //
23  // startmenu.cpp
24  //
25  // Explorer start menu
26  //
27  // Martin Fuchs, 19.08.2003
28  //
29  // Credits: Thanks to Everaldo (http://www.everaldo.com) for his nice looking icons.
30  //
31 
32 
33 #include <precomp.h>
34 
35 #include "desktopbar.h"
36 #include "startmenu.h"
37 
38 #include "../dialogs/searchprogram.h"
39 #include "../dialogs/settings.h"
40 
41 
42 #define SHELLPATH_CONTROL_PANEL TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}")
43 #define SHELLPATH_PRINTERS TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{2227A280-3AEA-1069-A2DE-08002B30309D}")
44 #define SHELLPATH_NET_CONNECTIONS TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}")
45 
46 
48  : super(hwnd),
49  _icon_size(icon_size)
50 {
52  _submenu_id = 0;
53 
54  _border_left = 0;
55  _border_top = 0;
57 
58  _floating_btn = false;
59  _arrow_btns = false;
61  _scroll_pos = 0;
62  _invisible_lines = 0;
63 
64  _last_pos = WindowRect(hwnd).pos();
65 #ifdef _LIGHT_STARTMENU
66  _selected_id = -1;
67  _last_mouse_pos = 0;
68 #endif
69 }
70 
72  : super(hwnd),
73  _create_info(create_info),
74  _icon_size(icon_size)
75 {
76  for(StartMenuFolders::const_iterator it=create_info._folders.begin(); it!=create_info._folders.end(); ++it)
77  if (*it)
79 
81  _submenu_id = 0;
82 
83  _border_left = 0;
84  _border_top = create_info._border_top;
86 
87  _floating_btn = create_info._border_top? true: false;
88  _arrow_btns = false;
90  _scroll_pos = 0;
91  _invisible_lines = 0;
92 
93  _last_pos = WindowRect(hwnd).pos();
94 #ifdef _LIGHT_STARTMENU
95  _selected_id = -1;
96  _last_mouse_pos = 0;
97 #endif
98 }
99 
101 {
103 }
104 
105 
106  // We need this wrapper function for s_wcStartMenu, it calls the WIN32 API,
107  // though static C++ initializers are not allowed for Winelib applications.
109 {
110  static BtnWindowClass s_wcStartMenu(CLASSNAME_STARTMENU);
111 
112  return s_wcStartMenu;
113 }
114 
115 
117 
119  CREATORFUNC_INFO creator, void* info, const String& filter)
120 {
121  UINT style, ex_style;
122  int top_height;
123 
124  if (hwndParent) {
126  ex_style = 0;
127  top_height = STARTMENU_TOP_BTN_SPACE;
128  } else {
130  ex_style = WS_EX_TOOLWINDOW;
131  top_height = 0;
132  }
133 
136 
137 #ifndef _LIGHT_STARTMENU
139 #endif
140 
141  AdjustWindowRectEx(&rect, style, FALSE, ex_style);
142 
143  StartMenuCreateInfo create_info;
144 
145  create_info._folders = folders;
146  create_info._border_top = top_height;
147  create_info._creator = creator;
148  create_info._info = info;
149  create_info._filter = filter;
150 
151  if (title)
152  create_info._title = title;
153 
154  HWND hwnd = Window::Create(creator, &create_info, ex_style, GetWndClasss(), title,
155  style, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, hwndParent);
156 
157  // make sure the window is not off the screen
158  MoveVisible(hwnd);
159 
160  return hwnd;
161 }
162 
163 
165 {
166  try {
167  AddEntries();
168 
169  if (super::Init(pcs))
170  return 1;
171 
172  // create buttons for registered entries in _entries
173  for(ShellEntryMap::const_iterator it=_entries.begin(); it!=_entries.end(); ++it) {
174  const StartMenuEntry& sme = it->second;
175  bool hasSubmenu = false;
176 
177  for(ShellEntrySet::const_iterator it=sme._entries.begin(); it!=sme._entries.end(); ++it)
178  if ((*it)->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
179  hasSubmenu = true;
180 
181 #ifdef _LIGHT_STARTMENU
182  _buttons.push_back(SMBtnInfo(sme, it->first, hasSubmenu));
183 #else
184  AddButton(sme._title, sme._hIcon, hasSubmenu, it->first);
185 #endif
186  }
187 
188 #ifdef _LIGHT_STARTMENU
189  if (_buttons.empty())
190 #else
191  if (!GetWindow(_hwnd, GW_CHILD))
192 #endif
193  AddButton(ResString(IDS_EMPTY), ICID_NONE, false, 0, false);
194 
195 #ifdef _LIGHT_STARTMENU
196  ResizeToButtons();
197 #endif
198 
199 #ifdef _LAZY_ICONEXTRACT
200  PostMessage(_hwnd, PM_UPDATE_ICONS, 0, 0);
201 #endif
202  } catch(COMException& e) {
203  HandleException(e, pcs->hwndParent); // destroys the start menu window while switching focus
204  }
205 
206  return 0;
207 }
208 
210 {
211  for(StartMenuShellDirs::iterator it=_dirs.begin(); it!=_dirs.end(); ++it) {
212  StartMenuDirectory& smd = *it;
213  ShellDirectory& dir = smd._dir;
214 
215  if (!dir._scanned) {
216  WaitCursor wait;
217 
218 #ifdef _LAZY_ICONEXTRACT
219  dir.smart_scan(SORT_NAME, SCAN_DONT_EXTRACT_ICONS); // lazy icon extraction, try to read directly from filesystem
220 #else
221  dir.smart_scan(SORT_NAME);
222 #endif
223  }
224 
225  AddShellEntries(dir, -1, smd._ignore);
226  }
227 }
228 
229 
231 {
232  LPTSTR p = path;
233 
234  while(*p)
235  ++p;
236 
237  if (p>path && (p[-1]=='\\' || p[-1]=='/'))
238  *--p = '\0';
239 
240  return path;
241 }
242 
244 {
245  TCHAR ignore_path[MAX_PATH], ignore_dir[MAX_PATH], ignore_name[_MAX_FNAME], ignore_ext[_MAX_EXT];
246  TCHAR dir_path[MAX_PATH];
247 
248  if (!ignore.empty()) {
249  _tsplitpath_s(ignore, ignore_path, COUNTOF(ignore_path), ignore_dir, COUNTOF(ignore_dir), ignore_name, COUNTOF(ignore_name), ignore_ext, COUNTOF(ignore_ext));
250 
251  _tcscat(ignore_path, ignore_dir);
252  _tcscat(ignore_name, ignore_ext);
253 
254  dir.get_path(dir_path, COUNTOF(dir_path));
255 
256  if (_tcsicmp(trim_path_slash(dir_path), trim_path_slash(ignore_path)))
257  *ignore_name = '\0';
258  } else
259  *ignore_name = '\0';
260 
261  String lwr_filter = _create_info._filter;
262  lwr_filter.toLower();
263 
264  int cnt = 0;
265  for(Entry*entry=dir._down; entry; entry=entry->_next) {
266  // hide files like "desktop.ini"
267  if (entry->_shell_attribs & SFGAO_HIDDEN)
268  //not appropriate for drive roots: if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
269  continue;
270 
271  // hide "Programs" subfolders if requested
272  if (*ignore_name && !_tcsicmp(entry->_data.cFileName, ignore_name))
273  continue;
274 
275  // only 'max' entries shall be added.
276  if (++cnt == max)
277  break;
278 
279  // filter only non-directory entries
280  if (!(entry->_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && !lwr_filter.empty()) {
281  String lwr_name = entry->_data.cFileName;
282  String lwr_disp = entry->_display_name;
283 
284  lwr_name.toLower();
285  lwr_disp.toLower();
286 
287  if (!_tcsstr(lwr_name,lwr_filter) && !_tcsstr(lwr_disp,lwr_filter))
288  continue;
289  }
290 
291  if (entry->_etype == ET_SHELL)
292  AddEntry(dir._folder, static_cast<ShellEntry*>(entry));
293  else
294  AddEntry(dir._folder, entry);
295  }
296 }
297 
298 
300 {
301  switch(nmsg) {
302  case WM_PAINT: {
303  PaintCanvas canvas(_hwnd);
304  Paint(canvas);
305  break;}
306 
307  case WM_SIZE:
309  break;
310 
311  case WM_MOVE: {
312  POINTS pos;
313  pos.x = LOWORD(lparam);
314  pos.y = HIWORD(lparam);
315 
316  // move open submenus of floating menus
317  if (_submenu) {
318  int dx = pos.x - _last_pos.x;
319  int dy = pos.y - _last_pos.y;
320 
321  if (dx || dy) {
322  WindowRect rt(_submenu);
323  SetWindowPos(_submenu, 0, rt.left+dx, rt.top+dy, 0, 0, SWP_NOSIZE|SWP_NOACTIVATE);
324  //MoveVisible(_submenu);
325  }
326  }
327 
328  _last_pos.x = pos.x;
329  _last_pos.y = pos.y;
330  goto def;}
331 
332  case WM_NCHITTEST: {
334 
335  if (res>=HTSIZEFIRST && res<=HTSIZELAST)
336  return HTCLIENT; // disable window resizing
337 
338  return res;}
339 
340  case WM_LBUTTONDOWN: {
341  RECT rect;
342 
343  // check mouse cursor for coordinates of floating button
345 
346  if (PtInRect(&rect, Point(lparam))) {
347  // create a floating copy of the current start menu
348  WindowRect pos(_hwnd);
349 
352  CloseStartMenu();
353  }
354 
355 #ifdef _LIGHT_STARTMENU
356  int id = ButtonHitTest(Point(lparam));
357 
358  if (id)
359  Command(id, BN_CLICKED);
360 #endif
361  break;}
362 
363  case WM_SYSCOMMAND:
364  if ((wparam&0xFFF0) == SC_SIZE)
365  return 0; // disable window resizing
366  goto def;
367 
368  case WM_ACTIVATEAPP:
369  // close start menu when activating another application
370  if (!wparam)
371  CloseStartMenu();
372  break; // don't call super::WndProc in case "this" has been deleted
373 
374  case WM_CANCELMODE:
375  CloseStartMenu();
376 
377 #ifdef _LIGHT_STARTMENU
378  if (_scroll_mode != SCROLL_NOT) {
379  ReleaseCapture();
380  KillTimer(_hwnd, 0);
381  }
382 #endif
383  break;
384 
385 #ifdef _LIGHT_STARTMENU
386  case WM_MOUSEMOVE: {
387  // automatically set the focus to startmenu entries when moving the mouse over them
388  if (lparam != _last_mouse_pos) { // don't process WM_MOUSEMOVE when opening submenus using keyboard navigation
389  Point pt(lparam);
390 
391  if (_arrow_btns) {
392  RECT rect_up, rect_down;
393 
394  GetArrowButtonRects(&rect_up, &rect_down, _icon_size);
395 
396  SCROLL_MODE scroll_mode = SCROLL_NOT;
397 
398  if (PtInRect(&rect_up, pt))
399  scroll_mode = SCROLL_UP;
400  else if (PtInRect(&rect_down, pt))
401  scroll_mode = SCROLL_DOWN;
402 
403  if (scroll_mode != _scroll_mode) {
404  if (scroll_mode == SCROLL_NOT) {
405  ReleaseCapture();
406  KillTimer(_hwnd, 0);
407  } else {
408  CloseSubmenus();
409  SetTimer(_hwnd, 0, 150, NULL); // 150 ms scroll interval
410  SetCapture(_hwnd);
411  }
412 
413  _scroll_mode = scroll_mode;
414  }
415  }
416 
417  int new_id = ButtonHitTest(pt);
418 
419  if (new_id>0 && new_id!=_selected_id)
420  SelectButton(new_id);
421 
422  _last_mouse_pos = lparam;
423  }
424  break;}
425 
426  case WM_TIMER:
427  if (_scroll_mode == SCROLL_UP) {
428  if (_scroll_pos > 0) {
429  --_scroll_pos;
430  InvalidateRect(_hwnd, NULL, TRUE);
431  }
432  } else {
433  if (_scroll_pos <= _invisible_lines) {
434  ++_scroll_pos;
435  InvalidateRect(_hwnd, NULL, TRUE);
436  }
437  }
438  break;
439 
440  case WM_KEYDOWN:
441  ProcessKey(wparam);
442  break;
443 #else
444  case PM_STARTENTRY_FOCUSED: {
445  BOOL hasSubmenu = wparam;
446  HWND hctrl = (HWND)lparam;
447 
448  // automatically open submenus
449  if (hasSubmenu) {
450  UpdateWindow(_hwnd); // draw focused button before waiting on submenu creation
451  //SendMessage(_hwnd, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hctrl),BN_CLICKED), (LPARAM)hctrl);
453  } else {
454  // close any open submenu
456  }
457  break;}
458 #endif
459 
460 #ifdef _LAZY_ICONEXTRACT
461  case PM_UPDATE_ICONS:
462  UpdateIcons(/*wparam*/);
463  break;
464 #endif
465 
467  if (GetWindowStyle(_hwnd) & WS_CAPTION) // don't automatically close floating menus
468  return 0;
469 
470  // route message to the parent menu and close menus after launching an entry
471  if (!SendParent(nmsg, wparam, lparam))
472  CloseStartMenu();
473  return 1; // signal that we have received and processed the message
474 
475  case PM_STARTMENU_CLOSED:
476  _submenu = 0;
477  break;
478 
479  case PM_SELECT_ENTRY:
480  SelectButtonIndex(0, wparam!=0);
481  break;
482 
483 #ifdef _LIGHT_STARTMENU
484  case WM_CONTEXTMENU: {
485  Point screen_pt(lparam), clnt_pt=screen_pt;
486  ScreenToClient(_hwnd, &clnt_pt);
487 
488  int id = ButtonHitTest(clnt_pt);
489 
490  if (id) {
491  StartMenuEntry& sme = _entries[id];
492 
493  for(ShellEntrySet::iterator it=sme._entries.begin(); it!=sme._entries.end(); ++it) {
494  Entry* entry = *it;
495 
496  if (entry) {
497  CHECKERROR(entry->do_context_menu(_hwnd, screen_pt, _cm_ifs)); // may close start menu because of focus loss
499  break;
500  }
501  }
502  }
503  break;}
504 #endif
505 
506  default: def:
507  return super::WndProc(nmsg, wparam, lparam);
508  }
509 
510  return 0;
511 }
512 
513 
514 #ifdef _LIGHT_STARTMENU
515 
516 int StartMenu::ButtonHitTest(POINT pt)
517 {
518  ClientRect clnt(_hwnd);
519  const int icon_size = _icon_size;
521 
522  if (pt.x<rect.left || pt.x>rect.right)
523  return 0;
524 
525  for(SMBtnVector::const_iterator it=_buttons.begin()+_scroll_pos; it!=_buttons.end(); ++it) {
526  const SMBtnInfo& info = *it;
527 
528  if (rect.top > pt.y)
529  break;
530 
532 
533  if (rect.bottom > _bottom_max)
534  break;
535 
536  if (pt.y < rect.bottom) // PtInRect(&rect, pt)
537  return info._id;
538 
539  rect.top = rect.bottom;
540  }
541 
542  return 0;
543 }
544 
545 void StartMenu::InvalidateSelection()
546 {
547  if (_selected_id <= 0)
548  return;
549 
550  ClientRect clnt(_hwnd);
551  const int icon_size = _icon_size;
553 
554  for(SMBtnVector::const_iterator it=_buttons.begin()+_scroll_pos; it!=_buttons.end(); ++it) {
555  const SMBtnInfo& info = *it;
556 
558 
559  if (info._id == _selected_id) {
560  InvalidateRect(_hwnd, &rect, TRUE);
561  break;
562  }
563 
564  rect.top = rect.bottom;
565  }
566 }
567 
568 const SMBtnInfo* StartMenu::GetButtonInfo(int id) const
569 {
570  for(SMBtnVector::const_iterator it=_buttons.begin(); it!=_buttons.end(); ++it)
571  if (it->_id == id)
572  return &*it;
573 
574  return NULL;
575 }
576 
577 bool StartMenu::SelectButton(int id, bool open_sub)
578 {
579  if (id == -1)
580  return false;
581 
582  if (id == _selected_id)
583  return true;
584 
585  InvalidateSelection();
586 
587  const SMBtnInfo* btn = GetButtonInfo(id);
588 
589  if (btn && btn->_enabled) {
590  _selected_id = id;
591 
592  InvalidateSelection();
593 
594  // automatically open submenus
595  if (btn->_hasSubmenu) {
596  if (open_sub)
597  OpenSubmenu();
598  } else
599  CloseOtherSubmenus(); // close any open submenu
600 
601  return true;
602  } else {
603  _selected_id = -1;
604  return false;
605  }
606 }
607 
608 bool StartMenu::OpenSubmenu(bool select_first)
609 {
610  if (_selected_id == -1)
611  return false;
612 
613  InvalidateSelection();
614 
615  const SMBtnInfo* btn = GetButtonInfo(_selected_id);
616 
617  // automatically open submenus
618  if (btn->_hasSubmenu) {
619  //@@ allows destroying of startmenu when processing PM_UPDATE_ICONS -> GPF
620  UpdateWindow(_hwnd); // draw focused button before waiting on submenu creation
621  Command(_selected_id, BN_CLICKED);
622 
623  if (select_first && _submenu)
625 
626  return true;
627  } else
628  return false;
629 }
630 
631 
632 int StartMenu::GetSelectionIndex()
633 {
634  if (_selected_id == -1)
635  return -1;
636 
637  for(int i=0; i<(int)_buttons.size(); ++i)
638  if (_buttons[i]._id == _selected_id)
639  return i;
640 
641  return -1;
642 }
643 
644 bool StartMenu::SelectButtonIndex(int idx, bool open_sub)
645 {
646  if (idx>=0 && idx<(int)_buttons.size())
647  return SelectButton(_buttons[idx]._id, open_sub);
648  else
649  return false;
650 }
651 
652 void StartMenu::ProcessKey(int vk)
653 {
654  switch(vk) {
655  case VK_RETURN:
656  if (_selected_id)
657  Command(_selected_id, BN_CLICKED);
658  break;
659 
660  case VK_UP:
661  Navigate(-1);
662  break;
663 
664  case VK_DOWN:
665  Navigate(+1);
666  break;
667 
668  case VK_HOME:
669  SelectButtonIndex(0, false);
670  break;
671 
672  case VK_END:
673  SelectButtonIndex(_buttons.size()-1, false);
674  break;
675 
676  case VK_LEFT:
677  if (_submenu)
679  else if (!(GetWindowStyle(_hwnd) & WS_CAPTION)) // don't automatically close floating menus
680  DestroyWindow(_hwnd);
681  break;
682 
683  case VK_RIGHT:
684  OpenSubmenu(true);
685  break;
686 
687  case VK_ESCAPE:
688  CloseStartMenu();
689  break;
690 
691  default:
692  if (vk>='0' && vk<='Z')
693  JumpToNextShortcut(vk);
694  }
695 }
696 
697 bool StartMenu::Navigate(int step)
698 {
699  int idx = GetSelectionIndex();
700 
701  if (idx == -1)
702  {
703  if (step > 0)
704  idx = 0 - step;
705  else
706  idx = _buttons.size() - step;
707  }
708 
709  for(;;) {
710  idx += step;
711 
712  if (_buttons.size()<=1 && (idx<0 || idx>(int)_buttons.size()))
713  break;
714 
715  if (idx < 0)
716  idx += _buttons.size();
717 
718  if (idx > (int)_buttons.size())
719  idx -= _buttons.size()+1;
720 
721  if (SelectButtonIndex(idx, false))
722  return true;
723  }
724 
725  return false;
726 }
727 
728 bool StartMenu::JumpToNextShortcut(char c)
729 {
730  int cur_idx = GetSelectionIndex();
731 
732  if (cur_idx == -1)
733  cur_idx = 0;
734 
735  int first_found = 0;
736  int found_more = 0;
737 
738  SMBtnVector::const_iterator cur_it = _buttons.begin();
739  cur_it += cur_idx + 1;
740 
741  // first search down from current item...
742  SMBtnVector::const_iterator it = cur_it;
743  for(; it!=_buttons.end(); ++it) {
744  const SMBtnInfo& btn = *it;
745 
746  if (!btn._title.empty() && toupper((TBYTE)btn._title.at(0)) == c) {
747  if (!first_found)
748  first_found = btn._id;
749  else
750  ++found_more;
751  }
752  }
753 
754  // ...now search from top to the current item
755  it = _buttons.begin();
756  for(; it!=_buttons.end() && it!=cur_it; ++it) {
757  const SMBtnInfo& btn = *it;
758 
759  if (!btn._title.empty() && toupper((TBYTE)btn._title.at(0)) == c) {
760  if (!first_found)
761  first_found = btn._id;
762  else
763  ++found_more;
764  }
765  }
766 
767  if (first_found) {
768  SelectButton(first_found);
769 
770  if (!found_more)
771  Command(first_found, BN_CLICKED);
772 
773  return true;
774  } else
775  return false;
776 }
777 
778 #endif // _LIGHT_STARTMENU
779 
780 
781 bool StartMenu::GetButtonRect(int id, PRECT prect) const
782 {
783 #ifdef _LIGHT_STARTMENU
784  ClientRect clnt(_hwnd);
785  const int icon_size = _icon_size;
787 
788  for(SMBtnVector::const_iterator it=_buttons.begin()+_scroll_pos; it!=_buttons.end(); ++it) {
789  const SMBtnInfo& info = *it;
790 
792 
793  if (info._id == id) {
794  *prect = rect;
795  return true;
796  }
797 
798  rect.top = rect.bottom;
799  }
800 
801  return false;
802 #else
803  HWND btn = GetDlgItem(_hwnd, id);
804 
805  if (btn) {
806  GetWindowRect(btn, prect);
807  ScreenToClient(_hwnd, prect);
808 
809  return true;
810  } else
811  return false;
812 #endif
813 }
814 
815 
817 {
818  static ResIconEx floatingIcon(IDI_FLOATING, 8, 4);
819 
820  ClientRect clnt(_hwnd);
821 
822  DrawIconEx(hdc, clnt.right-12, 0, floatingIcon, 8, 4, 0, 0, DI_NORMAL);
823 }
824 
826 {
827  GetClientRect(_hwnd, prect);
828 
829  prect->right -= 4;
830  prect->left = prect->right - 8;
831  prect->bottom = 4;
832 }
833 
834 
836 {
837  int cx = icon_size / 2;
838  int cy = icon_size / 4;
839 
840  ResIconEx arrowUpIcon(IDI_ARROW_UP, cx, cy);
841  ResIconEx arrowDownIcon(IDI_ARROW_DOWN, cx, cy);
842 
843  ClientRect clnt(_hwnd);
844 
845  DrawIconEx(hdc, clnt.right/2-cx/2, _floating_btn?3:1, arrowUpIcon, cx, cy, 0, 0, DI_NORMAL);
846  DrawIconEx(hdc, clnt.right/2-cx/2, clnt.bottom-cy-1, arrowDownIcon, cx, cy, 0, 0, DI_NORMAL);
847 }
848 
849 void StartMenu::GetArrowButtonRects(LPRECT prect_up, LPRECT prect_down, int icon_size)
850 {
851  int cx = icon_size / 2;
852  int cy = icon_size / 4;
853 
854  GetClientRect(_hwnd, prect_up);
855  *prect_down = *prect_up;
856 
857 // prect_up->left = prect_up->right/2 - cx/2;
858 // prect_up->right = prect_up->left + cy;
859  prect_up->right -= cx;
860  prect_up->top = _floating_btn? cy-1: 1;
861  prect_up->bottom = prect_up->top + cy;
862 
863 // prect_down->left = prect_down->right/2 - cx/2;
864 // prect_down->right = prect_down->left + cy;
865  prect_down->right -= cx;
866  prect_down->top = prect_down->bottom - cy - 1;
867 }
868 
869 
870 void StartMenu::Paint(PaintCanvas& canvas)
871 {
872  if (_floating_btn)
873  DrawFloatingButton(canvas);
874 
875 #ifdef _LIGHT_STARTMENU
876  if (_arrow_btns)
877  DrawArrows(canvas, _icon_size);
878 
879  ClientRect clnt(_hwnd);
880  const int icon_size = _icon_size;
882 
883  int sep_width = rect.right-rect.left - 4;
884 
885  FontSelection font(canvas, GetStockFont(DEFAULT_GUI_FONT));
886  BkMode bk_mode(canvas, TRANSPARENT);
887 
888  for(SMBtnVector::const_iterator it=_buttons.begin()+_scroll_pos; it!=_buttons.end(); ++it) {
889  const SMBtnInfo& btn = *it;
890 
891  if (rect.top > canvas.rcPaint.bottom)
892  break;
893 
894  if (btn._id == -1) { // a separator?
895  rect.bottom = rect.top + STARTMENU_SEP_HEIGHT(icon_size);
896 
897  if (rect.bottom > _bottom_max)
898  break;
899 
900  BrushSelection brush_sel(canvas, GetSysColorBrush(COLOR_BTNSHADOW));
901  PatBlt(canvas, rect.left+2, rect.top+STARTMENU_SEP_HEIGHT(icon_size)/2-1, sep_width, 1, PATCOPY);
902 
904  PatBlt(canvas, rect.left+2, rect.top+STARTMENU_SEP_HEIGHT(icon_size)/2, sep_width, 1, PATCOPY);
905  } else {
906  rect.bottom = rect.top + STARTMENU_LINE_HEIGHT(icon_size);
907 
908  if (rect.bottom > _bottom_max)
909  break;
910 
911  if (rect.top >= canvas.rcPaint.top)
912  DrawStartMenuButton(canvas, rect, btn._title, btn, btn._id==_selected_id, false, _icon_size);
913  }
914 
915  rect.top = rect.bottom;
916  }
917 #endif
918 }
919 
920 #ifdef _LAZY_ICONEXTRACT
921 void StartMenu::UpdateIcons(/*int idx*/)
922 {
923  UpdateWindow(_hwnd);
924 
925 #ifdef _SINGLE_ICONEXTRACT
926 
927  //if (idx >= 0)
928  int idx = _scroll_pos;
929 
930  for(; idx<(int)_buttons.size(); ++idx) {
931  SMBtnInfo& btn = _buttons[idx];
932 
933  if (btn._icon_id==ICID_UNKNOWN && btn._id>0) {
934  StartMenuEntry& sme = _entries[btn._id];
935 
936  btn._icon_id = ICID_NONE;
937 
938  for(ShellEntrySet::iterator it=sme._entries.begin(); it!=sme._entries.end(); ++it) {
939  Entry* entry = *it;
940 
941  if (entry->_icon_id == ICID_UNKNOWN)
942  entry->_icon_id = entry->safe_extract_icon(ICF_FROM_ICON_SIZE(_icon_size));
943 
944  if (entry->_icon_id > ICID_NONE) {
945  btn._icon_id = (ICON_ID)/*@@*/ entry->_icon_id;
946 
947  RECT rect;
948 
949  GetButtonRect(btn._id, &rect);
950 
951  if (rect.bottom > _bottom_max)
952  break;
953 
954  WindowCanvas canvas(_hwnd);
955  DrawStartMenuButton(canvas, rect, NULL, btn, btn._id==_selected_id, false, _icon_size);
956 
957  //InvalidateRect(_hwnd, &rect, FALSE);
958  //UpdateWindow(_hwnd);
959  //break;
960 
961  break;
962  }
963  }
964  }
965  }
966 
967 // if (++idx < (int)_buttons.size())
968 // PostMessage(_hwnd, PM_UPDATE_ICONS, idx, 0);
969 
970 #else
971 
972  int icons_extracted = 0;
973  int icons_updated = 0;
974 
975  for(StartMenuShellDirs::iterator it=_dirs.begin(); it!=_dirs.end(); ++it) {
976  ShellDirectory& dir = it->_dir;
977 
978  icons_extracted += dir.extract_icons(icon_size);
979  }
980 
981  if (icons_extracted) {
982  for(ShellEntryMap::iterator it1=_entries.begin(); it1!=_entries.end(); ++it1) {
983  StartMenuEntry& sme = it1->second;
984 
985  if (!sme._hIcon) {
986  sme._hIcon = (HICON)-1;
987 
988  for(ShellEntrySet::const_iterator it2=sme._entries.begin(); it2!=sme._entries.end(); ++it2) {
989  const Entry* sm_entry = *it2;
990 
991  if (sm_entry->_hIcon) {
992  sme._hIcon = sm_entry->_hIcon;
993  break;
994  }
995  }
996  }
997  }
998 
999  for(SMBtnVector::iterator it=_buttons.begin(); it!=_buttons.end(); ++it) {
1000  SMBtnInfo& info = *it;
1001 
1002  if (info._id>0 && !info._hIcon) {
1003  info._hIcon = _entries[info._id]._hIcon;
1004  ++icons_updated;
1005  }
1006  }
1007  }
1008 
1009  if (icons_updated) {
1010  InvalidateRect(_hwnd, NULL, FALSE);
1011  UpdateWindow(_hwnd);
1012  }
1013 #endif
1014 }
1015 #endif
1016 
1017 
1018  // resize child button controls to accomodate for new window size
1020 {
1021  HDWP hdwp = BeginDeferWindowPos(10);
1022 
1024  ClientRect rt(ctrl);
1025 
1026  if (rt.right != cx) {
1027  int height = rt.bottom - rt.top;
1028 
1029  // special handling for separator controls
1031  height = 2;
1032 
1034  }
1035  }
1036 
1037  EndDeferWindowPos(hdwp);
1038 }
1039 
1040 
1041 int StartMenu::Command(int id, int code)
1042 {
1043 #ifndef _LIGHT_STARTMENU
1044  switch(id) {
1045  case IDCANCEL:
1046  CloseStartMenu(id);
1047  break;
1048 
1049  default: {
1050 #endif
1052 
1053  if (found != _entries.end()) {
1054  ActivateEntry(id, found->second._entries);
1055  return 0;
1056  }
1057 
1058  return super::Command(id, code);
1059 #ifndef _LIGHT_STARTMENU
1060  }
1061  }
1062 
1063  return 0;
1064 #endif
1065 }
1066 
1067 
1069 {
1070  // search for an already existing subdirectory entry with the same name
1071  if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
1072  {
1073  for(ShellEntryMap::iterator it=_entries.begin(); it!=_entries.end(); ++it) {
1074  StartMenuEntry& sme = it->second;
1075 
1076  if (!_tcsicmp(sme._title, title))
1077  {
1078  for(ShellEntrySet::iterator it2=sme._entries.begin(); it2!=sme._entries.end(); ++it2) {
1079  if ((*it2)->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
1080  // merge the new shell entry with the existing of the same name
1081  sme._entries.insert(entry);
1082 
1083  return it;
1084  }
1085  }
1086  }
1087  }
1088  }
1089 
1090  ShellEntryMap::iterator sme = AddEntry(title, icon_id);
1091 
1092  sme->second._entries.insert(entry);
1093 
1094  return sme;
1095 }
1096 
1098 {
1099  if (id == -1)
1100  id = ++_next_id;
1101 
1102  StartMenuEntry sme;
1103 
1104  sme._title = title;
1105  sme._icon_id = icon_id;
1106 
1107  ShellEntryMap::iterator it = _entries.insert(make_pair(id, sme)).first;
1108 
1109  return it;
1110 }
1111 
1113 {
1114  ICON_ID icon_id;
1115 
1116  if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
1117  icon_id = ICID_APPS;
1118  else
1119  icon_id = (ICON_ID)/*@@*/ entry->_icon_id;
1120 
1121  return AddEntry(folder.get_name(entry->_pidl), icon_id, entry);
1122 }
1123 
1125 {
1126  ICON_ID icon_id;
1127 
1128  if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
1129  icon_id = ICID_APPS;
1130  else
1131  icon_id = (ICON_ID)/*@@*/ entry->_icon_id;
1132 
1133  return AddEntry(entry->_display_name, icon_id, entry);
1134 }
1135 
1136 
1137 void StartMenu::AddButton(LPCTSTR title, ICON_ID icon_id, bool hasSubmenu, int id, bool enabled)
1138 {
1139 #ifdef _LIGHT_STARTMENU
1140  _buttons.push_back(SMBtnInfo(title, icon_id, id, hasSubmenu, enabled));
1141 #else
1143 
1144  WindowRect rect(_hwnd);
1145  ClientRect clnt(_hwnd);
1146 
1147  // increase window height to make room for the new button
1149 
1150  // move down if we are too high now
1151  if (rect.top < 0) {
1154  }
1155 
1156  WindowCanvas canvas(_hwnd);
1157  FontSelection font(canvas, GetStockFont(DEFAULT_GUI_FONT));
1158 
1159  // widen window, if it is too small
1160  int text_width = GetStartMenuBtnTextWidth(canvas, title, _hwnd) + icon_size + 10/*placeholder*/ + 16/*arrow*/;
1161 
1162  int cx = clnt.right - _border_left;
1163  if (text_width > cx)
1164  rect.right += text_width-cx;
1165 
1166  MoveWindow(_hwnd, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE);
1167 
1168  StartMenuCtrl(_hwnd, _border_left, clnt.bottom, rect.right-rect.left-_border_left,
1169  title, id, g_Globals._icon_cache.get_icon(icon_id)._hIcon, hasSubmenu, style);
1170 #endif
1171 }
1172 
1174 {
1175 #ifdef _LIGHT_STARTMENU
1176  _buttons.push_back(SMBtnInfo(NULL, ICID_NONE, -1, false));
1177 #else
1178  WindowRect rect(_hwnd);
1179  ClientRect clnt(_hwnd);
1180 
1181  // increase window height to make room for the new separator
1183 
1184  // move down if we are too high now
1185  if (rect.top < 0) {
1188  }
1189 
1190  MoveWindow(_hwnd, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE);
1191 
1192  StartMenuSeparator(_hwnd, _border_left, clnt.bottom, rect.right-rect.left-_border_left);
1193 #endif
1194 }
1195 
1196 
1198 {
1199  if (_submenu) {
1200  if (IsWindow(_submenu)) {
1201  if (_submenu_id == id)
1202  return false;
1203  else {
1204  _submenu_id = 0;
1206  // _submenu should be reset automatically by PM_STARTMENU_CLOSED, but safety first...
1207  }
1208  }
1209 
1210  _submenu = 0;
1211  }
1212 
1213  return true;
1214 }
1215 
1216 
1217 void StartMenu::CreateSubmenu(int id, LPCTSTR title, CREATORFUNC_INFO creator, void* info)
1218 {
1219  CreateSubmenu(id, StartMenuFolders(), title, creator, info);
1220 }
1221 
1222 bool StartMenu::CreateSubmenu(int id, int folder_id, LPCTSTR title, CREATORFUNC_INFO creator, void* info)
1223 {
1224  try {
1225  SpecialFolderPath folder(folder_id, _hwnd);
1226 
1227  StartMenuFolders new_folders;
1228  new_folders.push_back(folder);
1229 
1230  CreateSubmenu(id, new_folders, title, creator, info);
1231 
1232  return true;
1233  } catch(COMException&) {
1234  // ignore Exception and don't display anything
1235  CloseOtherSubmenus(id);
1236  _buttons[GetSelectionIndex()]._enabled = false; // disable entries for non-existing folders
1237  return false;
1238  }
1239 }
1240 
1241 bool StartMenu::CreateSubmenu(int id, int folder_id1, int folder_id2, LPCTSTR title, CREATORFUNC_INFO creator, void* info)
1242 {
1243  StartMenuFolders new_folders;
1244 
1245  try {
1246  new_folders.push_back(SpecialFolderPath(folder_id1, _hwnd));
1247  } catch(COMException&) {
1248  }
1249 
1250  try {
1251  new_folders.push_back(SpecialFolderPath(folder_id2, _hwnd));
1252  } catch(COMException&) {
1253  }
1254 
1255  if (!new_folders.empty()) {
1256  CreateSubmenu(id, new_folders, title, creator, info);
1257  return true;
1258  } else {
1259  CloseOtherSubmenus(id);
1260  _buttons[GetSelectionIndex()]._enabled = false; // disable entries for non-existing folders
1261  return false;
1262  }
1263 }
1264 
1265 void StartMenu::CreateSubmenu(int id, const StartMenuFolders& new_folders, LPCTSTR title, CREATORFUNC_INFO creator, void* info)
1266 {
1267  // Only open one submenu at a time.
1268  if (!CloseOtherSubmenus(id))
1269  return;
1270 
1271  RECT rect;
1272  int x, y;
1273 
1274  if (GetButtonRect(id, &rect)) {
1275  ClientToScreen(_hwnd, &rect);
1276 
1277  x = rect.right; // Submenus should overlap their parent a bit.
1278  const int icon_size = _icon_size;
1279  y = rect.top+STARTMENU_LINE_HEIGHT(icon_size) +_border_top/*own border*/ -STARTMENU_TOP_BTN_SPACE/*border of new submenu*/;
1280  } else {
1281  WindowRect pos(_hwnd);
1282 
1283  x = pos.right;
1284  y = pos.top;
1285  }
1286 
1287  _submenu_id = id;
1288  _submenu = StartMenu::Create(x, y, new_folders, _hwnd, title, creator, info, _create_info._filter);
1289 }
1290 
1291 
1292 void StartMenu::ActivateEntry(int id, const ShellEntrySet& entries)
1293 {
1294  StartMenuFolders new_folders;
1295  String title;
1296 
1297  for(ShellEntrySet::const_iterator it=entries.begin(); it!=entries.end(); ++it) {
1298  Entry* entry = const_cast<Entry*>(*it);
1299 
1300  if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
1301 
1303 
1304  if (entry->_etype == ET_SHELL)
1305  new_folders.push_back(entry->create_absolute_pidl());
1306  else {
1307  TCHAR path[MAX_PATH];
1308 
1309  if (entry->get_path(path, COUNTOF(path)))
1310  new_folders.push_back(path);
1311  }
1312 
1313  if (title.empty())
1314  title = entry->_display_name;
1315  } else {
1316  // The entry is no subdirectory, so there can only be one shell entry.
1317  assert(entries.size()==1);
1318 
1319  HWND hparent = GetParent(_hwnd);
1320  ShellPath shell_path = entry->create_absolute_pidl();
1321 
1322  // close start menus when launching the selected entry
1323  CloseStartMenu(id);
1324 
1326  SHELLEXECUTEINFO shexinfo;
1327 
1328  shexinfo.cbSize = sizeof(SHELLEXECUTEINFO);
1329  shexinfo.fMask = SEE_MASK_IDLIST; // SEE_MASK_INVOKEIDLIST is also possible.
1330  shexinfo.hwnd = hparent;
1331  shexinfo.lpVerb = NULL;
1332  shexinfo.lpFile = NULL;
1333  shexinfo.lpParameters = NULL;
1334  shexinfo.lpDirectory = NULL;
1335  shexinfo.nShow = SW_SHOWNORMAL;
1336 
1337  shexinfo.lpIDList = &*shell_path;
1338 
1339  // add PIDL to the recent file list
1341 
1342  if (!ShellExecuteEx(&shexinfo))
1343  display_error(hparent, GetLastError());
1344 
1345  // we may have deleted 'this' - ensure we leave the loop and function
1346  return;
1347  }
1348  }
1349 
1350  if (!new_folders.empty()) {
1351  // Only open one submenu at a time.
1352  if (!CloseOtherSubmenus(id))
1353  return;
1354 
1355  CreateSubmenu(id, new_folders, title);
1356  }
1357 }
1358 
1359 
1362 {
1363  if (!(GetWindowStyle(_hwnd) & WS_CAPTION)) { // don't automatically close floating menus
1364  if (!SendParent(PM_STARTENTRY_LAUNCHED, id, (LPARAM)_hwnd))
1365  DestroyWindow(_hwnd);
1366  } else if (_submenu) // instead close submenus of floating parent menus
1367  CloseSubmenus();
1368 }
1369 
1370 
1372 {
1373  RECT rect = {0, 0, 0, 0};
1375 
1376  return rect.right-rect.left;
1377 }
1378 
1379 #ifdef _LIGHT_STARTMENU
1380 void DrawStartMenuButton(HDC hdc, const RECT& rect, LPCTSTR title, const SMBtnInfo& btn, bool has_focus, bool pushed, int icon_size)
1381 #else
1383  bool hasSubmenu, bool enabled, bool has_focus, bool pushed, int icon_size);
1384 #endif
1385 {
1387 
1388  if (!btn._enabled)
1389  style |= DFCS_INACTIVE;
1390 
1391  POINT iconPos = {rect.left+2, (rect.top+rect.bottom-icon_size)/2};
1392  RECT textRect = {rect.left+icon_size+4, rect.top+2, rect.right-4, rect.bottom-4};
1393 
1394  if (pushed) {
1395  style |= DFCS_PUSHED;
1396  ++iconPos.x; ++iconPos.y;
1397  ++textRect.left; ++textRect.top;
1399  }
1400 
1403 
1404  if (has_focus) {
1407  }
1408 
1411 
1412  if (title)
1414 
1415  if (btn._icon_id > ICID_NONE)
1417 
1418  // draw submenu arrow at the right
1419  if (btn._hasSubmenu) {
1420  ResIconEx arrowIcon(IDI_ARROW, icon_size, icon_size);
1422 
1424  has_focus? selArrowIcon: arrowIcon,
1426  }
1427 
1428  if (title) {
1429  BkMode bk_mode(hdc, TRANSPARENT);
1430 
1431  if (!btn._enabled) // dis->itemState & (ODS_DISABLED|ODS_GRAYED)
1433  else {
1434  TextColor lcColor(hdc, GetSysColor(text_color_idx));
1436  }
1437  }
1438 }
1439 
1440 
1441 #ifdef _LIGHT_STARTMENU
1442 
1443 void StartMenu::ResizeToButtons()
1444 {
1445  WindowRect rect(_hwnd);
1446 
1447  WindowCanvas canvas(_hwnd);
1448  FontSelection font(canvas, GetStockFont(DEFAULT_GUI_FONT));
1449 
1450  const int icon_size = _icon_size;
1451 
1452  int max_width = STARTMENU_WIDTH_MIN;
1453  int height = 0;
1454 
1455  for(SMBtnVector::const_iterator it=_buttons.begin(); it!=_buttons.end(); ++it) {
1456  int w = GetStartMenuBtnTextWidth(canvas, it->_title, _hwnd);
1457 
1458  if (w > max_width)
1459  max_width = w;
1460 
1461  if (it->_id == -1)
1463  else
1465  }
1466 
1467  // calculate new window size
1468  int text_width = max_width + icon_size + 10/*placeholder*/ + 16/*arrow*/;
1469 
1470  RECT rt_hgt = {rect.left, rect.bottom-_border_top-height, rect.left+_border_left+text_width, rect.bottom};
1471  AdjustWindowRectEx(&rt_hgt, GetWindowStyle(_hwnd), FALSE, GetWindowExStyle(_hwnd));
1472 
1473  // ignore movement, only look at the size change
1474  rect.right = rect.left + (rt_hgt.right-rt_hgt.left);
1475  rect.top = rect.bottom - (rt_hgt.bottom-rt_hgt.top);
1476 
1477  // move down if we are too high
1478  if (rect.top < 0) {
1479  int dy = -rect.top;
1480  rect.top += dy;
1481  rect.bottom += dy;
1482  }
1483 
1484  // enable scroll mode for long start menus, which span more than the whole screen height
1485  int cyscreen = GetSystemMetrics(SM_CYSCREEN);
1486  int bottom_max = 0;
1487 
1488  if (rect.bottom > cyscreen) {
1489  _arrow_btns = true;
1490 
1493 
1494  bottom_max = rect.bottom;
1495 
1496  if (_floating_btn)
1497  rect.bottom += 6; // lower scroll arrow
1498  else {
1499  _border_top += 6; // upper scroll arrow
1500  rect.bottom += 2*6; // upper+lower scroll arrow
1501  }
1502  }
1503 
1504  MoveWindow(_hwnd, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE);
1505 
1506  if (bottom_max) {
1507  POINT pt = {0, bottom_max};
1508 
1509  ScreenToClient(_hwnd, &pt);
1510 
1511  _bottom_max = pt.y;
1512  }
1513 }
1514 
1515 #else // _LIGHT_STARTMENU
1516 
1518 {
1519  switch(nmsg) {
1520  case WM_MOUSEMOVE:
1521  // automatically set the focus to startmenu entries when moving the mouse over them
1522  if (GetFocus()!=_hwnd && !(GetWindowStyle(_hwnd)&WS_DISABLED))
1523  SetFocus(_hwnd);
1524  break;
1525 
1526  case WM_SETFOCUS:
1528  goto def;
1529 
1530  case WM_CANCELMODE:
1531  // route WM_CANCELMODE to the startmenu window
1532  return SendParent(nmsg, wparam, lparam);
1533 
1534  default: def:
1535  return super::WndProc(nmsg, wparam, lparam);
1536  }
1537 
1538  return 0;
1539 }
1540 
1542 {
1544 
1545  GetWindowText(_hwnd, title, BUFFER_LEN);
1546 
1547  DrawStartMenuButton(dis->hDC, dis->rcItem, title, _hIcon,
1548  _hasSubmenu,
1549  !(dis->itemState & ODS_DISABLED),
1550  dis->itemState&ODS_FOCUS? true: false,
1551  dis->itemState&ODS_SELECTED? true: false);
1552 }
1553 
1554 #endif
1555 
1556 
1558  : super(hwnd, info._icon_size),
1559  _hwndStartButton(0)
1560 {
1561  if (!g_Globals._SHRestricted || !SHRestricted(REST_NOCOMMONGROUPS))
1562  try {
1563  // insert directory "All Users\Start Menu"
1566  } catch(COMException&) {
1567  // ignore exception and don't show additional shortcuts
1568  }
1569 
1570  try {
1571  // insert directory "<user name>\Start Menu"
1572  ShellDirectory usr_startmenu(GetDesktopFolder(), SpecialFolderPath(CSIDL_STARTMENU, _hwnd), _hwnd);
1574  } catch(COMException&) {
1575  // ignore exception and don't show additional shortcuts
1576  }
1577 
1578  ReadLogoSize();
1579 }
1580 
1582 {
1583  // read size of logo bitmap
1584  BITMAP bmp_hdr;
1585  GetObject(ResBitmap(GetLogoResId()), sizeof(BITMAP), &bmp_hdr);
1586  _logo_size.cx = bmp_hdr.bmWidth;
1587  _logo_size.cy = bmp_hdr.bmHeight;
1588 
1589  // cache logo width
1590  _border_left = _logo_size.cx + 1;
1591 }
1592 
1593 
1594 static void CalculateStartPos(HWND hwndOwner, RECT& rect, int icon_size)
1595 {
1596  WindowRect pos(hwndOwner);
1597 
1598  rect.left = pos.left;
1599  rect.top = pos.top-STARTMENU_LINE_HEIGHT(icon_size)-4;
1600  rect.right = pos.left+STARTMENU_WIDTH_MIN;
1601  rect.bottom = pos.top;
1602 
1603 #ifndef _LIGHT_STARTMENU
1605 #endif
1606 }
1607 
1609 {
1610  RECT rect;
1611 
1612  CalculateStartPos(hwndOwner, rect, icon_size);
1613 
1614  StartMenuRootCreateInfo create_info;
1615 
1616  create_info._icon_size = icon_size;
1617 
1620  rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, hwndOwner);
1621 }
1622 
1623 
1625 {
1626  MSG msg;
1627  HWND hwnd = _hwnd;
1628 
1629 #ifdef _LIGHT_STARTMENU
1630  _selected_id = -1;
1631 #endif
1632 
1633 #ifdef _LIGHT_STARTMENU
1634  // recalculate start menu root position
1635  RECT rect;
1636 
1638 
1639  SetWindowPos(hwnd, 0, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, 0);
1640 
1641  ResizeToButtons();
1642 #endif
1643 
1644  // show previously hidden start menu
1647 
1648  while(IsWindow(hwnd) && IsWindowVisible(hwnd)) {
1649  if (!GetMessage(&msg, 0, 0, 0)) {
1650  PostQuitMessage(msg.wParam);
1651  break;
1652  }
1653 
1654  // Check for a mouse click on any window, that is not part of the start menu
1655  if (msg.message==WM_LBUTTONDOWN || msg.message==WM_MBUTTONDOWN || msg.message==WM_RBUTTONDOWN) {
1656  StartMenu* menu_wnd = NULL;
1657 
1658  for(HWND hwnd=msg.hwnd; hwnd; hwnd=GetParent(hwnd)) {
1659  menu_wnd = WINDOW_DYNAMIC_CAST(StartMenu, hwnd);
1660 
1661  if (menu_wnd)
1662  break;
1663  }
1664 
1665  if (!menu_wnd) {
1666  CloseStartMenu();
1667  break;
1668  }
1669  }
1670 
1671  try {
1672  if (pretranslate_msg(&msg))
1673  continue;
1674 
1675  if (dispatch_dialog_msg(&msg))
1676  continue;
1677 
1679 
1680  try {
1681  DispatchMessage(&msg);
1682  } catch(COMException& e) {
1683  HandleException(e, _hwnd);
1684  }
1685  } catch(COMException& e) {
1686  HandleException(e, _hwnd);
1687  }
1688  }
1689 }
1690 
1692 {
1693  return super::Command(id, code);
1694 }
1695 
1697 {
1698  // add buttons for entries in _entries
1699  if (super::Init(pcs))
1700  return 1;
1701 
1702  AddSeparator();
1703 
1704 
1705  // insert hard coded start entries
1707 
1709 
1710  if (!g_Globals._SHRestricted || !SHRestricted(REST_NORECENTDOCSMENU))
1712 
1714 
1716 
1718 
1719  if (!g_Globals._SHRestricted || !SHRestricted(REST_NOFIND))
1721 
1723 
1724  if (!g_Globals._SHRestricted || !SHRestricted(REST_NORUN))
1726 
1727 
1728  AddSeparator();
1729 
1730 
1731  if (!g_Globals._SHRestricted || SHRestricted(REST_STARTMENULOGOFF) != 1)
1733 
1734 #ifdef __REACTOS__
1736 #endif
1737 
1738  if (!g_Globals._SHRestricted || !SHRestricted(REST_NOCLOSE))
1740 
1741 #ifndef __REACTOS__
1743 #endif
1744 
1745 
1746 
1747 
1748 #ifdef _LIGHT_STARTMENU
1749  // set the window size to fit all buttons
1750  ResizeToButtons();
1751 #endif
1752 
1753  return 0;
1754 }
1755 
1756 
1758 {
1760 
1762 }
1763 
1764 
1766 {
1767  switch(nmsg) {
1768  case WM_PAINT: {
1769  PaintCanvas canvas(_hwnd);
1770  Paint(canvas);
1771  break;}
1772 
1773  case WM_DISPLAYCHANGE:
1774  // re-evaluate logo size using the correct color depth
1775  ReadLogoSize();
1776  break;
1777 
1778  default:
1779  return super::WndProc(nmsg, wparam, lparam);
1780  }
1781 
1782  return 0;
1783 }
1784 
1785 void StartMenuRoot::Paint(PaintCanvas& canvas)
1786 {
1787  MemCanvas mem_dc;
1789  BitmapSelection sel(mem_dc, bmp);
1790 
1791  ClientRect clnt(_hwnd);
1792  int h = min(_logo_size.cy, clnt.bottom);
1793 
1794  RECT rect = {0, 0, _logo_size.cx, clnt.bottom-h};
1795  HBRUSH hbr = CreateSolidBrush(GetPixel(mem_dc, 0, 0));
1796  FillRect(canvas, &rect, hbr);
1797  DeleteObject(hbr);
1798 
1799  PatBlt(canvas, _logo_size.cx, 0, 1, clnt.bottom, WHITENESS);
1800 
1801  BitBlt(canvas, 0, clnt.bottom-h, _logo_size.cx, h, mem_dc, 0, ( h<_logo_size.cy ? _logo_size.cy-h : 0) , SRCCOPY);
1802 
1803  super::Paint(canvas);
1804 }
1805 
1807 {
1808  WindowCanvas dc(_hwnd);
1809 
1810  int clr_bits = GetDeviceCaps(dc, BITSPIXEL);
1811 
1812  if (clr_bits > 8)
1813  return IDB_LOGOV;
1814  else if (clr_bits > 4)
1815  return IDB_LOGOV256;
1816  else
1817  return IDB_LOGOV16;
1818 }
1819 
1820 
1822 {
1823  if (_submenu)
1824  CloseSubmenus();
1825 
1826  ShowWindow(_hwnd, SW_HIDE);
1827 }
1828 
1830 {
1831  return IsWindowVisible(_hwnd) != FALSE;
1832 }
1833 
1835 {
1836  switch(vk) {
1837  case VK_LEFT:
1838  if (_submenu)
1840  // don't close start menu root
1841  break;
1842 
1843  default:
1844  super::ProcessKey(vk);
1845  }
1846 }
1847 
1848 
1850 {
1851  switch(id) {
1852 
1853  // start menu root
1854 
1855  case IDC_PROGRAMS:
1857  break;
1858 
1859  case IDC_EXPLORE:
1860  CloseStartMenu(id);
1862  break;
1863 
1864  case IDC_LAUNCH:
1865  CloseStartMenu(id);
1867  break;
1868 
1869  case IDC_DOCUMENTS:
1871  break;
1872 
1873  case IDC_RECENT:
1875  break;
1876 
1877  case IDC_FAVORITES:
1878 #ifndef _SHELL32_FAVORITES
1880 #else
1882 #endif
1883  break;
1884 
1885  case IDC_BROWSE:
1887  break;
1888 
1889  case IDC_SETTINGS:
1891  break;
1892 
1893  case IDC_SEARCH:
1895  break;
1896 
1897  case IDC_START_HELP:
1898  CloseStartMenu(id);
1899  MessageBox(g_Globals._hwndDesktopBar, TEXT("Help not yet implemented"), ResString(IDS_TITLE), MB_OK);
1900  break;
1901 
1902  case IDC_LOGOFF:
1903  CloseStartMenu(id);
1905  break;
1906 
1907 #ifndef __REACTOS__
1908  case IDC_TERMINATE:
1911  break;
1912 #endif
1913 
1914  case IDC_SHUTDOWN:
1915  CloseStartMenu(id);
1917  break;
1918 
1919  case IDC_RESTART:
1920  CloseStartMenu(id);
1922  /* An alternative way to do restart without shell32 help */
1923  //launch_file(_hwnd, TEXT("shutdown.exe"), SW_HIDE, TEXT("-r"));
1924  break;
1925 
1926  // settings menu
1927 
1929  CloseStartMenu(id);
1931  break;
1932 
1933  case IDC_CONTROL_PANEL: {
1934  CloseStartMenu(id);
1935 #ifndef ROSSHELL
1936 #ifndef _NO_MDI
1937  XMLPos explorer_options = g_Globals.get_cfg("general/explorer");
1938  bool mdi = XMLBool(explorer_options, "mdi", true);
1939 
1940  if (mdi)
1941  MDIMainFrame::Create(TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}"), 0);
1942  else
1943 #endif
1944  SDIMainFrame::Create(TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}"), 0);
1945 #else
1947 #endif
1948  break;}
1949 
1950  case IDC_SETTINGS_MENU:
1952  break;
1953 
1954  case IDC_PRINTERS: {
1955  CloseStartMenu(id);
1956 
1957 #ifndef ROSSHELL
1958 #ifndef _NO_MDI
1959  XMLPos explorer_options = g_Globals.get_cfg("general/explorer");
1960  bool mdi = XMLBool(explorer_options, "mdi", true);
1961 
1962  if (mdi)
1963  MDIMainFrame::Create(TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{2227A280-3AEA-1069-A2DE-08002B30309D}"), 0);
1964  else
1965 #endif
1966  SDIMainFrame::Create(TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{2227A280-3AEA-1069-A2DE-08002B30309D}"), 0);
1967 #else
1969 #endif
1970  break;}
1971 
1972 #if 0
1973  case IDC_PRINTERS_MENU:
1975 /* StartMenuFolders new_folders;
1976 
1977  try {
1978  new_folders.push_back(ShellPath(TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{2227A280-3AEA-1069-A2DE-08002B30309D}")));
1979  } catch(COMException&) {
1980  }
1981 
1982  CreateSubmenu(id, new_folders, ResString(IDS_PRINTERS));*/
1983  break;
1984 #endif
1985 
1986  case IDC_ADMIN:
1987 #ifndef ROSSHELL
1989  //CloseStartMenu(id);
1990  //MainFrame::Create(SpecialFolderPath(CSIDL_COMMON_ADMINTOOLS, _hwnd), OWM_PIDL);
1991 #else
1993 #endif
1994  break;
1995 
1996  case IDC_CONNECTIONS:{
1997  CloseStartMenu(id);
1998 #ifndef ROSSHELL
1999 #ifndef _NO_MDI
2000  XMLPos explorer_options = g_Globals.get_cfg("general/explorer");
2001  bool mdi = XMLBool(explorer_options, "mdi", true);
2002 
2003  if (mdi)
2005  else
2006 #endif
2008 #else
2010 #endif
2011  break;}
2012 
2013 
2014  // browse menu
2015 
2016  case IDC_NETWORK:
2017 #ifdef __REACTOS__
2018  MessageBox(0, TEXT("not yet implemented"), ResString(IDS_TITLE), MB_OK);
2019 #else
2021 #endif
2022  break;
2023 
2024  case IDC_DRIVES:
2027  break;
2028 
2029 
2030  // search menu
2031 
2032  case IDC_SEARCH_PROGRAM:
2033  CloseStartMenu(id);
2035  break;
2036 
2037  case IDC_SEARCH_FILES:
2038  CloseStartMenu(id);
2039  ShowSearchDialog();
2040  break;
2041 
2042  case IDC_SEARCH_COMPUTER:
2043  CloseStartMenu(id);
2045  break;
2046 
2047 
2048  default:
2049  return super::Command(id, code);
2050  }
2051 
2052  return 0;
2053 }
2054 
2055 
2057 {
2058 #ifndef __REACTOS__
2059  static DynamicFct<SHFINDFILES> SHFindFiles(TEXT("SHELL32"), 90);
2060 
2061  if (SHFindFiles)
2062  (*SHFindFiles)(NULL, NULL);
2063  else
2064 #endif
2065  MessageBox(0, TEXT("SHFindFiles() not yet implemented in SHELL32"), ResString(IDS_TITLE), MB_OK);
2066 }
2067 
2069 {
2070 #ifndef __REACTOS__
2071  static DynamicFct<SHFINDCOMPUTER> SHFindComputer(TEXT("SHELL32"), 91);
2072 
2073  if (SHFindComputer)
2074  (*SHFindComputer)(NULL, NULL);
2075  else
2076 #endif
2077  MessageBox(0, TEXT("SHFindComputer() not yet implemented in SHELL32"), ResString(IDS_TITLE), MB_OK);
2078 }
2079 
2080 struct RunDialogThread : public Thread
2081 {
2082  int Run();
2083 };
2084 
2086 {
2087  static DynamicFct<RUNFILEDLG> RunFileDlg(TEXT("SHELL32"), 61);
2088 
2089  // RunFileDlg needs owner window to properly position dialog
2090  // that window will be disabled so we can't use DesktopBar
2091  RECT rect = {0};
2092 #ifndef TASKBAR_AT_TOP
2094 #endif
2096  rect.bottom = rect.top + DESKTOPBARBAR_HEIGHT;
2097  Static dlgOwner(0, 0, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, 0, 0);
2098 
2099  // Show "Run..." dialog
2100  if (RunFileDlg) {
2101  (*RunFileDlg)(dlgOwner, 0, NULL, NULL, NULL, RFF_CALCDIRECTORY);
2102  }
2103  DestroyWindow(dlgOwner);
2104  return 0;
2105 }
2106 
2108 {
2109  RunDialogThread * rdt = new RunDialogThread();
2110  rdt->Start();
2111 }
2112 
2114 {
2115  static DynamicFct<LOGOFFWINDOWSDIALOG> LogoffWindowsDialog(TEXT("SHELL32"), 54);
2116 // static DynamicFct<RESTARTWINDOWSDLG> RestartDialog(TEXT("SHELL32"), 59);
2117 
2118  if (LogoffWindowsDialog)
2119  (*LogoffWindowsDialog)(0);
2120 /* The RestartDialog function prompts about some system setting change. This is not what we want to display here.
2121  else if (RestartDialog)
2122  return (*RestartDialog)(hwndOwner, (LPWSTR)L"You selected <Log Off>.\n\n", EWX_LOGOFF) == 1; ///@todo ANSI string conversion if needed
2123 */
2124  else
2125  MessageBox(hwndOwner, TEXT("LogoffWindowsDialog() not yet implemented in SHELL32"), ResString(IDS_TITLE), MB_OK);
2126 }
2127 
2129 {
2130  static DynamicFct<EXITWINDOWSDLG> ExitWindowsDialog(TEXT("SHELL32"), 60);
2131 
2132  if (ExitWindowsDialog)
2133  (*ExitWindowsDialog)(hwndOwner);
2134  else
2135  MessageBox(hwndOwner, TEXT("ExitWindowsDialog() not yet implemented in SHELL32"), ResString(IDS_TITLE), MB_OK);
2136 }
2137 
2139 {
2140  static DynamicFct<RESTARTWINDOWSDLG> RestartDlg(TEXT("SHELL32"), 59);
2141 
2142  if (RestartDlg)
2143  (*RestartDlg)(hwndOwner, (LPWSTR)L"You selected restart.\n\n", flags);
2144  else
2145  MessageBox(hwndOwner, TEXT("RestartDlg() not yet implemented in SHELL32"), ResString(IDS_TITLE), MB_OK);
2146 }
2147 
2149 {
2151 
2152 #if defined(ROSSHELL) || defined(__REACTOS__) // __REACTOS__ to be removed when printers will be implemented
2153 //TODO AddButton(ResString(IDS_PRINTERS), ICID_PRINTER, false, IDC_PRINTERS_MENU);
2154 #else
2155 //TODO AddButton(ResString(IDS_PRINTERS), ICID_PRINTER, true, IDC_PRINTERS_MENU);
2156 #endif
2157 
2159 
2161 
2162  if (!g_Globals._SHRestricted || !SHRestricted(REST_NOCONTROLPANEL))
2164 
2166 
2168 
2169  if (!g_Globals._SHRestricted || !SHRestricted(REST_NOCONTROLPANEL))
2171 }
2172 
2174 {
2176 
2177  if (!g_Globals._SHRestricted || !SHRestricted(REST_NONETHOOD)) // or REST_NOENTIRENETWORK ?
2178 #if defined(ROSSHELL) || defined(__REACTOS__) // __REACTOS__ to be removed when printer/network will be implemented
2180 #else
2182 #endif
2183 
2185 }
2186 
2188 {
2190 
2192 
2193  if (!g_Globals._SHRestricted || !SHRestricted(REST_HASFINDCOMPUTERS))
2195 
2197 }
2198 
2199 
2201 {
2202  for(StartMenuShellDirs::iterator it=_dirs.begin(); it!=_dirs.end(); ++it) {
2203  StartMenuDirectory& smd = *it;
2204  ShellDirectory& dir = smd._dir;
2205 
2206  if (!dir._scanned) {
2207  WaitCursor wait;
2208 
2209 #ifdef _LAZY_ICONEXTRACT
2210  dir.smart_scan(SORT_NAME, SCAN_DONT_EXTRACT_ICONS);
2211 #else
2212  dir.smart_scan(SORT_NAME);
2213 #endif
2214  }
2215 
2216  dir.sort_directory(SORT_DATE);
2218  }
2219 }
2220 
2221 
2222 #ifndef _SHELL32_FAVORITES
2223 
2225 {
2227 
2228  String lwr_filter = _create_info._filter;
2229  lwr_filter.toLower();
2230 
2231  for(BookmarkList::iterator it=_bookmarks.begin(); it!=_bookmarks.end(); ++it) {
2232  BookmarkNode& node = *it;
2233 
2234  int id = ++_next_id;
2235 
2236  _entries[id] = node;
2237 
2238  if (node._type == BookmarkNode::BMNT_FOLDER) {
2239  BookmarkFolder& folder = *node._pfolder;
2240 
2241  AddButton(folder._name, ICID_FOLDER, true, id);
2242  } else if (node._type == BookmarkNode::BMNT_BOOKMARK) {
2243  Bookmark& bookmark = *node._pbookmark;
2244 
2245  ICON_ID icon = ICID_NONE;
2246 
2247  if (!bookmark._icon_path.empty())
2248  icon = g_Globals._icon_cache.extract(bookmark._icon_path, bookmark._icon_idx);
2249 
2250  // filter non-directory entries
2251  if (!lwr_filter.empty()) {
2252  String lwr_name = bookmark._name;
2253  String lwr_desc = bookmark._description;
2254  String lwr_url = bookmark._url;
2255 
2256  lwr_name.toLower();
2257  lwr_desc.toLower();
2258  lwr_url.toLower();
2259 
2260  if (!_tcsstr(lwr_name,lwr_filter) && !_tcsstr(lwr_desc,lwr_filter) && !_tcsstr(lwr_url,lwr_filter))
2261  continue;
2262  }
2263 
2264  AddButton(bookmark._name, icon!=ICID_NONE?icon:ICID_BOOKMARK, false, id);
2265  }
2266  }
2267 }
2268 
2270 {
2271  BookmarkMap::iterator found = _entries.find(id);
2272 
2273  if (found != _entries.end()) {
2274  BookmarkNode& node = found->second;
2275 
2276  if (node._type == BookmarkNode::BMNT_FOLDER) {
2277  BookmarkFolder& folder = *node._pfolder;
2278 
2279  if (CloseOtherSubmenus(id))
2280  CreateSubmenu(id, folder._name, STARTMENU_CREATOR(FavoritesMenu), &static_cast<BookmarkList&>(folder._bookmarks));
2281  } else if (node._type == BookmarkNode::BMNT_BOOKMARK) {
2282  Bookmark& bookmark = *node._pbookmark;
2283 
2284  String url = bookmark._url;
2285  HWND hparent = GetParent(_hwnd);
2286 
2287  CloseStartMenu(id);
2288 
2289  launch_file(hparent, url, SW_SHOWNORMAL);
2290  }
2291 
2292  return 0;
2293  }
2294 
2295  return super::Command(id, code);
2296 }
2297 
2298 #endif
#define GW_HWNDNEXT
Definition: winuser.h:756
virtual void CloseStartMenu(int id=0)
close all windows of the start menu popup
Definition: startmenu.cpp:1361
static void ShowSearchComputer()
Definition: startmenu.cpp:2068
#define WINDOW_CREATOR(WND_CLASS)
Definition: window.h:202
int Command(int id, int code)
Definition: startmenu.cpp:1691
virtual void AddEntries()
Definition: startmenu.cpp:2173
EXTERN_C BOOL WINAPI SHFindComputer(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: stubs.cpp:33
Definition: window.h:584
static CREATORFUNC_INFO s_def_creator
Definition: startmenu.h:218
#define WS_DISABLED
Definition: pedump.c:621
#define WS_THICKFRAME
Definition: pedump.c:630
virtual void AddEntries()
Definition: startmenu.cpp:2200
#define ShellExecuteEx
Definition: shellapi.h:690
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
void push_back(const_reference __x)
Definition: _list.h:509
#define IDC_ADMIN
Definition: desktopbar.h:45
#define IDI_ARROW_SELECTED
Definition: resource.h:73
ShellEntryMap::iterator AddEntry(const String &title, ICON_ID icon_id, Entry *entry)
Definition: startmenu.cpp:1068
#define BITSPIXEL
Definition: wingdi.h:719
#define IDI_ARROW
Definition: resource.h:8
void CreateSubmenu(int id, LPCTSTR title, CREATORFUNC_INFO creator=s_def_creator, void *info=NULL)
Definition: startmenu.cpp:1217
#define DispatchMessage
Definition: winuser.h:5631
#define max(a, b)
Definition: svc.c:63
#define BS_OWNERDRAW
Definition: pedump.c:661
BOOL WINAPI TranslateMessage(_In_ const MSG *)
iterator begin()
Definition: _list.h:367
static HICON
Definition: imagelist.c:84
HDWP WINAPI BeginDeferWindowPos(_In_ int)
StartMenuFolders _folders
Definition: startmenu.h:141
#define TRUE
Definition: types.h:120
#define IDC_NETWORK
Definition: desktopbar.h:51
#define _tsplitpath_s
Definition: tchar.h:687
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
file system path of special folder
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
#define IDC_PRINTERS
Definition: desktopbar.h:56
#define IDS_EXPLORE
Definition: resource.h:16
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow, LPCTSTR parameters)
Definition: utility.cpp:189
void explorer_show_frame(int cmdShow, LPTSTR lpCmdLine)
Definition: explorer.cpp:707
Definition: fci.c:115
#define GW_CHILD
Definition: winuser.h:758
void ExplorerPropertySheet(HWND hparent)
Definition: settings.cpp:37
long y
Definition: polytest.cpp:48
SIZE _logo_size
Definition: startmenu.h:382
#define WM_CONTEXTMENU
Definition: richedit.h:64
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
#define WM_LBUTTONDOWN
Definition: winuser.h:1752
int _icon_size
Definition: startmenu.h:251
#define GetNextWindow(h, c)
Definition: winuser.h:4596
#define INT_MAX
Definition: limits.h:40
#define IDI_ARROW_DOWN
Definition: resource.h:119
HWND _hwndStartButton
Definition: startmenu.h:376
BOOL WINAPI IsWindow(_In_opt_ HWND)
long x
Definition: polytest.cpp:48
#define _tcsicmp
Definition: xmlstorage.h:205
void MoveVisible(HWND hwnd)
Definition: utility.cpp:72
#define GetStockFont(i)
Definition: windowsx.h:283
void DrawFloatingButton(HDC hdc)
Definition: startmenu.cpp:816
Definition: mk_font.cpp:20
#define IDI_FLOATING
Definition: resource.h:80
#define CSIDL_COMMON_FAVORITES
Definition: shlobj.h:2033
#define pt(x, y)
Definition: drawing.c:79
GLsizei const GLchar ** path
Definition: glext.h:7234
#define SW_HIDE
Definition: winuser.h:762
StartMenuRoot(HWND hwnd, const StartMenuRootCreateInfo &info)
Definition: startmenu.cpp:1557
ICON_ID
Definition: globals.h:62
#define IDC_BROWSE
Definition: resource.h:21
#define SHELLPATH_CONTROL_PANEL
Definition: startmenu.cpp:42
int _border_top
Definition: startmenu.h:238
#define STARTMENU_LINE_HEIGHT(icon_size)
Definition: startmenu.h:34
#define IDS_DRIVES
Definition: resource.h:22
int ignore(int trapCode, ppc_trap_frame_t *trap)
Definition: mmuobject.c:296
Retrieval of special shell folder paths.
Definition: shellclasses.h:981
GLint dy
Definition: linetemp.h:97
StartMenuShellDirs _dirs
Definition: startmenu.h:232
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define IDC_FAVORITES
Definition: desktopbar.h:48
uint8_t entry
Definition: isohybrid.c:63
virtual void ProcessKey(int vk)
Definition: startmenu.cpp:1834
list< ShellPath > StartMenuFolders
Definition: startmenu.h:134
#define ID_DESKTOPBAR_SETTINGS
Definition: resource.h:205
WindowHandle _submenu
Definition: startmenu.h:235
#define SS_TYPEMASK
Definition: winuser.h:362
virtual LRESULT Init(LPCREATESTRUCT pcs)
Definition: window.cpp:241
separator between start menu entries
Definition: startmenu.h:123
int _icon_idx
Definition: favorites.h:40
static void ShowRestartDialog(HWND hwndOwner, UINT flags)
Definition: startmenu.cpp:2138
static HDC
Definition: imagelist.c:92
SHELLEXECUTEINFOA SHELLEXECUTEINFO
Definition: shellapi.h:677
#define DFCS_INACTIVE
Definition: winuser.h:502
#define IDC_PROGRAMS
Definition: desktopbar.h:49
void AddShellEntries(const ShellDirectory &dir, int max=-1, const String &ignore="")
Definition: startmenu.cpp:243
BOOL WINAPI UpdateWindow(_In_ HWND)
#define IDC_RECENT
Definition: desktopbar.h:47
LONG top
Definition: windef.h:292
#define IDS_FAVORITES
Definition: resource.h:31
HANDLE HWND
Definition: compat.h:13
#define IDS_ADMIN
Definition: resource.h:19
virtual void DrawItem(LPDRAWITEMSTRUCT dis)
Definition: startmenu.cpp:1541
#define STARTMENU_CREATOR(WND_CLASS)
Definition: startmenu.h:149
#define VK_LEFT
Definition: winuser.h:2178
#define ODS_FOCUS
Definition: winuser.h:2503
#define IDS_SETTINGS_MENU
Definition: resource.h:24
#define assert(x)
Definition: debug.h:53
BOOL WINAPI AdjustWindowRectEx(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL, _In_ DWORD)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define WM_MOVE
Definition: winuser.h:1592
#define COLOR_BTNHIGHLIGHT
Definition: winuser.h:925
shell folder entry
Definition: shellfs.h:53
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HWND WINAPI SetFocus(_In_opt_ HWND)
IShellFolder smart pointer.
Definition: shellclasses.h:593
pair< _T1, _T2 > _STLP_CALL make_pair(_T1 __x, _T2 __y)
Definition: _pair.h:124
HDC dc
Definition: cylfrac.c:34
#define IDC_CONTROL_PANEL
Definition: desktopbar.h:54
#define WM_NCHITTEST
Definition: winuser.h:1668
#define IDS_SETTINGS
Definition: resource.h:15
static WCHAR String[]
Definition: stringtable.c:55
UINT_PTR WPARAM
Definition: windef.h:207
#define VK_DOWN
Definition: winuser.h:2181
#define WS_CHILD
Definition: pedump.c:617
#define SHELLPATH_NET_CONNECTIONS
Definition: startmenu.cpp:44
LONG left
Definition: windef.h:291
#define SWP_NOZORDER
Definition: winuser.h:1232
POINT _last_pos
Definition: startmenu.h:244
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define EWX_REBOOT
Definition: winuser.h:633
static HWND Create()
Definition: mainframe.cpp:1342
#define IDC_SEARCH
Definition: desktopbar.h:60
#define VK_ESCAPE
Definition: winuser.h:2168
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define PM_STARTMENU_CLOSED
Definition: startmenu.h:40
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
LONG right
Definition: windef.h:293
#define DT_NOPREFIX
Definition: winuser.h:537
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define IDB_LOGOV16
Definition: resource.h:115
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:416
#define _MAX_FNAME
Definition: utility.h:74
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
#define VK_RETURN
Definition: winuser.h:2155
DWORD WINAPI GetSysColor(_In_ int)
_Rep_type::const_iterator const_iterator
Definition: _map.h:86
& rect
Definition: startmenu.cpp:1413
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define DrawText
Definition: winuser.h:5637
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define PM_UPDATE_ICONS
Definition: startmenu.h:47
#define IDS_LOGOFF
Definition: resource.h:7
#define GetWindowText
Definition: winuser.h:5664
#define CSIDL_CONTROLS
Definition: shlobj.h:2006
bool IsStartMenuVisible() const
Definition: startmenu.cpp:1829
#define GetWindowStyle(hwnd)
Definition: windowsx.h:290
#define CSIDL_COMMON_PROGRAMS
Definition: shlobj.h:2025
int bk_color_idx
Definition: startmenu.cpp:1401
struct _test_info info[]
Definition: SetCursorPos.c:19
Exception with context information.
Definition: shellclasses.h:113
Window::CREATORFUNC_INFO _creator
Definition: startmenu.h:144
#define CSIDL_RECENT
Definition: shlobj.h:2011
virtual void AddEntries()
Definition: startmenu.cpp:2148
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
virtual void AddEntries()
Definition: startmenu.cpp:1757
struct node node
int WINAPI GetDlgCtrlID(_In_ HWND)
#define IDS_START_HELP
Definition: resource.h:10
void ResizeButtons(int cx)
Definition: startmenu.cpp:1019
ICON_ID _icon_id
Definition: startmenu.h:77
const Icon & extract(LPCTSTR path, ICONCACHE_FLAGS flags=ICF_NORMAL)
Definition: explorer.cpp:416
void DrawGrayText(HDC hdc, LPRECT pRect, LPCTSTR title, int dt_flags)
Definition: window.cpp:891
#define DFCS_PUSHED
Definition: winuser.h:503
#define IDB_LOGOV
Definition: resource.h:75
#define TITLE_STARTMENU
Definition: startmenu.h:30
#define SM_CXSCREEN
Definition: winuser.h:949
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
#define VK_HOME
Definition: winuser.h:2177
#define CSIDL_PRINTERS
Definition: shlobj.h:2007
virtual void AddEntries()
Definition: startmenu.cpp:209
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:865
String _title
Definition: startmenu.h:76
#define CSIDL_DRIVES
Definition: shlobj.h:2019
void WINAPI SHAddToRecentDocs(UINT uFlags, LPCVOID pv)
Definition: shellord.c:669
COLORREF bk_color
Definition: startmenu.cpp:1409
#define VK_UP
Definition: winuser.h:2179
void ShowExitWindowsDialog(HWND hwndOwner)
Definition: startmenu.cpp:2128
bool CloseOtherSubmenus(int id=0)
Definition: startmenu.cpp:1197
#define DT_CALCRECT
Definition: winuser.h:526
#define CSIDL_FAVORITES
Definition: shlobj.h:2009
static BtnWindowClass & GetWndClasss()
Definition: startmenu.cpp:108
void DrawStartMenuButton(HDC hdc, const RECT &rect, LPCTSTR title, HICON hIcon, bool hasSubmenu, bool enabled, bool has_focus, bool pushed, int icon_size)
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDC_DRIVES
Definition: desktopbar.h:53
#define IDC_EXPLORE
Definition: desktopbar.h:50
#define e
Definition: ke_i.h:82
static void CalculateStartPos(HWND hwndOwner, RECT &rect, int icon_size)
Definition: startmenu.cpp:1594
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
void DrawArrows(HDC hdc, int icon_size)
Definition: startmenu.cpp:835
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
#define IDS_PROGRAMS
Definition: resource.h:69
void CloseStartMenu(int id=0)
close all windows of the start menu popup
Definition: startmenu.cpp:1821
#define IDC_TERMINATE
Definition: desktopbar.h:61
#define IDB_LOGOV256
Definition: resource.h:76
unsigned int idx
Definition: utils.c:41
#define TRANSPARENT
Definition: wingdi.h:949
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
bool CloseSubmenus()
Definition: startmenu.h:286
pair< iterator, bool > insert(const value_type &__x)
Definition: _map.h:188
convenient loading of icon resources with specified sizes
Definition: globals.h:331
static void ShowLaunchDialog(HWND hwndOwner)
Definition: startmenu.cpp:2107
void GetFloatingButtonRect(LPRECT prect)
Definition: startmenu.cpp:825
RECT textRect
Definition: startmenu.cpp:1392
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
#define BUFFER_LEN
Definition: utility.h:97
void Paint(PaintCanvas &canvas)
Definition: startmenu.cpp:1785
LONG cx
Definition: windef.h:319
#define WM_KEYDOWN
Definition: winuser.h:1691
LONG_PTR LPARAM
Definition: windef.h:208
#define RECENT_DOCS_COUNT
Definition: startmenu.h:440
#define IDS_DESKTOPBAR_SETTINGS
Definition: resource.h:33
#define CSIDL_COMMON_STARTMENU
Definition: shlobj.h:2024
static HWND Create(CREATORFUNC creator, DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int w, int h, HWND hwndParent=0, HMENU hMenu=0)
Definition: window.cpp:87
pair< iterator, bool > insert(const value_type &__x)
Definition: _set.h:168
iconPos iconPos y
Definition: startmenu.cpp:1416
int Command(int id, int code)
Definition: startmenu.cpp:1041
StartMenuCreateInfo _create_info
Definition: startmenu.h:249
unsigned int dir
Definition: maze.c:112
#define DT_VCENTER
Definition: winuser.h:543
POINT iconPos
Definition: startmenu.cpp:1391
#define SW_SHOW
Definition: winuser.h:769
struct CFFOLDER folder
Definition: fdi.c:110
void WINAPI RunFileDlg(HWND hWndOwner, HICON hIcon, LPCWSTR lpstrDirectory, LPCWSTR lpstrTitle, LPCWSTR lpstrDescription, UINT uFlags)
Definition: dialogs.cpp:397
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:917
#define WINDOW_CREATOR_INFO(WND_CLASS, INFO_CLASS)
Definition: window.h:215
#define CHECKERROR(hr)
Definition: shellclasses.h:162
#define HTSIZEFIRST
Definition: winuser.h:2442
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
bool GetButtonRect(int id, PRECT prect) const
Definition: startmenu.cpp:781
#define ctrl
Definition: input.c:1669
#define IDS_SEARCH_PRG
Definition: resource.h:28
#define WM_RBUTTONDOWN
Definition: winuser.h:1755
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define PostMessage
Definition: winuser.h:5698
#define _tcsstr
Definition: xmlstorage.h:199
_STLP_PRIV _List_iterator< ShellPath, _Const_traits< ShellPath > > const_iterator
Definition: _list.h:276
virtual int Command(int id, int code)
Definition: startmenu.cpp:2269
#define CSIDL_COMMON_ADMINTOOLS
Definition: shlobj.h:2049
#define WINDOW_DYNAMIC_CAST(CLASS, hwnd)
Definition: window.h:166
#define WS_CAPTION
Definition: pedump.c:624
void HandleException(COMException &e, HWND hwnd)
Exception Handler for COM exceptions.
char TCHAR
Definition: xmlstorage.h:189
int Command(int id, int code)
Definition: startmenu.cpp:1849
#define SM_CYSCREEN
Definition: winuser.h:950
static HWND Create()
Definition: mainframe.cpp:866
#define IDS_LAUNCH
Definition: resource.h:9
void ReadLogoSize()
Definition: startmenu.cpp:1581
int toupper(int c)
Definition: utclib.c:881
#define SS_ETCHEDHORZ
Definition: winuser.h:343
#define IDS_TITLE
Definition: resource.h:30
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
void UpdateIcons()
#define IDS_PRINTERS
Definition: shresdef.h:240
int _bottom_max
Definition: startmenu.h:239
#define IDS_NETWORK
Definition: resource.h:20
#define IDS_TERMINATE
Definition: resource.h:49
void ActivateEntry(int id, const ShellEntrySet &entries)
Definition: startmenu.cpp:1292
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define CSIDL_ADMINTOOLS
Definition: shlobj.h:2050
void WINAPI ExitWindowsDialog(HWND hWndOwner)
Definition: dialogs.cpp:1145
LPCSTR lpParameters
Definition: shellapi.h:314
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
Definition: cursoricon.c:1997
#define WM_SIZE
Definition: winuser.h:1593
#define ODS_DISABLED
Definition: winuser.h:2501
int _border_left
Definition: startmenu.h:237
#define IDI_ARROW_UP
Definition: resource.h:118
static const WCHAR url[]
Definition: encode.c:1432
#define SWP_NOACTIVATE
Definition: winuser.h:1227
DWORD COLORREF
Definition: windef.h:285
_Rep_type::iterator iterator
Definition: _set.h:73
#define IDC_DOCUMENTS
Definition: desktopbar.h:46
void AddSeparator()
Definition: startmenu.cpp:1173
int _submenu_id
Definition: startmenu.h:234
#define WM_TIMER
Definition: winuser.h:1718
Search sub-startmenu.
Definition: startmenu.h:426
String _url
Definition: favorites.h:38
int _next_id
Definition: startmenu.h:230
#define MAX_PATH
Definition: compat.h:26
HWND _hwndDesktopBar
Definition: globals.h:287
const GLubyte * c
Definition: glext.h:8905
int text_color_idx
Definition: startmenu.cpp:1402
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
window class with gray background color
Definition: window.h:248
int WINAPI GetSystemMetrics(_In_ int)
#define PM_SELECT_ENTRY
Definition: startmenu.h:48
#define BN_CLICKED
Definition: winuser.h:1886
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL pretranslate_msg(LPMSG pmsg)
Definition: window.cpp:589
virtual void AddEntries()
Definition: startmenu.cpp:2224
#define IDS_BROWSE
Definition: resource.h:27
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
Favorites _favorites
Definition: globals.h:297
#define ICON_SIZE_SMALL
Definition: globals.h:169
iconPos x
Definition: startmenu.cpp:1416
#define GetObject
Definition: wingdi.h:4446
BITMAP bmp
Definition: alphablend.c:62
#define IDD_SEARCH_PROGRAM
Definition: resource.h:61
GLbitfield flags
Definition: glext.h:7161
#define DEFAULT_GUI_FONT
Definition: wingdi.h:908
#define SORT_NAME
Definition: xpath.c:441
#define WM_PAINT
Definition: winuser.h:1602
#define IDS_RECENT
Definition: shresdef.h:82
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: startmenu.cpp:299
UINT GetLogoResId()
Definition: startmenu.cpp:1806
#define IDC_CONNECTIONS
Definition: desktopbar.h:52
void display_error(HWND hwnd, DWORD error)
Definition: utility.cpp:98
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
_STLP_TEMPLATE_FOR_CONT_EXT iterator find(const _KT &__x)
Definition: _map.h:210
int GetStartMenuBtnTextWidth(HDC hdc, LPCTSTR title, HWND hwnd)
Definition: startmenu.cpp:1371
struct Point Point
#define IDC_SETTINGS
Definition: desktopbar.h:44
enum StartMenu::SCROLL_MODE _scroll_mode
LRESULT PostParent(UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
Definition: window.cpp:667
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
static const WCHAR L[]
Definition: oid.c:1250
HDC hdc
Definition: main.c:9
_STLP_PRIV _List_iterator< StartMenuDirectory, _Nonconst_traits< StartMenuDirectory > > iterator
Definition: _list.h:275
convenient loading of bitmap resources
Definition: globals.h:345
static void ShowLogoffDialog(HWND hwndOwner)
Definition: startmenu.cpp:2113
#define COLOR_BTNFACE
Definition: winuser.h:918
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define WM_CANCELMODE
Definition: winuser.h:1617
#define DI_NORMAL
Definition: wingdi.h:72
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
void AddButton(LPCTSTR title, ICON_ID icon_id=ICID_NONE, bool hasSubmenu=false, int id=-1, bool enabled=true)
Definition: startmenu.cpp:1137
static HWND Create(int x, int y, const StartMenuFolders &, HWND hwndParent, LPCTSTR title, CREATORFUNC_INFO creator=s_def_creator, void *info=NULL, const String &filter="")
Definition: startmenu.cpp:118
Window *(* CREATORFUNC_INFO)(HWND, const void *)
Definition: window.h:67
#define MessageBox
Definition: winuser.h:5688
const Icon & get_icon(int icon_id)
Definition: explorer.cpp:625
#define SHELLPATH_PRINTERS
Definition: startmenu.cpp:43
#define IDC_SEARCH_PROGRAM
Definition: desktopbar.h:59
size_type size() const
Definition: _set.h:160
String _description
Definition: favorites.h:37
#define WHITENESS
Definition: wingdi.h:336
StartMenuDirectory is used to store the base directory of start menus.
Definition: startmenu.h:52
iterator begin()
Definition: _set.h:151
shell file/directory entry
Definition: shellfs.h:30
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
structor containing information for creating of start menus
Definition: startmenu.h:137
LPCSTR lpDirectory
Definition: shellapi.h:315
#define IDC_LOGOFF
Definition: desktopbar.h:38
BOOL WINAPI SHFindFiles(LPCITEMIDLIST pidlFolder, LPCITEMIDLIST pidlSaveFile)
Definition: shellord.c:1827
Dialog to work with the complete list of start menu entries.
Definition: searchprogram.h:78
LRESULT Init(LPCREATESTRUCT pcs)
Definition: startmenu.cpp:164
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define STARTMENU_WIDTH_MIN
Definition: startmenu.h:33
#define PATCOPY
Definition: wingdi.h:334
String _name
Definition: favorites.h:36
#define VK_RIGHT
Definition: winuser.h:2180
ShellFolder & GetDesktopFolder()
#define SWP_NOSIZE
Definition: winuser.h:1230
#define _MAX_EXT
Definition: utility.h:76
#define RFF_CALCDIRECTORY
Definition: run.h:48
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define IDS_RESTART
Definition: resource.h:48
#define IDS_SHUTDOWN
Definition: resource.h:8
#define DT_SINGLELINE
Definition: winuser.h:540
HWND WINAPI GetParent(_In_ HWND)
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define TEXT(s)
Definition: k32.h:26
#define IDS_SEARCH_FILES
Definition: resource.h:11
#define WM_ACTIVATEAPP
Definition: winuser.h:1614
#define IDS_CONTROL_PANEL
Definition: resource.h:25
#define DESKTOPBARBAR_HEIGHT
Definition: desktopbar.h:33
bool _floating_btn
Definition: startmenu.h:241
HICON hIcon
Definition: msconfig.c:44
#define STARTMENU_TOP_BTN_SPACE
Definition: startmenu.h:36
#define CSIDL_PRINTHOOD
Definition: shlobj.h:2029
iterator end()
Definition: _list.h:370
#define SC_SIZE
Definition: winuser.h:2538
#define DFCS_BUTTONPUSH
Definition: winuser.h:501
#define COLOR_BTNSHADOW
Definition: winuser.h:920
Definition: bl.h:1331
#define WM_MBUTTONDOWN
Definition: winuser.h:1758
#define IDS_DOCUMENTS
Definition: resource.h:12
#define IDC_LAUNCH
Definition: desktopbar.h:40
Definition: services.c:325
XMLPos get_cfg()
Definition: explorer.cpp:119
#define ICF_FROM_ICON_SIZE(size)
Definition: globals.h:176
#define SEE_MASK_IDLIST
Definition: shellapi.h:27
ShellEntrySet _entries
Definition: startmenu.h:78
#define min(a, b)
Definition: monoChain.cc:55
#define WS_POPUP
Definition: pedump.c:616
unsigned int UINT
Definition: ndis.h:50
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: startmenu.cpp:1517
#define WM_MOUSEMOVE
Definition: winuser.h:1751
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define MB_OK
Definition: winuser.h:784
#define GetMessage
Definition: winuser.h:5656
#define IDS_EMPTY
Definition: resource.h:17
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dx
Definition: linetemp.h:97
ShellDirectory _dir
Definition: startmenu.h:64
bool _arrow_btns
Definition: startmenu.h:242
#define IDC_START_HELP
Definition: desktopbar.h:41
ShellEntryMap _entries
Definition: startmenu.h:231
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define msg(x)
Definition: auth_time.c:54
HWND WINAPI GetFocus(void)
Definition: window.c:1875
void TrackStartmenu()
Definition: startmenu.cpp:1624
#define CSIDL_PERSONAL
Definition: shlobj.h:2008
int _scroll_pos
Definition: startmenu.h:246
_Out_opt_ int * cx
Definition: commctrl.h:570
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2888
#define CSIDL_STARTMENU
Definition: shlobj.h:2014
#define ODS_SELECTED
Definition: winuser.h:2499
#define SendMessage
Definition: winuser.h:5709
_TCHAR * _tcscat(_TCHAR *s, const _TCHAR *append)
Definition: tcscat.h:8
GLuint res
Definition: glext.h:9613
iterator end()
Definition: _set.h:152
static HWND Create(HWND hwndDesktopBar, int icon_size)
Definition: startmenu.cpp:1608
void Paint(PaintCanvas &canvas)
Definition: startmenu.cpp:870
#define IDC_FIRST_MENU
Definition: desktopbar.h:64
virtual void AddEntries()
Definition: startmenu.cpp:2187
#define SHARD_PIDL
Definition: shlobj.h:1092
#define HIWORD(l)
Definition: typedefs.h:246
_Rep_type::const_iterator const_iterator
Definition: _set.h:74
static int DoModal(UINT nid, CREATORFUNC creator, HWND hwndParent=0)
Definition: window.cpp:701
GLenum GLuint id
Definition: glext.h:5579
BOOL WINAPI IsWindowVisible(_In_ HWND)
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define IDC_SEARCH_FILES
Definition: desktopbar.h:42
LONG bottom
Definition: windef.h:294
Settings sub-startmenu.
Definition: startmenu.h:396
static BOOL dispatch_dialog_msg(LPMSG pmsg)
Definition: window.cpp:619
#define SelectBrush(hdc, hbr)
Definition: windowsx.h:485
#define IDC_SETTINGS_MENU
Definition: desktopbar.h:55
#define SWP_NOMOVE
Definition: winuser.h:1229
#define IDC_RESTART
Definition: desktopbar.h:62
virtual int Command(int id, int code)
Definition: window.cpp:285
#define CLASSNAME_STARTMENU
Definition: startmenu.h:29
bool empty() const
Definition: _list.h:177
#define PM_STARTENTRY_LAUNCHED
Definition: startmenu.h:41
#define COUNTOF(x)
Definition: utility.h:93
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define COLOR_BTNTEXT
Definition: winuser.h:923
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
BookmarkMap _entries
Definition: startmenu.h:477
LRESULT SendParent(UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
Definition: window.cpp:657
BookmarkList _bookmarks
Definition: startmenu.h:476
EXTERN_C int WINAPI LogoffWindowsDialog(HWND hWndOwner)
Definition: dialogs.cpp:1094
int _invisible_lines
Definition: startmenu.h:247
structure holding information about one start menu entry
Definition: startmenu.h:72
StartMenu(HWND hwnd, int icon_size=ICON_SIZE_SMALL)
Definition: startmenu.cpp:47
#define IDS_CONNECTIONS
Definition: resource.h:21
HBRUSH bk_brush
Definition: startmenu.cpp:1410
#define WM_SETFOCUS
Definition: winuser.h:1595
#define STARTMENU_SEP_HEIGHT(icon_size)
Definition: startmenu.h:35
convenient loading of string resources
Definition: globals.h:303
#define HTCLIENT
Definition: winuser.h:2429
GLfloat GLfloat p
Definition: glext.h:8902
#define IDC_SHUTDOWN
Definition: desktopbar.h:39
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
"Browse Files..." sub-start menu
Definition: startmenu.h:411
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
LONG_PTR LRESULT
Definition: windef.h:209
#define CSIDL_NETWORK
Definition: shlobj.h:2020
iterator begin()
Definition: _map.h:163
#define IDC_SEARCH_COMPUTER
Definition: desktopbar.h:43
void GetArrowButtonRects(LPRECT prect_up, LPRECT prect_down, int icon_size)
Definition: startmenu.cpp:849
#define PM_STARTENTRY_FOCUSED
Definition: startmenu.h:44
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define CSIDL_PROGRAMS
Definition: shlobj.h:2005
#define GetWindowExStyle(hwnd)
Definition: windowsx.h:285
Arabic default style
Definition: afstyles.h:93
Bookmarks sub-startmenu.
Definition: startmenu.h:462
#define WS_VISIBLE
Definition: pedump.c:620
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define WS_SYSMENU
Definition: pedump.c:629
DWORD WINAPI SHRestricted(RESTRICTIONS policy)
Definition: shpolicy.c:836
#define IDS_SEARCH_COMPUTER
Definition: resource.h:23
String _icon_path
Definition: favorites.h:39
#define WM_SYSCOMMAND
Definition: winuser.h:1717
HWND _hwndDesktop
Definition: globals.h:289
LONG cy
Definition: windef.h:320
static char title[]
Definition: ps.c:92
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
wrapper class for item ID lists
Definition: shellclasses.h:651
#define LOWORD(l)
Definition: pedump.c:82
static LPTSTR trim_path_slash(LPTSTR path)
Definition: startmenu.cpp:230
#define VK_END
Definition: winuser.h:2176
static void ShowSearchDialog()
Definition: startmenu.cpp:2056
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define SRCCOPY
Definition: wingdi.h:332
base of all file and directory entries
Definition: entries.h:82
void draw(HDC hdc, int x, int y, int cx, int cy, COLORREF bk_color, HBRUSH bk_brush) const
Definition: explorer.cpp:277
#define HTSIZELAST
Definition: winuser.h:2450
#define IDS_SEARCH
Definition: resource.h:30
_Rep_type::iterator iterator
Definition: _map.h:85
"Recent Files" sub-start menu
Definition: startmenu.h:443
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: startmenu.cpp:1765
static UINT WPARAM wparam
Definition: combo.c:716
Startmenu root window.
Definition: startmenu.h:364
LRESULT Init(LPCREATESTRUCT pcs)
Definition: startmenu.cpp:1696
Definition: dlist.c:348
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
IconCache _icon_cache
Definition: globals.h:285
iconPos iconPos icon_size
Definition: startmenu.cpp:1416
iterator end()
Definition: _map.h:165