widget/gtk/nsColorPicker.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:85750430e1b9
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #ifndef nsColorPicker_h__
7 #define nsColorPicker_h__
8
9 #include <gtk/gtk.h>
10
11 #include "nsCOMPtr.h"
12 #include "nsIColorPicker.h"
13 #include "nsString.h"
14
15 class nsIWidget;
16
17 class nsColorPicker MOZ_FINAL : public nsIColorPicker
18 {
19 public:
20 NS_DECL_ISUPPORTS
21 NS_DECL_NSICOLORPICKER
22
23 nsColorPicker() {};
24
25 private:
26 ~nsColorPicker() {};
27
28 static void OnColorChanged(GtkColorSelection* colorselection,
29 gpointer user_data);
30 static void OnResponse(GtkWidget* dialog, gint response_id,
31 gpointer user_data);
32 static void OnDestroy(GtkWidget* dialog, gpointer user_data);
33
34 // Conversion functions for color
35 static int convertGdkColorComponent(guint16 color_component);
36 static guint16 convertToGdkColorComponent(int color_component);
37 static GdkColor convertToGdkColor(nscolor color);
38 static nsString ToHexString(int n);
39
40 static GtkColorSelection* WidgetGetColorSelection(GtkWidget* widget);
41
42 void Done(GtkWidget* dialog, gint response_id);
43 void Update(GtkColorSelection* colorselection);
44 void ReadValueFromColorSelection(GtkColorSelection* colorselection);
45
46 nsCOMPtr<nsIWidget> mParentWidget;
47 nsCOMPtr<nsIColorPickerShownCallback> mCallback;
48 nsString mTitle;
49 nsString mColor;
50 nsString mInitialColor;
51 };
52
53 #endif // nsColorPicker_h__

mercurial