|
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_TaskbarWindowPreview_h__ |
|
9 #define __mozilla_widget_TaskbarWindowPreview_h__ |
|
10 |
|
11 #include "nsITaskbarWindowPreview.h" |
|
12 #include "nsITaskbarProgress.h" |
|
13 #include "nsITaskbarOverlayIconController.h" |
|
14 #include "TaskbarPreview.h" |
|
15 #include <nsWeakReference.h> |
|
16 |
|
17 namespace mozilla { |
|
18 namespace widget { |
|
19 |
|
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(); |
|
30 |
|
31 NS_DECL_ISUPPORTS |
|
32 NS_DECL_NSITASKBARWINDOWPREVIEW |
|
33 NS_DECL_NSITASKBARPROGRESS |
|
34 NS_DECL_NSITASKBAROVERLAYICONCONTROLLER |
|
35 NS_FORWARD_NSITASKBARPREVIEW(TaskbarPreview::) |
|
36 |
|
37 virtual LRESULT WndProc(UINT nMsg, WPARAM wParam, LPARAM lParam); |
|
38 private: |
|
39 virtual nsresult ShowActive(bool active); |
|
40 virtual HWND &PreviewWindow(); |
|
41 |
|
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(); |
|
48 |
|
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]; |
|
57 |
|
58 // Called to update ITaskbarList4 dependent properties |
|
59 nsresult UpdateTaskbarProgress(); |
|
60 nsresult UpdateOverlayIcon(); |
|
61 |
|
62 // The taskbar progress |
|
63 TBPFLAG mState; |
|
64 ULONGLONG mCurrentValue; |
|
65 ULONGLONG mMaxValue; |
|
66 |
|
67 // Taskbar overlay icon |
|
68 HICON mOverlayIcon; |
|
69 nsString mIconDescription; |
|
70 |
|
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); |
|
76 |
|
77 friend class TaskbarPreviewButton; |
|
78 }; |
|
79 |
|
80 } // namespace widget |
|
81 } // namespace mozilla |
|
82 |
|
83 #endif /* __mozilla_widget_TaskbarWindowPreview_h__ */ |
|
84 |