MCPcopy Create free account
hub / github.com/derceg/explorerplusplus / UpdateTextAndIcon

Method UpdateTextAndIcon

Explorer++/Explorer++/AddressBar.cpp:279–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279void AddressBar::UpdateTextAndIcon(const Tab &tab)
280{
281 // At this point, the text and icon in the address bar are being updated
282 // because the current folder has changed (e.g. because another tab has been
283 // selected). Therefore, any icon updates for the last history entry can be
284 // ignored. If that history entry becomes the current one again (e.g.
285 // because the original tab is re-selected), the listener can be set back up
286 // (if necessary).
287 m_historyEntryUpdatedConnection.disconnect();
288
289 auto entry = tab.GetShellBrowser()->GetNavigationController()->GetCurrentEntry();
290
291 auto cachedFullPath = entry->GetFullPathForDisplay();
292 std::optional<std::wstring> text;
293
294 if (cachedFullPath)
295 {
296 text = cachedFullPath;
297 }
298 else
299 {
300 text = GetFolderPathForDisplay(entry->GetPidl().get());
301
302 if (text)
303 {
304 entry->SetFullPathForDisplay(*text);
305 }
306 }
307
308 if (!text)
309 {
310 return;
311 }
312
313 auto cachedIconIndex = entry->GetSystemIconIndex();
314 int iconIndex;
315
316 if (cachedIconIndex)
317 {
318 iconIndex = *cachedIconIndex;
319 }
320 else
321 {
322 iconIndex = m_defaultFolderIconIndex;
323
324 m_historyEntryUpdatedConnection = entry->historyEntryUpdatedSignal.AddObserver(
325 boost::bind(&AddressBar::OnHistoryEntryUpdated, this, _1, _2));
326 }
327
328 SendMessage(m_hwnd, CB_RESETCONTENT, 0, 0);
329
330 UpdateTextAndIconInUI(&*text, iconIndex);
331}
332
333void AddressBar::UpdateTextAndIconInUI(std::wstring *text, int iconIndex)
334{

Callers

nothing calls this directly

Calls 10

GetFolderPathForDisplayFunction · 0.85
GetCurrentEntryMethod · 0.80
GetShellBrowserMethod · 0.80
GetFullPathForDisplayMethod · 0.80
GetPidlMethod · 0.80
SetFullPathForDisplayMethod · 0.80
GetSystemIconIndexMethod · 0.80
getMethod · 0.45
AddObserverMethod · 0.45

Tested by

no test coverage detected