1 #ifndef SEEN_SP_COLOR_SCALES_H
2 #define SEEN_SP_COLOR_SCALES_H
4 #include <glib/gtypes.h>
5 #include <gtk/gtktooltips.h>
6 #include <gtk/gtkvbox.h>
8 #include <color.h>
9 #include <widgets/sp-color-slider.h>
10 #include <widgets/sp-color-selector.h>
13 struct SPColorScales;
14 struct SPColorScalesClass;
16 typedef enum {
17 SP_COLOR_SCALES_MODE_NONE = 0,
18 SP_COLOR_SCALES_MODE_RGB = 1,
19 SP_COLOR_SCALES_MODE_HSV = 2,
20 SP_COLOR_SCALES_MODE_CMYK = 3
21 } SPColorScalesMode;
25 class ColorScales: public ColorSelector
26 {
27 public:
28 static gfloat getScaled( const GtkAdjustment *a );
29 static void setScaled( GtkAdjustment *a, gfloat v);
31 ColorScales(SPColorSelector *csel);
32 virtual ~ColorScales();
34 virtual void init();
36 virtual void setSubmode(guint submode);
37 virtual guint getSubmode() const;
39 void setMode(SPColorScalesMode mode);
40 SPColorScalesMode getMode() const;
43 protected:
44 virtual void _colorChanged();
46 static void _adjustmentAnyChanged(GtkAdjustment *adjustment, SPColorScales *cs);
47 static void _sliderAnyGrabbed(SPColorSlider *slider, SPColorScales *cs);
48 static void _sliderAnyReleased(SPColorSlider *slider, SPColorScales *cs);
49 static void _sliderAnyChanged(SPColorSlider *slider, SPColorScales *cs);
50 static void _adjustmentChanged(SPColorScales *cs, guint channel);
52 void _getRgbaFloatv(gfloat *rgba);
53 void _getCmykaFloatv(gfloat *cmyka);
54 guint32 _getRgba32();
55 void _updateSliders(guint channels);
56 void _recalcColor(gboolean changing);
58 void _setRangeLimit( gdouble upper );
60 SPColorScalesMode _mode;
61 gdouble _rangeLimit;
62 gboolean _updating : 1;
63 gboolean _dragging : 1;
64 GtkAdjustment *_a[5]; /* Channel adjustments */
65 GtkWidget *_s[5]; /* Channel sliders */
66 GtkWidget *_b[5]; /* Spinbuttons */
67 GtkWidget *_l[5]; /* Labels */
69 GtkTooltips *_tt; /* tooltip container */
71 private:
72 // By default, disallow copy constructor and assignment operator
73 ColorScales(ColorScales const &obj);
74 ColorScales &operator=(ColorScales const &obj );
75 };
79 #define SP_TYPE_COLOR_SCALES (sp_color_scales_get_type())
80 #define SP_COLOR_SCALES(o) (GTK_CHECK_CAST((o), SP_TYPE_COLOR_SCALES, SPColorScales))
81 #define SP_COLOR_SCALES_CLASS(k) (GTK_CHECK_CLASS_CAST((k), SP_TYPE_COLOR_SCALES, SPColorScalesClass))
82 #define SP_IS_COLOR_SCALES(o) (GTK_CHECK_TYPE((o), SP_TYPE_COLOR_SCALES))
83 #define SP_IS_COLOR_SCALES_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), SP_TYPE_COLOR_SCALES))
85 struct SPColorScales {
86 SPColorSelector parent;
87 };
89 struct SPColorScalesClass {
90 SPColorSelectorClass parent_class;
91 };
93 GType sp_color_scales_get_type();
95 GtkWidget *sp_color_scales_new();
97 #endif /* !SEEN_SP_COLOR_SCALES_H */
99 /*
100 Local Variables:
101 mode:c++
102 c-file-style:"stroustrup"
103 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
104 indent-tabs-mode:nil
105 fill-column:99
106 End:
107 */
108 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :