/* vim: se cin sw=2 ts=2 et : */ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
nsresult TaskbarTabPreview::ShowActive(bool active) {
NS_ASSERTION(mVisible && CanMakeTaskbarCalls(), "ShowActive called on invisible window or before taskbar calls " "can be made for this window"); return FAILED(
mTaskbar->SetTabActive(active ? mProxyWindow : nullptr, mWnd, 0))
? NS_ERROR_FAILURE
: NS_OK;
}
void TaskbarTabPreview::EnsureRegistration() {
NS_ASSERTION(mVisible && CanMakeTaskbarCalls(), "EnsureRegistration called when it is not safe to do so");
LRESULT
TaskbarTabPreview::WndProc(UINT nMsg, WPARAM wParam, LPARAM lParam) {
RefPtr<TaskbarTabPreview> kungFuDeathGrip(this); switch (nMsg) { case WM_CREATE:
TaskbarPreview::EnableCustomDrawing(mProxyWindow, true); return 0; case WM_CLOSE:
mController->OnClose(); return 0; case WM_ACTIVATE: if (LOWORD(wParam) == WA_ACTIVE) { // Activate the tab the user selected then restore the main window, // keeping normal/max window state intact. bool activateWindow;
nsresult rv = mController->OnActivate(&activateWindow); if (NS_SUCCEEDED(rv) && activateWindow) {
nsWindow* win = WinUtils::GetNSWindowPtr(mWnd); if (win) {
nsWindow* parent = win->GetTopLevelWindow(true); if (parent) {
parent->Show(true);
}
}
}
} return 0; case WM_GETICON: return (LRESULT)mIcon; case WM_SYSCOMMAND: // Send activation events to the top level window and select the proper // tab through the controller. if (wParam == SC_RESTORE || wParam == SC_MAXIMIZE) { bool activateWindow;
nsresult rv = mController->OnActivate(&activateWindow); if (NS_SUCCEEDED(rv) && activateWindow) { // Note, restoring an iconic, maximized window here will only // activate the maximized window. This is not a bug, it's default // windows behavior.
::SendMessageW(mWnd, WM_SYSCOMMAND, wParam, lParam);
} return 0;
} // Forward everything else to the top level window. Do not forward // close since that's intended for the tab. When the preview proxy // closes, we'll close the tab above. return wParam == SC_CLOSE
? ::DefWindowProcW(mProxyWindow, WM_SYSCOMMAND, wParam, lParam)
: ::SendMessageW(mWnd, WM_SYSCOMMAND, wParam, lParam);
} return TaskbarPreview::WndProc(nMsg, wParam, lParam);
}
rvUpdate = UpdateIcon(); if (NS_FAILED(rvUpdate)) rv = rvUpdate;
return rv;
}
nsresult TaskbarTabPreview::Disable() { // TaskbarPreview::Disable assumes that mWnd is valid but this method can be // called when it is null iff the nsWindow has already been destroyed and we // are still visible for some reason during object destruction. if (mWnd) TaskbarPreview::Disable();
if (FAILED(mTaskbar->UnregisterTab(mProxyWindow))) return NS_ERROR_FAILURE;
mRegistered = false;
// TaskbarPreview::WndProc will set mProxyWindow to null if (!DestroyWindow(mProxyWindow)) return NS_ERROR_FAILURE;
mProxyWindow = nullptr; return NS_OK;
}
nsresult TaskbarTabPreview::UpdateNext() {
NS_ASSERTION(CanMakeTaskbarCalls() && mVisible, "UpdateNext called on invisible tab preview");
HWND hNext = nullptr; if (mNext) { bool visible;
nsresult rv = mNext->GetVisible(&visible);
NS_ENSURE_SUCCESS(rv, rv);
// Can only move next to enabled previews if (!visible) return NS_ERROR_FAILURE;
hNext = (HWND)mNext->GetHWND();
// hNext must be registered with the taskbar if the call is to succeed
mNext->EnsureRegistration();
} if (FAILED(mTaskbar->SetTabOrder(mProxyWindow, hNext))) return NS_ERROR_FAILURE; return NS_OK;
}
} // namespace widget
} // namespace mozilla
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.