Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
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/. */
7 #ifndef nsColorPicker_h_
8 #define nsColorPicker_h_
10 #include "nsIColorPicker.h"
11 #include "nsString.h"
12 #include "nsCOMPtr.h"
14 class nsIColorPickerShownCallback;
15 class nsIDOMWindow;
16 @class NSColorPanelWrapper;
17 @class NSColor;
19 class nsColorPicker MOZ_FINAL : public nsIColorPicker
20 {
21 public:
22 NS_DECL_ISUPPORTS
24 NS_IMETHOD Init(nsIDOMWindow* aParent, const nsAString& aTitle,
25 const nsAString& aInitialColor);
26 NS_IMETHOD Open(nsIColorPickerShownCallback* aCallback);
28 // For NSColorPanelWrapper.
29 void Update(NSColor* aColor);
30 // Call this method if you are done with this input, but the color picker needs to
31 // stay open as it will be associated to another input
32 void DoneWithRetarget();
33 // Same as DoneWithRetarget + clean the static instance of sColorPanelWrapper,
34 // as it is not needed anymore for now
35 void Done();
37 private:
38 static NSColor* GetNSColorFromHexString(const nsAString& aColor);
39 static void GetHexStringFromNSColor(NSColor* aColor, nsAString& aResult);
41 static NSColorPanelWrapper* sColorPanelWrapper;
43 nsString mTitle;
44 nsString mColor;
45 nsCOMPtr<nsIColorPickerShownCallback> mCallback;
46 };
48 #endif // nsColorPicker_h_