1 /* vim: se cin sw=2 ts=2 et : */ 2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 3 * 4 * This Source Code Form is subject to the terms of the Mozilla Public 5 * License, v. 2.0. If a copy of the MPL was not distributed with this 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 7 8 #ifndef __mozilla_widget_TaskbarTabPreview_h__ 9 #define __mozilla_widget_TaskbarTabPreview_h__ 10 11 #include "nsITaskbarTabPreview.h" 12 #include "TaskbarPreview.h" 13 14 namespace mozilla { 15 namespace widget { 16 17 class TaskbarTabPreview : public nsITaskbarTabPreview, public TaskbarPreview { 18 virtual ~TaskbarTabPreview(); 19 20 public: 21 TaskbarTabPreview(ITaskbarList4* aTaskbar, 22 nsITaskbarPreviewController* aController, HWND aHWND, 23 nsIDocShell* aShell); 24 virtual nsresult Init() override; 25 26 NS_DECL_ISUPPORTS 27 NS_DECL_NSITASKBARTABPREVIEW 28 NS_FORWARD_NSITASKBARPREVIEW(TaskbarPreview::) 29 30 private: 31 virtual nsresult ShowActive(bool active); 32 virtual HWND& PreviewWindow(); 33 virtual LRESULT WndProc(UINT nMsg, WPARAM wParam, LPARAM lParam); 34 static LRESULT CALLBACK GlobalWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, 35 LPARAM lParam); 36 37 virtual nsresult UpdateTaskbarProperties(); 38 virtual nsresult Enable(); 39 virtual nsresult Disable(); 40 virtual void DetachFromNSWindow(); 41 42 // WindowHook procedure for hooking mWnd 43 static bool MainWindowHook(void* aContext, HWND hWnd, UINT nMsg, 44 WPARAM wParam, LPARAM lParam, LRESULT* aResult); 45 46 // Bug 520807 - we need to update the proxy window style based on the main 47 // window's style to workaround a bug with the way the DWM displays the 48 // previews. 49 void UpdateProxyWindowStyle(); 50 51 nsresult UpdateTitle(); 52 nsresult UpdateIcon(); 53 nsresult UpdateNext(); 54 55 // Handle to the toplevel proxy window 56 HWND mProxyWindow; 57 nsString mTitle; 58 nsCOMPtr<imgIContainer> mIconImage; 59 // Cached Windows icon of mIconImage 60 HICON mIcon; 61 // Preview that follows this preview in the taskbar (left-to-right order) 62 nsCOMPtr<nsITaskbarTabPreview> mNext; 63 // True if this preview has been registered with the taskbar 64 bool mRegistered; 65 }; 66 67 } // namespace widget 68 } // namespace mozilla 69 70 #endif /* __mozilla_widget_TaskbarTabPreview_h__ */ 71