Bug 1931425 - Limit how often moz-label's #setStyles runs r=reusable-components-revie...
[gecko.git] / widget / windows / nsColorPicker.h
blobb934f8b85ddda28f59878366a3e234afbb2127d8
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsColorPicker_h__
8 #define nsColorPicker_h__
10 #include <windows.h>
11 #include <commdlg.h>
13 #include "nsBaseColorPicker.h"
14 #include "nsCOMPtr.h"
15 #include "nsThreadUtils.h"
17 class nsIWidget;
19 class AsyncColorChooser : public mozilla::Runnable {
20 public:
21 AsyncColorChooser(COLORREF aInitialColor,
22 const nsTArray<nsString>& aDefaultColors,
23 nsIWidget* aParentWidget,
24 nsIColorPickerShownCallback* aCallback);
25 NS_IMETHOD Run() override;
27 private:
28 void Update(COLORREF aColor);
30 static UINT_PTR CALLBACK HookProc(HWND aDialog, UINT aMsg, WPARAM aWParam,
31 LPARAM aLParam);
33 COLORREF mInitialColor;
34 nsTArray<nsString> mDefaultColors;
35 COLORREF mColor;
36 nsCOMPtr<nsIWidget> mParentWidget;
37 nsCOMPtr<nsIColorPickerShownCallback> mCallback;
40 class nsColorPicker final : public nsBaseColorPicker {
41 virtual ~nsColorPicker();
43 public:
44 nsColorPicker();
46 NS_DECL_ISUPPORTS
48 private:
49 // nsBaseColorPicker
50 nsresult InitNative(const nsTArray<nsString>& aDefaultColors) override;
51 nsresult OpenNative() override;
53 nsTArray<nsString> mDefaultColors;
54 nsCOMPtr<nsIWidget> mParentWidget;
57 #endif // nsColorPicker_h__