Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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/. */
8 #ifndef __mozilla_widget_TaskbarWindowPreview_h__
9 #define __mozilla_widget_TaskbarWindowPreview_h__
11 #include "nsITaskbarWindowPreview.h"
12 #include "nsITaskbarProgress.h"
13 #include "nsITaskbarOverlayIconController.h"
14 #include "TaskbarPreview.h"
15 #include <nsWeakReference.h>
17 namespace mozilla {
18 namespace widget {
20 class TaskbarPreviewButton;
21 class TaskbarWindowPreview : public TaskbarPreview,
22 public nsITaskbarWindowPreview,
23 public nsITaskbarProgress,
24 public nsITaskbarOverlayIconController,
25 public nsSupportsWeakReference
26 {
27 public:
28 TaskbarWindowPreview(ITaskbarList4 *aTaskbar, nsITaskbarPreviewController *aController, HWND aHWND, nsIDocShell *aShell);
29 virtual ~TaskbarWindowPreview();
31 NS_DECL_ISUPPORTS
32 NS_DECL_NSITASKBARWINDOWPREVIEW
33 NS_DECL_NSITASKBARPROGRESS
34 NS_DECL_NSITASKBAROVERLAYICONCONTROLLER
35 NS_FORWARD_NSITASKBARPREVIEW(TaskbarPreview::)
37 virtual LRESULT WndProc(UINT nMsg, WPARAM wParam, LPARAM lParam);
38 private:
39 virtual nsresult ShowActive(bool active);
40 virtual HWND &PreviewWindow();
42 virtual nsresult UpdateTaskbarProperties();
43 virtual nsresult Enable();
44 virtual nsresult Disable();
45 virtual void DetachFromNSWindow();
46 nsresult UpdateButton(uint32_t index);
47 nsresult UpdateButtons();
49 // Is custom drawing enabled?
50 bool mCustomDrawing;
51 // Have we made any buttons?
52 bool mHaveButtons;
53 // Windows button format
54 THUMBBUTTON mThumbButtons[nsITaskbarWindowPreview::NUM_TOOLBAR_BUTTONS];
55 // Pointers to our button class (cached instances)
56 nsWeakPtr mWeakButtons[nsITaskbarWindowPreview::NUM_TOOLBAR_BUTTONS];
58 // Called to update ITaskbarList4 dependent properties
59 nsresult UpdateTaskbarProgress();
60 nsresult UpdateOverlayIcon();
62 // The taskbar progress
63 TBPFLAG mState;
64 ULONGLONG mCurrentValue;
65 ULONGLONG mMaxValue;
67 // Taskbar overlay icon
68 HICON mOverlayIcon;
69 nsString mIconDescription;
71 // WindowHook procedure for hooking mWnd for taskbar progress and icon stuff
72 static bool TaskbarWindowHook(void *aContext,
73 HWND hWnd, UINT nMsg,
74 WPARAM wParam, LPARAM lParam,
75 LRESULT *aResult);
77 friend class TaskbarPreviewButton;
78 };
80 } // namespace widget
81 } // namespace mozilla
83 #endif /* __mozilla_widget_TaskbarWindowPreview_h__ */