widget/cocoa/nsColorPicker.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/cocoa/nsColorPicker.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,48 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef nsColorPicker_h_
    1.11 +#define nsColorPicker_h_
    1.12 +
    1.13 +#include "nsIColorPicker.h"
    1.14 +#include "nsString.h"
    1.15 +#include "nsCOMPtr.h"
    1.16 +
    1.17 +class nsIColorPickerShownCallback;
    1.18 +class nsIDOMWindow;
    1.19 +@class NSColorPanelWrapper;
    1.20 +@class NSColor;
    1.21 +
    1.22 +class nsColorPicker MOZ_FINAL : public nsIColorPicker
    1.23 +{
    1.24 +public:
    1.25 +  NS_DECL_ISUPPORTS
    1.26 +
    1.27 +  NS_IMETHOD Init(nsIDOMWindow* aParent, const nsAString& aTitle,
    1.28 +                  const nsAString& aInitialColor);
    1.29 +  NS_IMETHOD Open(nsIColorPickerShownCallback* aCallback);
    1.30 +
    1.31 +  // For NSColorPanelWrapper.
    1.32 +  void Update(NSColor* aColor);
    1.33 +  // Call this method if you are done with this input, but the color picker needs to
    1.34 +  // stay open as it will be associated to another input
    1.35 +  void DoneWithRetarget();
    1.36 +  // Same as DoneWithRetarget + clean the static instance of sColorPanelWrapper,
    1.37 +  // as it is not needed anymore for now
    1.38 +  void Done();
    1.39 +
    1.40 +private:
    1.41 +  static NSColor* GetNSColorFromHexString(const nsAString& aColor);
    1.42 +  static void GetHexStringFromNSColor(NSColor* aColor, nsAString& aResult);
    1.43 +
    1.44 +  static NSColorPanelWrapper* sColorPanelWrapper;
    1.45 +
    1.46 +  nsString             mTitle;
    1.47 +  nsString             mColor;
    1.48 +  nsCOMPtr<nsIColorPickerShownCallback> mCallback;
    1.49 +};
    1.50 +
    1.51 +#endif // nsColorPicker_h_

mercurial