From 48da412f742fd1a27fde4b836682e340c85c443b Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Mon, 23 Feb 2004 22:16:54 +0000 Subject: [PATCH] keyboard navigation in start menu using first character of display names svn path=/branches/lean-explorer/; revision=8343 --- .../subsys/system/explorer/res/documents.ico | Bin 6982 -> 7782 bytes .../system/explorer/taskbar/startmenu.cpp | 54 ++++++++++++++++++ .../system/explorer/taskbar/startmenu.h | 1 + 3 files changed, 55 insertions(+) diff --git a/reactos/subsys/system/explorer/res/documents.ico b/reactos/subsys/system/explorer/res/documents.ico index a32d39d7932b03932e99e87492ca8a60f14deb59..a639907fd461bac2174912feb3d239a680a023d9 100644 GIT binary patch delta 1770 zcmZuy2~bm46#XeEVzp5OLDWiJTbHru6smPYvF=+HN?lu9r&QbObg1h%qK?|ux;0X5 z0V^O7zy(WDHZ_REv=|9VWJw@oAtWS_oe+}nPv4Jprk&}ZbKn2}-Fwcv^OpPgQSI|C zPJTTif}&Vd7{whzQSq-))UaVM{}cTviVnXU`vZ%WSX9fp!+Is+5GUF1JS&mI_FqT( zcKC-5{C^i`hkr=Xn4t?;K}4HcM2s20_YC30u)gK2XH8`VlCQ0Svxibw7K~amb};$d z5cCQ~eL8C_|6rU=CVrNY5*r#ox>tpT`BA^_T&YYyYL$xt^!3qyrC*pIGKe^rzW!cF zU`@&qQ~t>gK?!lbeEPh!AobjwV1~bN!qU-0RW~nrAEd~$&;Aq9|91EE7AJolK7hnU zPYe<~i2+wHL%I&zNe_R*%jyZ+6P#=HyYcuv>lD>9EeUht5UfS(uO zYAn+}I0d(p2HY-}({6Xz?3Ol7cG7kqd3+36qSJBnosu#b>*%KY>b&o)(n=J5fvby< zwgPF(k-i$&*P`*=;wtVW~BVC+)1m|@F`?%0)ve{#G&A0{JsaJ`|J^Ldc68b+#a!h_ZQL-QW3lL{Pb{EPrXe(XX8ihzGXnoFSKK`Vfv7N&Z#nl7`Vp8rH}@4l$w!S&>Q!vg)uYL8yLZ!X)DwhFgDV^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E4!*YFDAdI#pzW%HvcC_{61%z}X>La2y<3Rcwh}`A)Y?!G+Ru!ufXAl9 zM1@)v0}}LJPlhJGN6yV|E(bHLy2gSu`0uy{1`f{KCB0&Bz7@uT9^Yl8*y+s)9 zeuA#LIsd=x$&F5M3N)MbUMtE;uHMvUIl zTnwD~_@9?hXYGfsFd5_J=P@Dv9TN?CFtiuJCKJObORR-$tR2uxF)Hmq{rzIxIe!ZN z3+4^eM-G1}05>d*i;KhH;2>Ham!SXLC(! z!ZO?rt6BmW6tL-KXeqja*Je3^SP3LP6UAZwZEpt#2I{+LPjq*8qgz~r;gSoOZ1@w# zrhJ%M3SjEI4^v+i%(6O|huUCM_rao;I^fdA5^P!-U?AKXk`ooFIonugXXmu+>}-sT zjG(`-4+CwrP*$YF+*JZgZzU|!T1vGER%Iuws(#pY3Rv|+Fg$NZ_~szf3_kC~3!3lx z&Fj{!(_5`p$mMd!Lda#$Fj{*Z)_^7wcnJ7>4H4cY!s1}=0LIW- zIS6XC8k{upPM8%fz@!c^PXHDp?3PKKJ^rQL-Oc$f`D`W$h~O7ElSZnWH*dm7)yYD& z&Q681zg3K(wz8=rYPX?46i0E{HnR02ujT$<@7S@!R#Q`hoSYnlhKB0h+}!Htx;qV} z|8yLw2{CqOAx}!yFa84N`#aILeBkTr+ba+VQs}{U(tOe?I@l+9JoYe+myvjc4-xTQ zyr{Y_`5YBsxSyTQrn{~HAR{3iea diff --git a/reactos/subsys/system/explorer/taskbar/startmenu.cpp b/reactos/subsys/system/explorer/taskbar/startmenu.cpp index 6c4892a4272..dc7d96b7129 100644 --- a/reactos/subsys/system/explorer/taskbar/startmenu.cpp +++ b/reactos/subsys/system/explorer/taskbar/startmenu.cpp @@ -541,6 +541,10 @@ void StartMenu::ProcessKey(int vk) case VK_ESCAPE: CloseStartMenu(); break; + + default: + if (vk>='0' && vk<='Z') + JumpToNextShortcut(vk); } } @@ -567,6 +571,56 @@ bool StartMenu::Navigate(int step) return false; } +bool StartMenu::JumpToNextShortcut(char c) +{ + int cur_idx = GetSelectionIndex(); + + if (cur_idx == -1) + cur_idx = 0; + + int first_found = 0; + int found_more = 0; + + SMBtnVector::const_iterator cur_it = _buttons.begin(); + cur_it += cur_idx + 1; + + // first search down from current item... + SMBtnVector::const_iterator it = cur_it; + for(; it!=_buttons.end(); ++it) { + const SMBtnInfo& btn = *it; + + if (!btn._title.empty() && toupper((TBYTE)btn._title.at(0)) == c) { + if (!first_found) + first_found = btn._id; + else + ++found_more; + } + } + + // ...now search from top to the current item + it = _buttons.begin(); + for(; it!=_buttons.end() && it!=cur_it; ++it) { + const SMBtnInfo& btn = *it; + + if (!btn._title.empty() && toupper((TBYTE)btn._title.at(0)) == c) { + if (!first_found) + first_found = btn._id; + else + ++found_more; + } + } + + if (first_found) { + SelectButton(first_found); + + if (!found_more) + Command(first_found, BN_CLICKED); + + return true; + } else + return false; +} + #endif // _LIGHT_STARTMENU diff --git a/reactos/subsys/system/explorer/taskbar/startmenu.h b/reactos/subsys/system/explorer/taskbar/startmenu.h index ef8c7a8f5d4..a074171c7dc 100644 --- a/reactos/subsys/system/explorer/taskbar/startmenu.h +++ b/reactos/subsys/system/explorer/taskbar/startmenu.h @@ -258,6 +258,7 @@ protected: virtual void ProcessKey(int vk); bool Navigate(int step); bool OpenSubmenu(bool select_first=false); + bool JumpToNextShortcut(char c); #endif // member functions