michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 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 michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIColorPicker.h" michael@0: #include "nsString.h" michael@0: michael@0: class nsIWidget; michael@0: michael@0: class nsColorPicker MOZ_FINAL : public nsIColorPicker michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSICOLORPICKER michael@0: michael@0: nsColorPicker() {}; michael@0: michael@0: private: michael@0: ~nsColorPicker() {}; michael@0: michael@0: static void OnColorChanged(GtkColorSelection* colorselection, michael@0: gpointer user_data); michael@0: static void OnResponse(GtkWidget* dialog, gint response_id, michael@0: gpointer user_data); michael@0: static void OnDestroy(GtkWidget* dialog, gpointer user_data); michael@0: michael@0: // Conversion functions for color michael@0: static int convertGdkColorComponent(guint16 color_component); michael@0: static guint16 convertToGdkColorComponent(int color_component); michael@0: static GdkColor convertToGdkColor(nscolor color); michael@0: static nsString ToHexString(int n); michael@0: michael@0: static GtkColorSelection* WidgetGetColorSelection(GtkWidget* widget); michael@0: michael@0: void Done(GtkWidget* dialog, gint response_id); michael@0: void Update(GtkColorSelection* colorselection); michael@0: void ReadValueFromColorSelection(GtkColorSelection* colorselection); michael@0: michael@0: nsCOMPtr mParentWidget; michael@0: nsCOMPtr mCallback; michael@0: nsString mTitle; michael@0: nsString mColor; michael@0: nsString mInitialColor; michael@0: }; michael@0: michael@0: #endif // nsColorPicker_h__