michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsColorPicker_h_ michael@0: #define nsColorPicker_h_ michael@0: michael@0: #include "nsIColorPicker.h" michael@0: #include "nsString.h" michael@0: #include "nsCOMPtr.h" michael@0: michael@0: class nsIColorPickerShownCallback; michael@0: class nsIDOMWindow; michael@0: @class NSColorPanelWrapper; michael@0: @class NSColor; michael@0: michael@0: class nsColorPicker MOZ_FINAL : public nsIColorPicker michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: michael@0: NS_IMETHOD Init(nsIDOMWindow* aParent, const nsAString& aTitle, michael@0: const nsAString& aInitialColor); michael@0: NS_IMETHOD Open(nsIColorPickerShownCallback* aCallback); michael@0: michael@0: // For NSColorPanelWrapper. michael@0: void Update(NSColor* aColor); michael@0: // Call this method if you are done with this input, but the color picker needs to michael@0: // stay open as it will be associated to another input michael@0: void DoneWithRetarget(); michael@0: // Same as DoneWithRetarget + clean the static instance of sColorPanelWrapper, michael@0: // as it is not needed anymore for now michael@0: void Done(); michael@0: michael@0: private: michael@0: static NSColor* GetNSColorFromHexString(const nsAString& aColor); michael@0: static void GetHexStringFromNSColor(NSColor* aColor, nsAString& aResult); michael@0: michael@0: static NSColorPanelWrapper* sColorPanelWrapper; michael@0: michael@0: nsString mTitle; michael@0: nsString mColor; michael@0: nsCOMPtr mCallback; michael@0: }; michael@0: michael@0: #endif // nsColorPicker_h_