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 
25   NS_DECL_ISUPPORTS
26   NS_DECL_NSITASKBARTABPREVIEW
27   NS_FORWARD_NSITASKBARPREVIEW(TaskbarPreview::)
28 
29  private:
30   virtual nsresult ShowActive(bool active);
31   virtual HWND &PreviewWindow();
32   virtual LRESULT WndProc(UINT nMsg, WPARAM wParam, LPARAM lParam);
33   static LRESULT CALLBACK GlobalWndProc(HWND hWnd, UINT nMsg, WPARAM wParam,
34                                         LPARAM lParam);
35 
36   virtual nsresult UpdateTaskbarProperties();
37   virtual nsresult Enable();
38   virtual nsresult Disable();
39   virtual void DetachFromNSWindow();
40 
41   // WindowHook procedure for hooking mWnd
42   static bool MainWindowHook(void *aContext, HWND hWnd, UINT nMsg,
43                              WPARAM wParam, LPARAM lParam, LRESULT *aResult);
44 
45   // Bug 520807 - we need to update the proxy window style based on the main
46   // window's style to workaround a bug with the way the DWM displays the
47   // previews.
48   void UpdateProxyWindowStyle();
49 
50   nsresult UpdateTitle();
51   nsresult UpdateIcon();
52   nsresult UpdateNext();
53 
54   // Handle to the toplevel proxy window
55   HWND mProxyWindow;
56   nsString mTitle;
57   nsCOMPtr<imgIContainer> mIconImage;
58   // Cached Windows icon of mIconImage
59   HICON mIcon;
60   // Preview that follows this preview in the taskbar (left-to-right order)
61   nsCOMPtr<nsITaskbarTabPreview> mNext;
62   // True if this preview has been registered with the taskbar
63   bool mRegistered;
64 };
65 
66 }  // namespace widget
67 }  // namespace mozilla
68 
69 #endif /* __mozilla_widget_TaskbarTabPreview_h__ */
70