|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
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/. */ |
|
6 |
|
7 #ifndef nsColorPicker_h__ |
|
8 #define nsColorPicker_h__ |
|
9 |
|
10 #include <windows.h> |
|
11 #include <commdlg.h> |
|
12 |
|
13 #include "nsCOMPtr.h" |
|
14 #include "nsIColorPicker.h" |
|
15 #include "nsString.h" |
|
16 #include "nsThreadUtils.h" |
|
17 |
|
18 class nsIWidget; |
|
19 |
|
20 class AsyncColorChooser : |
|
21 public nsRunnable |
|
22 { |
|
23 public: |
|
24 AsyncColorChooser(const nsAString& aInitialColor, |
|
25 nsIWidget* aParentWidget, |
|
26 nsIColorPickerShownCallback* aCallback); |
|
27 NS_IMETHOD Run() MOZ_OVERRIDE; |
|
28 |
|
29 private: |
|
30 nsString mInitialColor; |
|
31 nsCOMPtr<nsIWidget> mParentWidget; |
|
32 nsCOMPtr<nsIColorPickerShownCallback> mCallback; |
|
33 nsString mColor; |
|
34 }; |
|
35 |
|
36 class nsColorPicker : |
|
37 public nsIColorPicker |
|
38 { |
|
39 public: |
|
40 nsColorPicker(); |
|
41 virtual ~nsColorPicker(); |
|
42 |
|
43 NS_DECL_ISUPPORTS |
|
44 |
|
45 NS_IMETHOD Init(nsIDOMWindow* parent, const nsAString& title, |
|
46 const nsAString& aInitialColor); |
|
47 NS_IMETHOD Open(nsIColorPickerShownCallback* aCallback); |
|
48 |
|
49 protected: |
|
50 nsString mInitialColor; |
|
51 nsCOMPtr<nsIWidget> mParentWidget; |
|
52 }; |
|
53 |
|
54 #endif // nsColorPicker_h__ |