1 --- gtk+-2.6.4/gtk/gtkradiobutton.c 2004-08-09 19:59:52.000000000 +0300
2 +++ gtk+-2.6.4/gtk/gtkradiobutton.c 2005-04-06 16:19:37.126894216 +0300
4 #include "gtkradiobutton.h"
7 +#define TOGGLE_ON_CLICK "toggle-on-click"
13 tmp_list = tmp_list->next;
20 GtkWidget *child = tmp_list->data;
24 gtk_widget_grab_focus (new_focus);
25 - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (new_focus), TRUE);
27 + /* arrow keys select the button ? CHECK THIS!!
28 + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (new_focus), TRUE);
34 GtkToggleButton *toggle_button;
35 GtkRadioButton *radio_button;
36 GtkToggleButton *tmp_button;
37 - GtkStateType new_state;
38 + GtkStateType new_state = GTK_WIDGET_STATE( button );
43 g_object_ref (GTK_WIDGET (button));
45 if (toggle_button->active)
48 - tmp_list = radio_button->group;
52 - tmp_button = tmp_list->data;
53 - tmp_list = tmp_list->next;
56 + tmp_list = radio_button->group;
58 - if (tmp_button->active && tmp_button != toggle_button)
62 + tmp_button = tmp_list->data;
63 + tmp_list = tmp_list->next;
65 + if (tmp_button->active && tmp_button != toggle_button)
75 - new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
78 + new_state = (button->in_button ?
79 + GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
84 + toggle_button->active = !toggle_button->active;
85 + new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
91 toggle_button->active = !toggle_button->active;
92 - new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
98 - toggle_button->active = !toggle_button->active;
100 - tmp_list = radio_button->group;
103 - tmp_button = tmp_list->data;
104 - tmp_list = tmp_list->next;
106 - if (tmp_button->active && (tmp_button != toggle_button))
107 + tmp_list = radio_button->group;
110 - gtk_button_clicked (GTK_BUTTON (tmp_button));
112 + tmp_button = tmp_list->data;
113 + tmp_list = tmp_list->next;
115 + if (tmp_button->active && (tmp_button != toggle_button))
117 + gtk_button_clicked (GTK_BUTTON (tmp_button));
122 + new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
125 - new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
128 if (toggle_button->inconsistent)
136 GtkToggleButton *toggle_button;
137 GtkStateType state_type;
138 @@ -686,54 +694,80 @@
139 "focus-padding", &focus_pad,
142 - _gtk_check_button_get_props (check_button, &indicator_size, &indicator_spacing);
144 - x = widget->allocation.x + indicator_spacing + GTK_CONTAINER (widget)->border_width;
145 - y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2;
147 - child = GTK_BIN (check_button)->child;
148 - if (!interior_focus || !(child && GTK_WIDGET_VISIBLE (child)))
149 - x += focus_width + focus_pad;
150 + _gtk_check_button_get_props (check_button,
151 + &indicator_size, &indicator_spacing);
153 + x = widget->allocation.x + indicator_spacing +
154 + GTK_CONTAINER (widget)->border_width;
155 + y = widget->allocation.y + (widget->allocation.height -
156 + indicator_size + focus_width +
159 + /* Hildon - always add space for the padding
161 + x += focus_width + focus_pad;
163 if (toggle_button->inconsistent)
164 - shadow_type = GTK_SHADOW_ETCHED_IN;
165 + shadow_type = GTK_SHADOW_ETCHED_IN;
167 else if (toggle_button->active)
168 - shadow_type = GTK_SHADOW_IN;
169 + shadow_type = GTK_SHADOW_IN;
172 - shadow_type = GTK_SHADOW_OUT;
173 + shadow_type = GTK_SHADOW_OUT;
175 + if (button->activate_timeout ||
176 + (button->button_down && button->in_button) )
177 + state_type = GTK_STATE_ACTIVE;
179 - if (button->activate_timeout || (button->button_down && button->in_button))
180 - state_type = GTK_STATE_ACTIVE;
181 else if (button->in_button)
182 - state_type = GTK_STATE_PRELIGHT;
183 + state_type = GTK_STATE_PRELIGHT;
185 else if (!GTK_WIDGET_IS_SENSITIVE (widget))
186 state_type = GTK_STATE_INSENSITIVE;
189 - state_type = GTK_STATE_NORMAL;
190 + state_type = GTK_STATE_NORMAL;
192 + /* Hildon change. We want to draw active image always when we have
194 + if (GTK_WIDGET_HAS_FOCUS (widget))
195 + state_type = GTK_STATE_ACTIVE;
197 if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
198 - x = widget->allocation.x + widget->allocation.width - (indicator_size + x - widget->allocation.x);
201 + x = widget->allocation.x + widget->allocation.width -
202 + (indicator_size + x - widget->allocation.x);
204 + /* Well, commenting this out fixes bug #280,
205 + without apparent side effects.
207 if (GTK_WIDGET_STATE (toggle_button) == GTK_STATE_PRELIGHT)
209 GdkRectangle restrict_area;
210 GdkRectangle new_area;
212 - restrict_area.x = widget->allocation.x + GTK_CONTAINER (widget)->border_width;
213 - restrict_area.y = widget->allocation.y + GTK_CONTAINER (widget)->border_width;
214 - restrict_area.width = widget->allocation.width - (2 * GTK_CONTAINER (widget)->border_width);
215 - restrict_area.height = widget->allocation.height - (2 * GTK_CONTAINER (widget)->border_width);
216 + restrict_area.x = widget->allocation.x +
217 + GTK_CONTAINER (widget)->border_width;
218 + restrict_area.y = widget->allocation.y +
219 + GTK_CONTAINER (widget)->border_width;
220 + restrict_area.width = widget->allocation.width -
221 + (2 * GTK_CONTAINER (widget)->border_width);
222 + restrict_area.height = widget->allocation.height -
223 + (2 * GTK_CONTAINER (widget)->border_width);
225 if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
227 - gtk_paint_flat_box (widget->style, widget->window, GTK_STATE_PRELIGHT,
228 - GTK_SHADOW_ETCHED_OUT,
229 - area, widget, "checkbutton",
230 - new_area.x, new_area.y,
231 - new_area.width, new_area.height);
232 + gtk_paint_flat_box (widget->style, widget->window,
233 + GTK_STATE_PRELIGHT,
234 + GTK_SHADOW_ETCHED_OUT,
235 + area, widget, "checkbutton",
236 + new_area.x, new_area.y,
237 + new_area.width, new_area.height);
242 gtk_paint_option (widget->style, widget->window,
243 state_type, shadow_type,
244 area, widget, "radiobutton",