1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
68
  
69
  
70
  
71
  
72
  
73
  
74
  
75
  
76
  
77
  
78
  
79
  
80
  
81
  
82
  
83
  
84
  
85
  
86
  
87
  
88
  
89
  
90
  
91
  
92
  
93
  
94
  
95
  
96
  
97
  
98
  
99
  
100
  
101
  
102
  
103
  
104
  
105
  
106
  
107
  
108
  
109
  
110
  
111
  
112
  
113
  
114
  
115
  
116
  
117
  
118
  
119
  
120
  
121
  
122
  
123
  
124
  
125
  
126
  
127
  
128
  
129
  
130
  
131
  
132
  
133
  
134
  
135
  
136
  
137
  
138
  
139
  
140
  
141
  
142
  
143
  
144
  
145
  
146
  
147
  
148
  
149
  
150
  
151
  
152
  
153
  
154
  
155
  
156
  
157
  
158
  
159
  
160
  
161
  
162
  
163
  
164
  
165
  
166
  
167
  
168
  
169
  
170
  
171
  
/* -*- C -*- */ 
class GTK2.ColorSelection; 
inherit GTK2.Vbox; 
 
//! The color selection widget is, not surprisingly, a widget for 
//! interactive selection of colors.  This composite widget lets the 
//! user select a color by manipulating RGB (Red, Green, Blue) and HSV 
//! (Hue, Saturation, Value) triples. This is done either by adjusting 
//! single values with sliders or entries, or by picking the desired 
//! color from a hue-saturation wheel/value bar.  Optionally, the 
//! opacity of the color can also be set. 
//! <p> 
//! The color selection widget currently emits only one signal, 
//! "color_changed", which is emitted whenever the current color in the 
//! widget changes, either when the user changes it or if it's set 
//! explicitly through set_color(). 
//! </p> 
//! IMG: GTK2.ColorSelection() 
 
//! Properties: 
//! int current-alpha 
//! GDK2.Color current-color 
//! int has-opacity-control 
//! int has-palette 
 
signal color_changed; 
 
void create(?mapping(string:mixed) props) 
//! Create a new color selection. 
{ 
  pgtk2_verify_not_inited(); 
  pgtk2_verify_setup(); 
  if (args) { 
    INIT_WITH_PROPS(GTK_TYPE_COLOR_SELECTION); 
    pgtk2_pop_n_elems(args); 
  } else { 
    GtkWidget *gc; 
    gc=gtk_color_selection_new(); 
    THIS->obj=G_OBJECT(gc); 
  } 
  pgtk2__init_this_object(); 
} 
 
void set_has_opacity_control(int setting); 
//! Sets whether or not to use opacity. 
 
int get_has_opacity_control(); 
//! Determines whether the colorsel has an opacity control. 
 
void set_has_palette(int has_palette); 
//! Shows and hides the palette based upon the value of has_palette 
 
int get_has_palette(); 
//! Determines whether the color selector has a color palette. 
 
int get_current_alpha(); 
//! Returns the current alpha value. 
 
void set_current_alpha(int alpha); 
//! Sets the current opacity to be alpha.  The first time this 
//! is called, it will also set the original opacity to be alpha too. 
 
mapping(string:int) get_current_color() 
//!  When you need to query the current color, typically when you've 
//!  received a "color_changed" signal, you use this function. The 
//!  return value is an array of floats, See the set_color() function 
//!  for the description of this array. 
{ 
  pgtk2_verify_inited(); 
  { 
    GdkColor color; 
    gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(THIS->obj), 
                &color); 
    pgtk2_pop_n_elems(args); 
    push_static_text("pixel"); push_int(color.pixel); 
    push_static_text("red"); push_int(color.red); 
    push_static_text("green"); push_int(color.green); 
    push_static_text("blue"); push_int(color.blue); 
    f_aggregate_mapping(8); 
  } 
} 
 
void set_current_color(mapping(string:int) color) 
//! You can set the current color explicitly by calling this function 
//! with an array of colors (floats). The length of the array depends 
//! on whether opacity is enabled or not. Position 0 contains the red 
//! component, 1 is green, 2 is blue and opacity is at position 3 (only 
//! if opacity is enabled, see set_opacity()) All values are between 
//! 0 and 65535 
{ 
  pgtk2_verify_inited(); 
  { 
    struct svalue *sv; 
    struct mapping *m; 
    GdkColor color; 
    get_all_args(NULL,args,"%m",&m); 
    sv=low_mapping_string_lookup(m,_STR("pixel")); 
    if (sv) 
      color.pixel=(guint32)PGTK_GETINT(sv); 
    sv=low_mapping_string_lookup(m,_STR("red")); 
    if (sv) 
      color.red=(guint16)PGTK_GETINT(sv); 
    sv=low_mapping_string_lookup(m,_STR("green")); 
    if (sv) 
      color.green=(guint16)PGTK_GETINT(sv); 
    sv=low_mapping_string_lookup(m,_STR("blue")); 
    if (sv) 
      color.blue=(guint16)PGTK_GETINT(sv); 
    gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(THIS->obj), 
                &color); 
  } 
  RETURN_THIS(); 
} 
 
int get_previous_alpha(); 
//! Returns the previous alpha value. 
 
void set_previous_alpha(int alpha); 
//! Sets the 'previous' alpha to be alpha.  This function should 
//! be called with some hesitation, as it might seem confusing 
//! to have that alpha change. 
 
mapping(string:int) get_previous_color() 
//! Returns the original color value. 
{ 
  pgtk2_verify_inited(); 
  { 
    GdkColor color; 
    gtk_color_selection_get_previous_color(GTK_COLOR_SELECTION(THIS->obj), 
                &color); 
    pgtk2_pop_n_elems(args); 
    ref_push_string(_STR("pixel")); push_int(color.pixel); 
    ref_push_string(_STR("red")); push_int(color.red); 
    ref_push_string(_STR("green")); push_int(color.green); 
    ref_push_string(_STR("blue")); push_int(color.blue); 
    f_aggregate_mapping(8); 
  } 
} 
 
void set_previous_color(mapping(string:int) colors) 
//! Sets the 'previous' color to be color. 
{ 
  pgtk2_verify_inited(); 
  { 
    struct mapping *m; 
    struct svalue *sv; 
    GdkColor color; 
    get_all_args(NULL,args,"%m",&m); 
    sv=low_mapping_string_lookup(m,_STR("pixel")); 
    if (sv) 
      color.pixel=(guint32)PGTK_GETINT(sv); 
    sv=low_mapping_string_lookup(m,_STR("red")); 
    if (sv) 
      color.red=(guint16)PGTK_GETINT(sv); 
    sv=low_mapping_string_lookup(m,_STR("green")); 
    if (sv) 
      color.green=(guint16)PGTK_GETINT(sv); 
    sv=low_mapping_string_lookup(m,_STR("blue")); 
    if (sv) 
      color.blue=(guint16)PGTK_GETINT(sv); 
    gtk_color_selection_set_previous_color(GTK_COLOR_SELECTION(THIS->obj), 
                &color); 
  } 
  RETURN_THIS(); 
} 
 
int is_adjusting(); 
//! Gets the current state of the colorsel.