1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 XangXiu Yang
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
21 #include <lttv/gtkmultivpaned.h>
22 //#include "gtkintl.h"
23 #include <lttv/mainWindow.h>
24 #include <lttv/gtkTraceSet.h>
26 static void gtk_multi_vpaned_class_init (GtkMultiVPanedClass
*klass
);
27 static void gtk_multi_vpaned_init (GtkMultiVPaned
*multi_vpaned
);
30 static void gtk_multi_vpaned_size_request (GtkWidget
*widget
,
31 GtkRequisition
*requisition
);
32 static void gtk_multi_vpaned_size_allocate (GtkWidget
*widget
,
33 GtkAllocation
*allocation
);
35 void gtk_multi_vpaned_scroll_value_changed (GtkRange
*range
, gpointer multi_vpaned
);
38 gtk_multi_vpaned_get_type (void)
40 static GType multi_vpaned_type
= 0;
42 if (!multi_vpaned_type
)
44 static const GTypeInfo multi_vpaned_info
=
46 sizeof (GtkMultiVPanedClass
),
48 NULL
, /* base_finalize */
49 (GClassInitFunc
) gtk_multi_vpaned_class_init
,
50 NULL
, /* class_finalize */
51 NULL
, /* class_data */
52 sizeof (GtkMultiVPaned
),
54 (GInstanceInitFunc
) gtk_multi_vpaned_init
,
55 NULL
, /* value_table */
58 multi_vpaned_type
= g_type_register_static (GTK_TYPE_PANED
, "GtkMultiVPaned",
59 &multi_vpaned_info
, 0);
62 return multi_vpaned_type
;
66 gtk_multi_vpaned_class_init (GtkMultiVPanedClass
*class)
68 GtkWidgetClass
*widget_class
;
70 widget_class
= (GtkWidgetClass
*) class;
72 widget_class
->size_request
= gtk_multi_vpaned_size_request
;
73 widget_class
->size_allocate
= gtk_multi_vpaned_size_allocate
;
77 gtk_multi_vpaned_init (GtkMultiVPaned
* multi_vpaned
)
81 GTK_WIDGET_SET_FLAGS (multi_vpaned
, GTK_NO_WINDOW
);
82 gtk_widget_set_redraw_on_allocate (GTK_WIDGET (multi_vpaned
), FALSE
);
84 multi_vpaned
->first_pane
= NULL
;
85 multi_vpaned
->last_pane
= NULL
;
86 multi_vpaned
->focused_pane
= NULL
;
87 multi_vpaned
->iter
= NULL
;
88 multi_vpaned
->num_children
= 0;
90 multi_vpaned
->vbox
= NULL
;
91 // multi_vpaned->scrollWindow = NULL;
92 // multi_vpaned->viewport = NULL;
93 multi_vpaned
->hscrollbar
= NULL
;
97 GtkWidget
* gtk_multi_vpaned_new ()
99 return GTK_WIDGET (g_object_new (gtk_multi_vpaned_get_type (), NULL
));
102 GtkWidget
* gtk_multi_vpaned_get_widget(GtkMultiVPaned
* multi_vpaned
)
104 if(multi_vpaned
->focused_pane
== NULL
)return NULL
;
105 return (GtkWidget
*)multi_vpaned
->focused_pane
->child2
;
108 GtkWidget
* gtk_multi_vpaned_get_first_widget(GtkMultiVPaned
* multi_vpaned
)
110 if(multi_vpaned
->first_pane
== NULL
)return NULL
;
111 multi_vpaned
->iter
= multi_vpaned
->first_pane
;
112 return multi_vpaned
->first_pane
->child2
;
115 GtkWidget
* gtk_multi_vpaned_get_next_widget(GtkMultiVPaned
* multi_vpaned
)
117 if(multi_vpaned
->iter
!= multi_vpaned
->last_pane
){
118 multi_vpaned
->iter
= (GtkPaned
*)multi_vpaned
->iter
->child1
;
119 return multi_vpaned
->iter
->child2
;
125 void gtk_multi_vpaned_set_data(GtkMultiVPaned
* multi_vpaned
,char * key
, gpointer value
)
127 g_object_set_data(G_OBJECT(multi_vpaned
->focused_pane
), key
, value
);
130 gpointer
gtk_multi_vpaned_get_data(GtkMultiVPaned
* multi_vpaned
,char * key
)
132 if(multi_vpaned
->focused_pane
== NULL
)return NULL
;
133 return g_object_get_data(G_OBJECT(multi_vpaned
->focused_pane
), key
);
136 void gtk_multi_vpaned_set_focus (GtkWidget
* widget
, gpointer user_data
)
138 GtkMultiVPaned
* multi_vpaned
= (GtkMultiVPaned
*) widget
;
140 if(!multi_vpaned
->first_pane
) return;
143 pane
= multi_vpaned
->first_pane
;
145 if((GtkWidget
*)pane
== (GtkWidget
*)user_data
){
146 multi_vpaned
->focused_pane
= pane
;
149 if(pane
== multi_vpaned
->last_pane
){
150 multi_vpaned
->focused_pane
= NULL
;
153 pane
= (GtkPaned
*)pane
->child1
;
157 void gtk_multi_vpaned_set_adjust(GtkMultiVPaned
* multi_vpaned
, gboolean first_time
)
159 TimeWindow time_window
;
160 TimeInterval
*time_span
;
164 get_time_window(multi_vpaned
->mw
,&time_window
);
166 time_span
= LTTV_TRACESET_CONTEXT(multi_vpaned
->mw
->current_tab
->traceset_info
->
167 traceset_context
)->Time_Span
;
169 multi_vpaned
->hadjust
->lower
= ltt_time_to_double(time_span
->startTime
) *
170 NANOSECONDS_PER_SECOND
;
171 multi_vpaned
->hadjust
->value
= multi_vpaned
->hadjust
->lower
;
172 multi_vpaned
->hadjust
->upper
= ltt_time_to_double(time_span
->endTime
) *
173 NANOSECONDS_PER_SECOND
;
176 /* Page increment of whole visible area */
177 if(multi_vpaned
->hadjust
== NULL
){
178 g_warning("Insert a viewer first");
182 start
= ltt_time_to_double(time_window
.start_time
) * NANOSECONDS_PER_SECOND
;
183 tmp
= multi_vpaned
->hadjust
->upper
- multi_vpaned
->hadjust
->lower
;
185 multi_vpaned
->hadjust
->page_increment
= ltt_time_to_double(
186 time_window
.time_width
) * NANOSECONDS_PER_SECOND
;
188 if(multi_vpaned
->hadjust
->page_increment
>= tmp
- range
)
189 multi_vpaned
->hadjust
->value
= multi_vpaned
->hadjust
->lower
;
190 if(start
+ multi_vpaned
->hadjust
->page_increment
>= multi_vpaned
->hadjust
->upper
- range
)
191 multi_vpaned
->hadjust
->value
= start
;
193 /* page_size to the whole visible area will take care that the
194 * scroll value + the shown area will never be more than what is
196 multi_vpaned
->hadjust
->page_size
= multi_vpaned
->hadjust
->page_increment
;
197 multi_vpaned
->hadjust
->step_increment
= multi_vpaned
->hadjust
->page_increment
/ 10;
199 gtk_adjustment_changed (multi_vpaned
->hadjust
);
202 void gtk_multi_vpaned_widget_add(GtkMultiVPaned
* multi_vpaned
, GtkWidget
* widget1
)
207 g_return_if_fail(GTK_IS_MULTI_VPANED(multi_vpaned
));
208 g_object_ref(G_OBJECT(widget1
));
211 if(!multi_vpaned
->first_pane
){
212 multi_vpaned
->first_pane
= (GtkPaned
*)gtk_vpaned_new();
213 multi_vpaned
->last_pane
= multi_vpaned
->first_pane
;
215 multi_vpaned
->hscrollbar
= gtk_hscrollbar_new (NULL
);
216 gtk_widget_show(multi_vpaned
->hscrollbar
);
218 multi_vpaned
->hadjust
= gtk_range_get_adjustment(GTK_RANGE(multi_vpaned
->hscrollbar
));
219 gtk_multi_vpaned_set_adjust(multi_vpaned
, TRUE
);
221 gtk_range_set_update_policy (GTK_RANGE(multi_vpaned
->hscrollbar
),
222 GTK_UPDATE_CONTINUOUS
);
223 //changed by Mathieu Desnoyers, was :
224 // GTK_UPDATE_DISCONTINUOUS);
225 g_signal_connect(G_OBJECT(multi_vpaned
->hscrollbar
), "value-changed",
226 G_CALLBACK(gtk_multi_vpaned_scroll_value_changed
), multi_vpaned
);
228 multi_vpaned
->vbox
= gtk_vbox_new(FALSE
,0);
229 gtk_widget_show(multi_vpaned
->vbox
);
231 // multi_vpaned->viewport = gtk_viewport_new (NULL,NULL);
232 // gtk_widget_show(multi_vpaned->viewport);
234 // gtk_container_add(GTK_CONTAINER(multi_vpaned->viewport), (GtkWidget*)multi_vpaned->vbox);
235 gtk_box_pack_end(GTK_BOX(multi_vpaned
->vbox
),(GtkWidget
*)multi_vpaned
->hscrollbar
,FALSE
,FALSE
,0);
236 gtk_box_pack_end(GTK_BOX(multi_vpaned
->vbox
),(GtkWidget
*)multi_vpaned
->first_pane
,TRUE
,TRUE
,0);
238 // multi_vpaned->scrollWindow = gtk_scrolled_window_new (NULL, NULL);
239 // gtk_widget_show(multi_vpaned->scrollWindow);
240 // gtk_container_add (GTK_CONTAINER (multi_vpaned->scrollWindow), (GtkWidget*)multi_vpaned->viewport);
241 // gtk_paned_pack1(GTK_PANED(multi_vpaned), (GtkWidget*)multi_vpaned->scrollWindow,FALSE, TRUE);
243 gtk_paned_pack1(GTK_PANED(multi_vpaned
), (GtkWidget
*)multi_vpaned
->vbox
,FALSE
, TRUE
);
245 tmpPane
= multi_vpaned
->last_pane
;
246 multi_vpaned
->last_pane
= (GtkPaned
*)gtk_vpaned_new();
247 gtk_paned_pack1 (tmpPane
,(GtkWidget
*)multi_vpaned
->last_pane
, FALSE
,TRUE
);
249 gtk_widget_show((GtkWidget
*)multi_vpaned
->last_pane
);
251 gtk_paned_pack2 (multi_vpaned
->last_pane
,widget1
, TRUE
, TRUE
);
252 multi_vpaned
->focused_pane
= multi_vpaned
->last_pane
;
253 multi_vpaned
->num_children
++;
257 void gtk_multi_vpaned_widget_delete(GtkMultiVPaned
* multi_vpaned
)
259 GtkPaned
* tmp
, *prev
, *next
;
261 if(!multi_vpaned
->focused_pane
) return;
263 tmp
= (GtkPaned
*)multi_vpaned
->focused_pane
->child2
; //widget in vpaned
264 g_object_unref(G_OBJECT(tmp
));
266 if(multi_vpaned
->focused_pane
== multi_vpaned
->first_pane
&&
267 multi_vpaned
->focused_pane
== multi_vpaned
->last_pane
){
268 // gtk_container_remove(GTK_CONTAINER(multi_vpaned),(GtkWidget*)multi_vpaned->scrollWindow);
269 gtk_container_remove(GTK_CONTAINER(multi_vpaned
),(GtkWidget
*)multi_vpaned
->vbox
);
270 multi_vpaned
->first_pane
= NULL
;
271 multi_vpaned
->last_pane
= NULL
;
272 multi_vpaned
->focused_pane
= NULL
;
273 }else if(multi_vpaned
->focused_pane
== multi_vpaned
->first_pane
&&
274 multi_vpaned
->focused_pane
!= multi_vpaned
->last_pane
){
275 next
= (GtkPaned
*)multi_vpaned
->first_pane
->child1
;
276 g_object_ref(G_OBJECT(next
));
277 gtk_container_remove(GTK_CONTAINER(multi_vpaned
->first_pane
),(GtkWidget
*)next
);
278 gtk_container_remove(GTK_CONTAINER(multi_vpaned
->vbox
),(GtkWidget
*)multi_vpaned
->first_pane
);
279 multi_vpaned
->first_pane
= next
;
280 gtk_box_pack_end(GTK_BOX(multi_vpaned
->vbox
),(GtkWidget
*)multi_vpaned
->first_pane
,TRUE
,TRUE
,0);
281 multi_vpaned
->focused_pane
= multi_vpaned
->first_pane
;
282 g_object_unref(G_OBJECT(next
));
283 }else if(multi_vpaned
->focused_pane
!= multi_vpaned
->first_pane
&&
284 multi_vpaned
->focused_pane
== multi_vpaned
->last_pane
){
285 tmp
= multi_vpaned
->last_pane
;
286 multi_vpaned
->last_pane
= (GtkPaned
*)gtk_widget_get_parent((GtkWidget
*)multi_vpaned
->last_pane
);
287 multi_vpaned
->focused_pane
= multi_vpaned
->last_pane
;
288 gtk_container_remove(GTK_CONTAINER(multi_vpaned
->last_pane
),(GtkWidget
*)tmp
);
290 tmp
= multi_vpaned
->focused_pane
;
291 prev
= (GtkPaned
*)gtk_widget_get_parent((GtkWidget
*)tmp
);
292 next
= (GtkPaned
*)tmp
->child1
;
293 g_object_ref(G_OBJECT(next
));
294 gtk_container_remove(GTK_CONTAINER(multi_vpaned
->focused_pane
),(GtkWidget
*)next
);
295 gtk_container_remove(GTK_CONTAINER(prev
),(GtkWidget
*)multi_vpaned
->focused_pane
);
296 gtk_paned_pack1(prev
, (GtkWidget
*)next
, FALSE
, TRUE
);
297 multi_vpaned
->focused_pane
= next
;
298 g_object_unref(G_OBJECT(next
));
301 multi_vpaned
->num_children
--;
305 void gtk_multi_vpaned_widget_move_up(GtkMultiVPaned
* multi_vpaned
)
307 GtkWidget
* upWidget
, *downWidget
;
308 GtkPaned
* prev
,*next
, *prevPrev
;
310 if(multi_vpaned
->last_pane
== multi_vpaned
->focused_pane
) return;
313 prev
= (GtkPaned
*)multi_vpaned
->focused_pane
->child1
;
314 g_object_ref(G_OBJECT(prev
));
315 gtk_container_remove(GTK_CONTAINER(multi_vpaned
->focused_pane
),(GtkWidget
*)prev
);
317 if(prev
== multi_vpaned
->last_pane
){
319 multi_vpaned
->last_pane
= multi_vpaned
->focused_pane
;
321 prevPrev
= (GtkPaned
*)prev
->child1
;
322 g_object_ref(G_OBJECT(prevPrev
));
323 gtk_container_remove(GTK_CONTAINER(prev
),(GtkWidget
*)prevPrev
);
326 g_object_ref(G_OBJECT(multi_vpaned
->focused_pane
));
327 if(multi_vpaned
->first_pane
== multi_vpaned
->focused_pane
){
328 gtk_container_remove(GTK_CONTAINER(multi_vpaned
->vbox
),(GtkWidget
*)multi_vpaned
->focused_pane
);
329 gtk_box_pack_end(GTK_BOX(multi_vpaned
->vbox
),(GtkWidget
*)prev
,TRUE
,TRUE
,0);
330 multi_vpaned
->first_pane
= prev
;
332 next
= (GtkPaned
*)gtk_widget_get_parent((GtkWidget
*)multi_vpaned
->focused_pane
);
333 gtk_container_remove(GTK_CONTAINER(next
),(GtkWidget
*)multi_vpaned
->focused_pane
);
334 gtk_paned_pack1(GTK_PANED(next
), (GtkWidget
*)prev
, FALSE
,TRUE
);
336 gtk_paned_pack1(GTK_PANED(prev
),(GtkWidget
*)multi_vpaned
->focused_pane
, FALSE
,TRUE
);
338 gtk_paned_pack1(GTK_PANED(multi_vpaned
->focused_pane
),(GtkWidget
*)prevPrev
, FALSE
,TRUE
);
340 g_object_unref(G_OBJECT(prev
));
341 if(prevPrev
) g_object_unref(G_OBJECT(prevPrev
));
342 g_object_unref(G_OBJECT(multi_vpaned
->focused_pane
));
346 void gtk_multi_vpaned_widget_move_down(GtkMultiVPaned
* multi_vpaned
)
348 GtkWidget
* upWidget
, *downWidget
;
349 GtkPaned
* prev
,*next
, *nextNext
;
351 if(multi_vpaned
->first_pane
== multi_vpaned
->focused_pane
) return;
354 next
= (GtkPaned
*)gtk_widget_get_parent((GtkWidget
*)multi_vpaned
->focused_pane
);
355 g_object_ref(G_OBJECT(next
));
357 if(multi_vpaned
->last_pane
== multi_vpaned
->focused_pane
){
359 multi_vpaned
->last_pane
= next
;
361 prev
= (GtkPaned
*)multi_vpaned
->focused_pane
->child1
;
362 g_object_ref(G_OBJECT(prev
));
363 gtk_container_remove(GTK_CONTAINER(multi_vpaned
->focused_pane
),(GtkWidget
*)prev
);
366 g_object_ref(G_OBJECT(multi_vpaned
->focused_pane
));
367 gtk_container_remove(GTK_CONTAINER(next
),(GtkWidget
*)multi_vpaned
->focused_pane
);
369 if(next
== multi_vpaned
->first_pane
){
370 multi_vpaned
->first_pane
= multi_vpaned
->focused_pane
;
371 gtk_container_remove(GTK_CONTAINER(multi_vpaned
->vbox
),(GtkWidget
*)next
);
372 gtk_box_pack_end(GTK_BOX(multi_vpaned
->vbox
),(GtkWidget
*)multi_vpaned
->focused_pane
,TRUE
,TRUE
,0);
374 nextNext
= (GtkPaned
*)gtk_widget_get_parent((GtkWidget
*)next
);
375 gtk_container_remove(GTK_CONTAINER(nextNext
),(GtkWidget
*)next
);
376 gtk_paned_pack1(nextNext
, (GtkWidget
*)multi_vpaned
->focused_pane
, FALSE
, TRUE
);
378 gtk_paned_pack1(multi_vpaned
->focused_pane
,(GtkWidget
*)next
, FALSE
,TRUE
);
380 gtk_paned_pack1(next
,(GtkWidget
*)prev
, FALSE
,TRUE
);
382 if(prev
)g_object_unref(G_OBJECT(prev
));
383 g_object_unref(G_OBJECT(next
));
384 g_object_unref(G_OBJECT(multi_vpaned
->focused_pane
));
387 void gtk_multi_vpaned_set_scroll_value(GtkMultiVPaned
* multi_vpaned
, double value
)
389 gtk_adjustment_set_value(multi_vpaned
->hadjust
, value
);
390 g_signal_stop_emission_by_name(G_OBJECT(multi_vpaned
->hscrollbar
), "value-changed");
393 void gtk_multi_vpaned_scroll_value_changed(GtkRange
*range
, gpointer multi_vpaned_arg
)
395 TimeWindow time_window
;
396 TimeInterval
*time_span
;
398 GtkMultiVPaned
* multi_vpaned
= (GtkMultiVPaned
*)multi_vpaned_arg
;
399 gdouble value
= gtk_range_get_value(range
);
400 gdouble upper
, lower
, ratio
;
402 time_window
= multi_vpaned
->mw
->current_tab
->time_window
;
404 time_span
= LTTV_TRACESET_CONTEXT(multi_vpaned
->mw
->current_tab
->traceset_info
->
405 traceset_context
)->Time_Span
;
406 lower
= multi_vpaned
->hadjust
->lower
;
407 upper
= multi_vpaned
->hadjust
->upper
;
408 ratio
= (value
- lower
) / (upper
- lower
);
410 time
= ltt_time_sub(time_span
->endTime
, time_span
->startTime
);
411 time
= ltt_time_mul(time
, (float)ratio
);
412 time
= ltt_time_add(time_span
->startTime
, time
);
414 time_window
.start_time
= time
;
416 time
= ltt_time_sub(time_span
->endTime
, time
);
417 if(ltt_time_compare(time
,time_window
.time_width
) < 0){
418 time_window
.time_width
= time
;
420 set_time_window(multi_vpaned
->mw
, &time_window
);
425 gtk_multi_vpaned_size_request (GtkWidget
*widget
,
426 GtkRequisition
*requisition
)
428 GtkPaned
*paned
= GTK_PANED (widget
);
429 GtkRequisition child_requisition
;
431 requisition
->width
= 0;
432 requisition
->height
= 0;
434 if (paned
->child1
&& GTK_WIDGET_VISIBLE (paned
->child1
))
436 gtk_widget_size_request (paned
->child1
, &child_requisition
);
438 requisition
->height
= child_requisition
.height
;
439 requisition
->width
= child_requisition
.width
;
442 if (paned
->child2
&& GTK_WIDGET_VISIBLE (paned
->child2
))
444 gtk_widget_size_request (paned
->child2
, &child_requisition
);
446 requisition
->width
= MAX (requisition
->width
, child_requisition
.width
);
447 requisition
->height
+= child_requisition
.height
;
450 requisition
->height
+= GTK_CONTAINER (paned
)->border_width
* 2;
451 requisition
->width
+= GTK_CONTAINER (paned
)->border_width
* 2;
453 if (paned
->child1
&& GTK_WIDGET_VISIBLE (paned
->child1
) &&
454 paned
->child2
&& GTK_WIDGET_VISIBLE (paned
->child2
))
458 gtk_widget_style_get (widget
, "handle_size", &handle_size
, NULL
);
459 requisition
->height
+= handle_size
;
465 gtk_multi_vpaned_size_allocate (GtkWidget
*widget
,
466 GtkAllocation
*allocation
)
468 GtkPaned
*paned
= GTK_PANED (widget
);
469 gint border_width
= GTK_CONTAINER (paned
)->border_width
;
471 widget
->allocation
= *allocation
;
473 if (paned
->child1
&& GTK_WIDGET_VISIBLE (paned
->child1
) &&
474 paned
->child2
&& GTK_WIDGET_VISIBLE (paned
->child2
))
476 GtkRequisition child1_requisition
;
477 GtkRequisition child2_requisition
;
478 GtkAllocation child1_allocation
;
479 GtkAllocation child2_allocation
;
482 gtk_widget_style_get (widget
, "handle_size", &handle_size
, NULL
);
484 gtk_widget_get_child_requisition (paned
->child1
, &child1_requisition
);
485 gtk_widget_get_child_requisition (paned
->child2
, &child2_requisition
);
487 gtk_paned_compute_position (paned
,
488 MAX (1, widget
->allocation
.height
491 child1_requisition
.height
,
492 child2_requisition
.height
);
494 paned
->handle_pos
.x
= widget
->allocation
.x
+ border_width
;
495 paned
->handle_pos
.y
= widget
->allocation
.y
+ paned
->child1_size
+ border_width
;
496 paned
->handle_pos
.width
= MAX (1, (gint
) widget
->allocation
.width
- 2 * border_width
);
497 paned
->handle_pos
.height
= handle_size
;
499 if (GTK_WIDGET_REALIZED (widget
))
501 if (GTK_WIDGET_MAPPED (widget
))
502 gdk_window_show (paned
->handle
);
503 gdk_window_move_resize (paned
->handle
,
506 paned
->handle_pos
.width
,
510 child1_allocation
.width
= child2_allocation
.width
= MAX (1, (gint
) allocation
->width
- border_width
* 2);
511 child1_allocation
.height
= MAX (1, paned
->child1_size
);
512 child1_allocation
.x
= child2_allocation
.x
= widget
->allocation
.x
+ border_width
;
513 child1_allocation
.y
= widget
->allocation
.y
+ border_width
;
515 child2_allocation
.y
= child1_allocation
.y
+ paned
->child1_size
+ paned
->handle_pos
.height
;
516 child2_allocation
.height
= MAX (1, widget
->allocation
.y
+ widget
->allocation
.height
- child2_allocation
.y
- border_width
);
518 if (GTK_WIDGET_MAPPED (widget
) &&
519 paned
->child1
->allocation
.height
< child1_allocation
.height
)
521 gtk_widget_size_allocate (paned
->child2
, &child2_allocation
);
522 gtk_widget_size_allocate (paned
->child1
, &child1_allocation
);
526 gtk_widget_size_allocate (paned
->child1
, &child1_allocation
);
527 gtk_widget_size_allocate (paned
->child2
, &child2_allocation
);
532 GtkAllocation child_allocation
;
534 if (GTK_WIDGET_REALIZED (widget
))
535 gdk_window_hide (paned
->handle
);
538 gtk_widget_set_child_visible (paned
->child1
, TRUE
);
540 gtk_widget_set_child_visible (paned
->child2
, TRUE
);
542 child_allocation
.x
= widget
->allocation
.x
+ border_width
;
543 child_allocation
.y
= widget
->allocation
.y
+ border_width
;
544 child_allocation
.width
= MAX (1, allocation
->width
- 2 * border_width
);
545 child_allocation
.height
= MAX (1, allocation
->height
- 2 * border_width
);
547 if (paned
->child1
&& GTK_WIDGET_VISIBLE (paned
->child1
))
548 gtk_widget_size_allocate (paned
->child1
, &child_allocation
);
549 else if (paned
->child2
&& GTK_WIDGET_VISIBLE (paned
->child2
))
550 gtk_widget_size_allocate (paned
->child2
, &child_allocation
);