Skip to content
4 changes: 3 additions & 1 deletion Explorer++/Explorer++/CoreInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ __interface IExplorerplusplus
void OpenFileItem(PCIDLIST_ABSOLUTE pidlItem, const TCHAR *szParameters);

HMENU BuildViewsMenu();

HMENU BuildCommandPromptOptionsMenu();

bool CanCreate() const;
BOOL CanCut() const;
Expand All @@ -80,4 +82,4 @@ __interface IExplorerplusplus
boost::signals2::connection AddTabsInitializedObserver(const TabsInitializedSignal::slot_type &observer);
boost::signals2::connection AddMainMenuPreShowObserver(const MainMenuPreShowSignal::slot_type &observer);
boost::signals2::connection AddToolbarContextMenuObserver(const ToolbarContextMenuSignal::slot_type &observer);
};
};
3 changes: 2 additions & 1 deletion Explorer++/Explorer++/Explorer++.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ class Explorerplusplus :
const MainMenuPreShowSignal::slot_type &observer) override;
HMENU BuildViewsMenu() override;
void AddViewModesToMenu(HMENU menu);
HMENU BuildCommandPromptOptionsMenu();

/* Miscellaneous. */
void CreateStatusBar(void);
Expand Down Expand Up @@ -639,4 +640,4 @@ class Explorerplusplus :
HTREEITEM m_hTVMButtonItem;

BOOL m_blockNextListViewSelection;
};
};
Binary file modified Explorer++/Explorer++/Explorer++.rc
Binary file not shown.
8 changes: 7 additions & 1 deletion Explorer++/Explorer++/Initialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,10 @@ void Explorerplusplus::AddViewModesToMenu(HMENU menu)
mii.dwTypeData = szText;
InsertMenuItem(menu, IDM_VIEW_PLACEHOLDER, FALSE, &mii);
}
}
}

HMENU Explorerplusplus::BuildCommandPromptOptionsMenu()
{
HMENU commandPromptOptionsMenu = GetSubMenu(LoadMenu(m_hLanguageModule, MAKEINTRESOURCE(IDR_COMMAND_PROMPT_OPTIONS_MENU)), 0);
return commandPromptOptionsMenu;
}
34 changes: 33 additions & 1 deletion Explorer++/Explorer++/MainToolbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,9 @@ BYTE MainToolbar::LookupToolbarButtonExtraStyles(ToolbarButton button) const
case ToolbarButton::Views:
return BTNS_DROPDOWN;

case ToolbarButton::OpenCommandPrompt:
return BTNS_DROPDOWN;

default:
return 0;
}
Expand Down Expand Up @@ -672,6 +675,12 @@ LRESULT MainToolbar::OnTbnDropDown(const NMTOOLBAR *nmtb)

return TBDDRET_DEFAULT;
}
else if (nmtb->iItem == ToolbarButton::OpenCommandPrompt)
{
ShowToolbarCommandPromptDropdown();

return TBDDRET_DEFAULT;
}

return TBDDRET_NODEFAULT;
}
Expand Down Expand Up @@ -786,6 +795,29 @@ void MainToolbar::CreateViewsMenu(POINT *ptOrigin)
0, m_hwnd, nullptr);
}

void MainToolbar::ShowToolbarCommandPromptDropdown()
{
POINT ptOrigin;
RECT rcButton;

SendMessage(m_hwnd, TB_GETRECT, (WPARAM)ToolbarButton::OpenCommandPrompt, (LPARAM)&rcButton);

ptOrigin.x = rcButton.left;
ptOrigin.y = rcButton.bottom;

ClientToScreen(m_hwnd, &ptOrigin);

CreateCommandPromptOptionsMenu(&ptOrigin);
}

void MainToolbar::CreateCommandPromptOptionsMenu(POINT* ptOrigin)
{
HMENU commandPromptOptionsMenu = m_pexpp->BuildCommandPromptOptionsMenu();

TrackPopupMenu(commandPromptOptionsMenu, TPM_LEFTALIGN, ptOrigin->x, ptOrigin->y,
0, m_hwnd, NULL);
}

// For some of the buttons on the toolbar, their state depends on an item from
// the application configuration, rather than the properties of the current tab
// or file selection.
Expand Down Expand Up @@ -897,4 +929,4 @@ void MainToolbarPersistentSettings::SaveXMLSettings(IXMLDOMDocument *pXMLDom, IX

index++;
}
}
}
4 changes: 3 additions & 1 deletion Explorer++/Explorer++/MainToolbar.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ class MainToolbar : public BaseWindow
void ShowHistoryMenu(HistoryType historyType, const POINT &pt);
void ShowToolbarViewsDropdown();
void CreateViewsMenu(POINT *ptOrigin);
void ShowToolbarCommandPromptDropdown();
void CreateCommandPromptOptionsMenu(POINT* ptOrigin);

void OnTabSelected(const Tab &tab);
void OnNavigationCompleted(const Tab &tab);
Expand All @@ -118,4 +120,4 @@ class MainToolbar : public BaseWindow

std::vector<WindowSubclassWrapper> m_windowSubclasses;
std::vector<boost::signals2::scoped_connection> m_connections;
};
};
3 changes: 2 additions & 1 deletion Explorer++/Explorer++/MainWndSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ LRESULT Explorerplusplus::HandleMenuOrAccelerator(HWND hwnd, WPARAM wParam)
StartCommandPrompt(m_CurrentDirectory, false);
break;

case IDM_COMMAND_PROMPT_DROPDOWN_AS_ADMIN:
case IDM_FILE_OPENCOMMANDPROMPTADMINISTRATOR:
StartCommandPrompt(m_CurrentDirectory, true);
break;
Expand Down Expand Up @@ -1644,4 +1645,4 @@ LRESULT CALLBACK Explorerplusplus::NotifyHandler(HWND hwnd, UINT msg, WPARAM wPa
}

return DefWindowProc(hwnd, msg, wParam, lParam);
}
}
2 changes: 2 additions & 0 deletions Explorer++/Explorer++/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#define IDD_SETDEFAULTCOLUMNS 187
#define IDR_VIEWS_MENU 195
#define IDR_TOOLBAR_MENU 196
#define IDR_COMMAND_PROMPT_OPTIONS_MENU 197
#define IDD_RENAMETAB 213
#define IDD_EDITAPPLICATIONBUTTON 216
#define IDR_APPLICATIONTOOLBAR_MENU 217
Expand Down Expand Up @@ -909,6 +910,7 @@
#define IDM_VIEW_DETAILS 60005
#define IDM_VIEW_LARGEICONS 60007
#define IDM_VIEW_EXTRALARGEICONS 60008
#define IDM_COMMAND_PROMPT_DROPDOWN_AS_ADMIN 60009

// Next default values for new objects
//
Expand Down