Skip to content

Commit 5399e3a

Browse files
thisismy-githubIbuprophen
authored andcommitted
Added option to use a custom search hint
If set, intercepts the search hint's DrawText function and swaps out the default text for user-defined text. Leaving the text blank results in an empty search box.
1 parent 68379f4 commit 5399e3a

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

Src/StartMenu/StartMenuDLL/MenuContainer.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,10 @@ LRESULT CALLBACK CMenuContainer::SubclassSearchBox( HWND hWnd, UINT uMsg, WPARAM
444444
SetBkColor(hdc,GetSysColor(COLOR_WINDOW));
445445
SetBkMode(hdc,TRANSPARENT);
446446
SetTextColor(hdc,s_Skin.Search_text_colors[1]);
447-
DrawText(hdc,pParent->m_Items[pParent->m_SearchIndex].name,-1,&rc,DT_SINGLELINE|DT_EDITCONTROL|(s_bRTL?DT_RIGHT:DT_LEFT));
447+
if (GetSettingBool(L"SearchHint"))
448+
DrawText(hdc,GetSettingString(L"SearchHintText"),-1,&rc,DT_SINGLELINE|DT_EDITCONTROL|(s_bRTL?DT_RIGHT:DT_LEFT));
449+
else
450+
DrawText(hdc,pParent->m_Items[pParent->m_SearchIndex].name,-1,&rc,DT_SINGLELINE|DT_EDITCONTROL|(s_bRTL?DT_RIGHT:DT_LEFT));
448451
SelectObject(hdc,font0);
449452
}
450453
return res;

Src/StartMenu/StartMenuDLL/SettingsUI.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4343,6 +4343,8 @@ CSetting g_Settings[]={
43434343
{L"Normal",CSetting::TYPE_RADIO,IDS_SEARCH_BOX_SHOW,IDS_SEARCH_BOX_SHOW_TIP},
43444344
{L"Tab",CSetting::TYPE_RADIO,IDS_SEARCH_BOX_TAB,IDS_SEARCH_BOX_TAB_TIP},
43454345
{L"SearchSelect",CSetting::TYPE_BOOL,IDS_SEARCH_BOX_SEL,IDS_SEARCH_BOX_SEL_TIP,1,0,L"SearchBox=1",L"Normal"},
4346+
{L"SearchHint",CSetting::TYPE_BOOL,IDS_SEARCH_HINT,IDS_SEARCH_HINT_TIP,0,0,L"SearchBox"},
4347+
{L"SearchHintText",CSetting::TYPE_STRING,IDS_NEW_SEARCH_HINT,IDS_NEW_SEARCH_HINT_TIP,L"",0,L"#SearchHint",L"SearchHint"},
43464348
{L"SearchTrack",CSetting::TYPE_BOOL,IDS_SEARCH_TRACK,IDS_SEARCH_TRACK_TIP,1,0,L"SearchBox"},
43474349
{L"SearchResults",CSetting::TYPE_INT,IDS_SEARCH_MAX2,IDS_SEARCH_MAX_TIP2,5,CSetting::FLAG_MENU_CLASSIC_BOTH,L"SearchBox"},
43484350
{L"SearchResultsMax",CSetting::TYPE_INT,IDS_SEARCH_MAX3,IDS_SEARCH_MAX_TIP3,20,CSetting::FLAG_MENU_CLASSIC_BOTH,L"SearchBox"},

Src/StartMenu/StartMenuDLL/StartMenuDLL.rc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,10 @@ BEGIN
13011301
IDS_NO_DBLCLICK_TIP "When this is checked, single-clicking shortcuts (links) to folders will open them in explorer. Hovering over the shortcut will still expand sub-menus"
13021302
IDS_BOLD_SETTINGS "Highlight modified settings"
13031303
IDS_BOLD_SETTINGS_TIP "When this is checked, settings that have been modified from their defaults will be highlighted in bold"
1304+
IDS_SEARCH_HINT "Custom search hint"
1305+
IDS_SEARCH_HINT_TIP "When this is checked, the hint text in the search box will be replaced"
1306+
IDS_NEW_SEARCH_HINT "Custom search hint text"
1307+
IDS_NEW_SEARCH_HINT_TIP "The text to replace the search hint with. Empty text is a valid option"
13041308
END
13051309

13061310
#endif // English (U.S.) resources

Src/StartMenu/StartMenuDLL/resource.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,10 @@
764764
#define IDS_NO_DBLCLICK_TIP 3667
765765
#define IDS_BOLD_SETTINGS 3668
766766
#define IDS_BOLD_SETTINGS_TIP 3669
767+
#define IDS_SEARCH_HINT 3670
768+
#define IDS_SEARCH_HINT_TIP 3671
769+
#define IDS_NEW_SEARCH_HINT 3672
770+
#define IDS_NEW_SEARCH_HINT_TIP 3673
767771
#define IDS_STRING7001 7001
768772
#define IDS_STRING7002 7002
769773
#define IDS_STRING7003 7003

0 commit comments

Comments
 (0)