98
98
gimp_frame_size_request (GtkWidget *widget,
99
99
GtkRequisition *requisition)
101
GtkFrame *frame = GTK_FRAME (widget);
102
GtkBin *bin = GTK_BIN (widget);
101
GtkFrame *frame = GTK_FRAME (widget);
102
GtkWidget *label_widget = gtk_frame_get_label_widget (frame);
103
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
103
104
GtkRequisition child_requisition;
105
if (frame->label_widget && GTK_WIDGET_VISIBLE (frame->label_widget))
107
if (label_widget && GTK_WIDGET_VISIBLE (label_widget))
107
gtk_widget_size_request (frame->label_widget, requisition);
109
gtk_widget_size_request (label_widget, requisition);
115
117
requisition->height += gimp_frame_get_label_spacing (frame);
117
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
119
if (child && GTK_WIDGET_VISIBLE (child))
119
121
gint indent = gimp_frame_get_indent (widget);
121
gtk_widget_size_request (bin->child, &child_requisition);
123
gtk_widget_size_request (child, &child_requisition);
123
125
requisition->width = MAX (requisition->width,
124
126
child_requisition.width + indent);
125
127
requisition->height += child_requisition.height;
128
requisition->width += 2 * GTK_CONTAINER (widget)->border_width;
129
requisition->height += 2 * GTK_CONTAINER (widget)->border_width;
130
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
132
requisition->width += 2 * border_width;
133
requisition->height += 2 * border_width;
133
137
gimp_frame_size_allocate (GtkWidget *widget,
134
138
GtkAllocation *allocation)
136
GtkFrame *frame = GTK_FRAME (widget);
137
GtkBin *bin = GTK_BIN (widget);
140
GtkFrame *frame = GTK_FRAME (widget);
141
GtkWidget *label_widget = gtk_frame_get_label_widget (frame);
142
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
139
144
widget->allocation = *allocation;
141
146
gimp_frame_child_allocate (frame, &frame->child_allocation);
143
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
144
gtk_widget_size_allocate (bin->child, &frame->child_allocation);
148
if (child && GTK_WIDGET_VISIBLE (child))
149
gtk_widget_size_allocate (child, &frame->child_allocation);
146
if (frame->label_widget && GTK_WIDGET_VISIBLE (frame->label_widget))
151
if (label_widget && GTK_WIDGET_VISIBLE (label_widget))
148
153
GtkAllocation label_allocation;
149
154
GtkRequisition label_requisition;
150
gint border = GTK_CONTAINER (widget)->border_width;
152
gtk_widget_get_child_requisition (frame->label_widget,
155
label_allocation.x = allocation->x + border;
156
label_allocation.y = allocation->y + border;
157
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
159
gtk_widget_get_child_requisition (label_widget, &label_requisition);
161
label_allocation.x = allocation->x + border_width;
162
label_allocation.y = allocation->y + border_width;
157
163
label_allocation.width = MAX (label_requisition.width,
158
allocation->width - 2 * border);
164
allocation->width - 2 * border_width);
159
165
label_allocation.height = label_requisition.height;
161
gtk_widget_size_allocate (frame->label_widget, &label_allocation);
167
gtk_widget_size_allocate (label_widget, &label_allocation);
166
172
gimp_frame_child_allocate (GtkFrame *frame,
167
173
GtkAllocation *child_allocation)
169
GtkWidget *widget = GTK_WIDGET (frame);
170
GtkAllocation *allocation = &widget->allocation;
171
gint border = GTK_CONTAINER (frame)->border_width;
173
gint indent = gimp_frame_get_indent (widget);
175
if (frame->label_widget && GTK_WIDGET_VISIBLE (frame->label_widget))
175
GtkWidget *widget = GTK_WIDGET (frame);
176
GtkWidget *label_widget = gtk_frame_get_label_widget (frame);
177
GtkAllocation *allocation = &widget->allocation;
180
gint indent = gimp_frame_get_indent (widget);
182
border_width = gtk_container_get_border_width (GTK_CONTAINER (frame));
184
if (label_widget && GTK_WIDGET_VISIBLE (label_widget))
177
186
GtkRequisition child_requisition;
179
gtk_widget_get_child_requisition (frame->label_widget,
188
gtk_widget_get_child_requisition (label_widget, &child_requisition);
181
189
spacing += child_requisition.height;
184
192
spacing += gimp_frame_get_label_spacing (frame);
186
194
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
187
child_allocation->x = border + indent;
195
child_allocation->x = border_width + indent;
189
child_allocation->x = border;
197
child_allocation->x = border_width;
191
child_allocation->y = border + spacing;
199
child_allocation->y = border_width + spacing;
192
200
child_allocation->width = MAX (1,
193
allocation->width - 2 * border - indent);
201
allocation->width - 2 * border_width - indent);
194
202
child_allocation->height = MAX (1,
195
203
allocation->height -
196
child_allocation->y - border);
204
child_allocation->y - border_width);
198
206
child_allocation->x += allocation->x;
199
207
child_allocation->y += allocation->y;
228
236
gimp_frame_label_widget_notify (GtkFrame *frame)
230
if (frame->label_widget)
238
GtkWidget *label_widget = gtk_frame_get_label_widget (frame);
232
242
GtkLabel *label = NULL;
234
if (GTK_IS_LABEL (frame->label_widget))
244
if (GTK_IS_LABEL (label_widget))
236
label = GTK_LABEL (frame->label_widget);
238
gtk_misc_set_alignment (GTK_MISC (label),
239
frame->label_xalign, frame->label_yalign);
246
gfloat xalign, yalign;
248
label = GTK_LABEL (label_widget);
250
gtk_frame_get_label_align (frame, &xalign, &yalign);
251
gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign);
241
else if (GTK_IS_BIN (frame->label_widget))
253
else if (GTK_IS_BIN (label_widget))
243
GtkWidget *child = gtk_bin_get_child (GTK_BIN (frame->label_widget));
255
GtkWidget *child = gtk_bin_get_child (GTK_BIN (label_widget));
245
257
if (GTK_IS_LABEL (child))
246
258
label = GTK_LABEL (child);
294
306
gimp_frame_get_label_spacing (GtkFrame *frame)
308
GtkWidget *label_widget = gtk_frame_get_label_widget (frame);
298
if ((frame->label_widget && GTK_WIDGET_VISIBLE (frame->label_widget)) ||
311
if ((label_widget && GTK_WIDGET_VISIBLE (label_widget)) ||
299
312
(g_object_get_data (G_OBJECT (frame), GIMP_FRAME_IN_EXPANDER_KEY)))
301
314
gtk_widget_style_get (GTK_WIDGET (frame),