1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/gtk/nsColorPicker.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,53 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsColorPicker_h__ 1.10 +#define nsColorPicker_h__ 1.11 + 1.12 +#include <gtk/gtk.h> 1.13 + 1.14 +#include "nsCOMPtr.h" 1.15 +#include "nsIColorPicker.h" 1.16 +#include "nsString.h" 1.17 + 1.18 +class nsIWidget; 1.19 + 1.20 +class nsColorPicker MOZ_FINAL : public nsIColorPicker 1.21 +{ 1.22 +public: 1.23 + NS_DECL_ISUPPORTS 1.24 + NS_DECL_NSICOLORPICKER 1.25 + 1.26 + nsColorPicker() {}; 1.27 + 1.28 +private: 1.29 + ~nsColorPicker() {}; 1.30 + 1.31 + static void OnColorChanged(GtkColorSelection* colorselection, 1.32 + gpointer user_data); 1.33 + static void OnResponse(GtkWidget* dialog, gint response_id, 1.34 + gpointer user_data); 1.35 + static void OnDestroy(GtkWidget* dialog, gpointer user_data); 1.36 + 1.37 + // Conversion functions for color 1.38 + static int convertGdkColorComponent(guint16 color_component); 1.39 + static guint16 convertToGdkColorComponent(int color_component); 1.40 + static GdkColor convertToGdkColor(nscolor color); 1.41 + static nsString ToHexString(int n); 1.42 + 1.43 + static GtkColorSelection* WidgetGetColorSelection(GtkWidget* widget); 1.44 + 1.45 + void Done(GtkWidget* dialog, gint response_id); 1.46 + void Update(GtkColorSelection* colorselection); 1.47 + void ReadValueFromColorSelection(GtkColorSelection* colorselection); 1.48 + 1.49 + nsCOMPtr<nsIWidget> mParentWidget; 1.50 + nsCOMPtr<nsIColorPickerShownCallback> mCallback; 1.51 + nsString mTitle; 1.52 + nsString mColor; 1.53 + nsString mInitialColor; 1.54 +}; 1.55 + 1.56 +#endif // nsColorPicker_h__