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
michael@0 | 1 | /* vim: se cin sw=2 ts=2 et : */ |
michael@0 | 2 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 3 | * |
michael@0 | 4 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 5 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 6 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 7 | |
michael@0 | 8 | #ifndef __mozilla_widget_TaskbarWindowPreview_h__ |
michael@0 | 9 | #define __mozilla_widget_TaskbarWindowPreview_h__ |
michael@0 | 10 | |
michael@0 | 11 | #include "nsITaskbarWindowPreview.h" |
michael@0 | 12 | #include "nsITaskbarProgress.h" |
michael@0 | 13 | #include "nsITaskbarOverlayIconController.h" |
michael@0 | 14 | #include "TaskbarPreview.h" |
michael@0 | 15 | #include <nsWeakReference.h> |
michael@0 | 16 | |
michael@0 | 17 | namespace mozilla { |
michael@0 | 18 | namespace widget { |
michael@0 | 19 | |
michael@0 | 20 | class TaskbarPreviewButton; |
michael@0 | 21 | class TaskbarWindowPreview : public TaskbarPreview, |
michael@0 | 22 | public nsITaskbarWindowPreview, |
michael@0 | 23 | public nsITaskbarProgress, |
michael@0 | 24 | public nsITaskbarOverlayIconController, |
michael@0 | 25 | public nsSupportsWeakReference |
michael@0 | 26 | { |
michael@0 | 27 | public: |
michael@0 | 28 | TaskbarWindowPreview(ITaskbarList4 *aTaskbar, nsITaskbarPreviewController *aController, HWND aHWND, nsIDocShell *aShell); |
michael@0 | 29 | virtual ~TaskbarWindowPreview(); |
michael@0 | 30 | |
michael@0 | 31 | NS_DECL_ISUPPORTS |
michael@0 | 32 | NS_DECL_NSITASKBARWINDOWPREVIEW |
michael@0 | 33 | NS_DECL_NSITASKBARPROGRESS |
michael@0 | 34 | NS_DECL_NSITASKBAROVERLAYICONCONTROLLER |
michael@0 | 35 | NS_FORWARD_NSITASKBARPREVIEW(TaskbarPreview::) |
michael@0 | 36 | |
michael@0 | 37 | virtual LRESULT WndProc(UINT nMsg, WPARAM wParam, LPARAM lParam); |
michael@0 | 38 | private: |
michael@0 | 39 | virtual nsresult ShowActive(bool active); |
michael@0 | 40 | virtual HWND &PreviewWindow(); |
michael@0 | 41 | |
michael@0 | 42 | virtual nsresult UpdateTaskbarProperties(); |
michael@0 | 43 | virtual nsresult Enable(); |
michael@0 | 44 | virtual nsresult Disable(); |
michael@0 | 45 | virtual void DetachFromNSWindow(); |
michael@0 | 46 | nsresult UpdateButton(uint32_t index); |
michael@0 | 47 | nsresult UpdateButtons(); |
michael@0 | 48 | |
michael@0 | 49 | // Is custom drawing enabled? |
michael@0 | 50 | bool mCustomDrawing; |
michael@0 | 51 | // Have we made any buttons? |
michael@0 | 52 | bool mHaveButtons; |
michael@0 | 53 | // Windows button format |
michael@0 | 54 | THUMBBUTTON mThumbButtons[nsITaskbarWindowPreview::NUM_TOOLBAR_BUTTONS]; |
michael@0 | 55 | // Pointers to our button class (cached instances) |
michael@0 | 56 | nsWeakPtr mWeakButtons[nsITaskbarWindowPreview::NUM_TOOLBAR_BUTTONS]; |
michael@0 | 57 | |
michael@0 | 58 | // Called to update ITaskbarList4 dependent properties |
michael@0 | 59 | nsresult UpdateTaskbarProgress(); |
michael@0 | 60 | nsresult UpdateOverlayIcon(); |
michael@0 | 61 | |
michael@0 | 62 | // The taskbar progress |
michael@0 | 63 | TBPFLAG mState; |
michael@0 | 64 | ULONGLONG mCurrentValue; |
michael@0 | 65 | ULONGLONG mMaxValue; |
michael@0 | 66 | |
michael@0 | 67 | // Taskbar overlay icon |
michael@0 | 68 | HICON mOverlayIcon; |
michael@0 | 69 | nsString mIconDescription; |
michael@0 | 70 | |
michael@0 | 71 | // WindowHook procedure for hooking mWnd for taskbar progress and icon stuff |
michael@0 | 72 | static bool TaskbarWindowHook(void *aContext, |
michael@0 | 73 | HWND hWnd, UINT nMsg, |
michael@0 | 74 | WPARAM wParam, LPARAM lParam, |
michael@0 | 75 | LRESULT *aResult); |
michael@0 | 76 | |
michael@0 | 77 | friend class TaskbarPreviewButton; |
michael@0 | 78 | }; |
michael@0 | 79 | |
michael@0 | 80 | } // namespace widget |
michael@0 | 81 | } // namespace mozilla |
michael@0 | 82 | |
michael@0 | 83 | #endif /* __mozilla_widget_TaskbarWindowPreview_h__ */ |
michael@0 | 84 |