1 /* vim: se cin sw=2 ts=2 et : */
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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"
20 class TaskbarPreviewButton
;
21 class TaskbarWindowPreview
: public TaskbarPreview
,
22 public nsITaskbarWindowPreview
,
23 public nsITaskbarProgress
,
24 public nsITaskbarOverlayIconController
,
25 public nsSupportsWeakReference
{
26 virtual ~TaskbarWindowPreview();
29 TaskbarWindowPreview(ITaskbarList4
* aTaskbar
,
30 nsITaskbarPreviewController
* aController
, HWND aHWND
,
32 virtual nsresult
Init() override
;
35 NS_DECL_NSITASKBARWINDOWPREVIEW
36 NS_DECL_NSITASKBARPROGRESS
37 NS_DECL_NSITASKBAROVERLAYICONCONTROLLER
38 NS_FORWARD_NSITASKBARPREVIEW(TaskbarPreview::)
40 virtual LRESULT
WndProc(UINT nMsg
, WPARAM wParam
, LPARAM lParam
) override
;
43 virtual nsresult
ShowActive(bool active
) override
;
44 virtual HWND
& PreviewWindow() override
;
46 virtual nsresult
UpdateTaskbarProperties() override
;
47 virtual nsresult
Enable() override
;
48 virtual nsresult
Disable() override
;
49 virtual void DetachFromNSWindow() override
;
50 nsresult
UpdateButton(uint32_t index
);
51 nsresult
UpdateButtons();
53 // Is custom drawing enabled?
55 // Have we made any buttons?
57 // Windows button format
58 THUMBBUTTON mThumbButtons
[nsITaskbarWindowPreview::NUM_TOOLBAR_BUTTONS
];
59 // Pointers to our button class (cached instances)
60 nsWeakPtr mWeakButtons
[nsITaskbarWindowPreview::NUM_TOOLBAR_BUTTONS
];
62 // Called to update ITaskbarList4 dependent properties
63 nsresult
UpdateTaskbarProgress();
64 nsresult
UpdateOverlayIcon();
66 // The taskbar progress
68 ULONGLONG mCurrentValue
;
71 // Taskbar overlay icon
73 nsString mIconDescription
;
75 // WindowHook procedure for hooking mWnd for taskbar progress and icon stuff
76 static bool TaskbarWindowHook(void* aContext
, HWND hWnd
, UINT nMsg
,
77 WPARAM wParam
, LPARAM lParam
, LRESULT
* aResult
);
79 friend class TaskbarPreviewButton
;
83 } // namespace mozilla
85 #endif /* __mozilla_widget_TaskbarWindowPreview_h__ */