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 <lttvgui/gtkmultivpaned.h>
22 //#include "gtkintl.h"
23 #include <lttvgui/mainwindow.h>
24 #include <lttvgui/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
);
37 gboolean
gtk_multi_vpaned_destroy(GtkObject
*object
,
40 GtkMultiVPaned
* multi_vpaned
= (GtkMultiVPaned
* )object
;
41 while(multi_vpaned
->num_children
){
42 gtk_multi_vpaned_widget_delete(multi_vpaned
);
48 gtk_multi_vpaned_get_type (void)
50 static GType multi_vpaned_type
= 0;
52 if (!multi_vpaned_type
)
54 static const GTypeInfo multi_vpaned_info
=
56 sizeof (GtkMultiVPanedClass
),
58 NULL
, /* base_finalize */
59 (GClassInitFunc
) gtk_multi_vpaned_class_init
,
60 NULL
, /* class_finalize */
61 NULL
, /* class_data */
62 sizeof (GtkMultiVPaned
),
64 (GInstanceInitFunc
) gtk_multi_vpaned_init
,
65 NULL
, /* value_table */
68 multi_vpaned_type
= g_type_register_static (GTK_TYPE_PANED
, "GtkMultiVPaned",
69 &multi_vpaned_info
, 0);
72 return multi_vpaned_type
;
76 gtk_multi_vpaned_class_init (GtkMultiVPanedClass
*class)
78 GtkWidgetClass
*widget_class
;
80 widget_class
= (GtkWidgetClass
*) class;
82 widget_class
->size_request
= gtk_multi_vpaned_size_request
;
83 widget_class
->size_allocate
= gtk_multi_vpaned_size_allocate
;
87 gtk_multi_vpaned_init (GtkMultiVPaned
* multi_vpaned
)
91 GTK_WIDGET_SET_FLAGS (multi_vpaned
, GTK_NO_WINDOW
);
92 gtk_widget_set_redraw_on_allocate (GTK_WIDGET (multi_vpaned
), FALSE
);
94 multi_vpaned
->first_pane
= NULL
;
95 multi_vpaned
->last_pane
= NULL
;
96 multi_vpaned
->focused_pane
= NULL
;
97 multi_vpaned
->iter
= NULL
;
98 multi_vpaned
->num_children
= 0;
100 multi_vpaned
->vbox
= NULL
;
101 // multi_vpaned->scrollWindow = NULL;
102 // multi_vpaned->viewport = NULL;
103 multi_vpaned
->hscrollbar
= NULL
;
107 GtkWidget
* gtk_multi_vpaned_new ()
109 GtkWidget
* widget
= GTK_WIDGET (g_object_new (gtk_multi_vpaned_get_type (), NULL
));
110 g_signal_connect(G_OBJECT(widget
), "destroy",
111 G_CALLBACK(gtk_multi_vpaned_destroy
),NULL
);
116 GtkWidget
* gtk_multi_vpaned_get_widget(GtkMultiVPaned
* multi_vpaned
)
118 if(multi_vpaned
->focused_pane
== NULL
)return NULL
;
119 return (GtkWidget
*)multi_vpaned
->focused_pane
->child2
;
122 GtkWidget
* gtk_multi_vpaned_get_first_widget(GtkMultiVPaned
* multi_vpaned
)
124 if(multi_vpaned
->first_pane
== NULL
)return NULL
;
125 multi_vpaned
->iter
= multi_vpaned
->first_pane
;
126 return multi_vpaned
->first_pane
->child2
;
129 GtkWidget
* gtk_multi_vpaned_get_next_widget(GtkMultiVPaned
* multi_vpaned
)
131 if(multi_vpaned
->iter
!= multi_vpaned
->last_pane
){
132 multi_vpaned
->iter
= (GtkPaned
*)multi_vpaned
->iter
->child1
;
133 return multi_vpaned
->iter
->child2
;
139 void gtk_multi_vpaned_set_data(GtkMultiVPaned
* multi_vpaned
,char * key
, gpointer value
)
141 g_object_set_data(G_OBJECT(multi_vpaned
->focused_pane
), key
, value
);
144 gpointer
gtk_multi_vpaned_get_data(GtkMultiVPaned
* multi_vpaned
,char * key
)
146 if(multi_vpaned
->focused_pane
== NULL
)return NULL
;
147 return g_object_get_data(G_OBJECT(multi_vpaned
->focused_pane
), key
);
150 void gtk_multi_vpaned_set_focus (GtkWidget
* widget
, gpointer user_data
)
152 GtkMultiVPaned
* multi_vpaned
= (GtkMultiVPaned
*) widget
;
154 if(!multi_vpaned
->first_pane
) return;
157 pane
= multi_vpaned
->first_pane
;
159 if((GtkWidget
*)pane
== (GtkWidget
*)user_data
){
160 multi_vpaned
->focused_pane
= pane
;
163 if(pane
== multi_vpaned
->last_pane
){
164 multi_vpaned
->focused_pane
= NULL
;
167 pane
= (GtkPaned
*)pane
->child1
;
171 void gtk_multi_vpaned_set_adjust(GtkMultiVPaned
* multi_vpaned
, gboolean first_time
)
173 TimeWindow time_window
;
174 TimeInterval
*time_span
;
178 get_time_window(multi_vpaned
->mw
,&time_window
);
180 time_span
= LTTV_TRACESET_CONTEXT(multi_vpaned
->mw
->current_tab
->traceset_info
->
181 traceset_context
)->Time_Span
;
183 multi_vpaned
->hadjust
->lower
= ltt_time_to_double(time_span
->startTime
) *
184 NANOSECONDS_PER_SECOND
;
185 multi_vpaned
->hadjust
->value
= multi_vpaned
->hadjust
->lower
;
186 multi_vpaned
->hadjust
->upper
= ltt_time_to_double(time_span
->endTime
) *
187 NANOSECONDS_PER_SECOND
;
190 /* Page increment of whole visible area */
191 if(multi_vpaned
->hadjust
== NULL
){
192 g_warning("Insert a viewer first");
196 start
= ltt_time_to_double(time_window
.start_time
) * NANOSECONDS_PER_SECOND
;
197 tmp
= multi_vpaned
->hadjust
->upper
- multi_vpaned
->hadjust
->lower
;
199 multi_vpaned
->hadjust
->page_increment
= ltt_time_to_double(
200 time_window
.time_width
) * NANOSECONDS_PER_SECOND
;
202 if(multi_vpaned
->hadjust
->page_increment
>= tmp
- range
)
203 multi_vpaned
->hadjust
->value
= multi_vpaned
->hadjust
->lower
;
204 if(start
+ multi_vpaned
->hadjust
->page_increment
>= multi_vpaned
->hadjust
->upper
- range
)
205 multi_vpaned
->hadjust
->value
= start
;
207 /* page_size to the whole visible area will take care that the
208 * scroll value + the shown area will never be more than what is
210 multi_vpaned
->hadjust
->page_size
= multi_vpaned
->hadjust
->page_increment
;
211 multi_vpaned
->hadjust
->step_increment
= multi_vpaned
->hadjust
->page_increment
/ 10;
213 gtk_adjustment_changed (multi_vpaned
->hadjust
);
216 void gtk_multi_vpaned_widget_add(GtkMultiVPaned
* multi_vpaned
, GtkWidget
* widget1
)
221 g_return_if_fail(GTK_IS_MULTI_VPANED(multi_vpaned
));
222 g_object_ref(G_OBJECT(widget1
));
225 if(!multi_vpaned
->first_pane
){
226 multi_vpaned
->first_pane
= (GtkPaned
*)gtk_vpaned_new();
227 multi_vpaned
->last_pane
= multi_vpaned
->first_pane
;
229 multi_vpaned
->hscrollbar
= gtk_hscrollbar_new (NULL
);
230 gtk_widget_show(multi_vpaned
->hscrollbar
);
232 multi_vpaned
->hadjust
= gtk_range_get_adjustment(GTK_RANGE(multi_vpaned
->hscrollbar
));
233 gtk_multi_vpaned_set_adjust(multi_vpaned
, TRUE
);
235 gtk_range_set_update_policy (GTK_RANGE(multi_vpaned
->hscrollbar
),
236 GTK_UPDATE_CONTINUOUS
);
237 //changed by Mathieu Desnoyers, was :
238 // GTK_UPDATE_DISCONTINUOUS);
239 g_signal_connect(G_OBJECT(multi_vpaned
->hscrollbar
), "value-changed",
240 G_CALLBACK(gtk_multi_vpaned_scroll_value_changed
), multi_vpaned
);
242 multi_vpaned
->vbox
= gtk_vbox_new(FALSE
,0);
243 gtk_widget_show(multi_vpaned
->vbox
);
245 // multi_vpaned->viewport = gtk_viewport_new (NULL,NULL);
246 // gtk_widget_show(multi_vpaned->viewport);
248 // gtk_container_add(GTK_CONTAINER(multi_vpaned->viewport), (GtkWidget*)multi_vpaned->vbox);
249 gtk_box_pack_end(GTK_BOX(multi_vpaned
->vbox
),(GtkWidget
*)multi_vpaned
->hscrollbar
,FALSE
,FALSE
,0);
250 gtk_box_pack_end(GTK_BOX(multi_vpaned
->vbox
),(GtkWidget
*)multi_vpaned
->first_pane
,TRUE
,TRUE
,0);
252 // multi_vpaned->scrollWindow = gtk_scrolled_window_new (NULL, NULL);
253 // gtk_widget_show(multi_vpaned->scrollWindow);
254 // gtk_container_add (GTK_CONTAINER (multi_vpaned->scrollWindow), (GtkWidget*)multi_vpaned->viewport);
255 // gtk_paned_pack1(GTK_PANED(multi_vpaned), (GtkWidget*)multi_vpaned->scrollWindow,FALSE, TRUE);
257 gtk_paned_pack1(GTK_PANED(multi_vpaned
), (GtkWidget
*)multi_vpaned
->vbox
,FALSE
, TRUE
);
259 tmpPane
= multi_vpaned
->last_pane
;
260 multi_vpaned
->last_pane
= (GtkPaned
*)gtk_vpaned_new();
261 gtk_paned_pack1 (tmpPane
,(GtkWidget
*)multi_vpaned
->last_pane
, FALSE
,TRUE
);
263 gtk_widget_show((GtkWidget
*)multi_vpaned
->last_pane
);
265 gtk_paned_pack2 (multi_vpaned
->last_pane
,widget1
, TRUE
, TRUE
);
266 multi_vpaned
->focused_pane
= multi_vpaned
->last_pane
;
267 multi_vpaned
->num_children
++;
271 void gtk_multi_vpaned_widget_delete(GtkMultiVPaned
* multi_vpaned
)
273 GtkPaned
* tmp
, *prev
, *next
;
275 if(!multi_vpaned
->focused_pane
) return;
277 tmp
= (GtkPaned
*)multi_vpaned
->focused_pane
->child2
; //widget in vpaned
278 g_object_unref(G_OBJECT(tmp
));
280 if(multi_vpaned
->focused_pane
== multi_vpaned
->first_pane
&&
281 multi_vpaned
->focused_pane
== multi_vpaned
->last_pane
){
282 // gtk_container_remove(GTK_CONTAINER(multi_vpaned),(GtkWidget*)multi_vpaned->scrollWindow);
283 gtk_container_remove(GTK_CONTAINER(multi_vpaned
),(GtkWidget
*)multi_vpaned
->vbox
);
284 multi_vpaned
->first_pane
= NULL
;
285 multi_vpaned
->last_pane
= NULL
;
286 multi_vpaned
->focused_pane
= NULL
;
287 }else if(multi_vpaned
->focused_pane
== multi_vpaned
->first_pane
&&
288 multi_vpaned
->focused_pane
!= multi_vpaned
->last_pane
){
289 next
= (GtkPaned
*)multi_vpaned
->first_pane
->child1
;
290 g_object_ref(G_OBJECT(next
));
291 gtk_container_remove(GTK_CONTAINER(multi_vpaned
->first_pane
),(GtkWidget
*)next
);
292 gtk_container_remove(GTK_CONTAINER(multi_vpaned
->vbox
),(GtkWidget
*)multi_vpaned
->first_pane
);
293 multi_vpaned
->first_pane
= next
;
294 gtk_box_pack_end(GTK_BOX(multi_vpaned
->vbox
),(GtkWidget
*)multi_vpaned
->first_pane
,TRUE
,TRUE
,0);
295 multi_vpaned
->focused_pane
= multi_vpaned
->first_pane
;
296 g_object_unref(G_OBJECT(next
));
297 }else if(multi_vpaned
->focused_pane
!= multi_vpaned
->first_pane
&&
298 multi_vpaned
->focused_pane
== multi_vpaned
->last_pane
){
299 tmp
= multi_vpaned
->last_pane
;
300 multi_vpaned
->last_pane
= (GtkPaned
*)gtk_widget_get_parent((GtkWidget
*)multi_vpaned
->last_pane
);
301 multi_vpaned
->focused_pane
= multi_vpaned
->last_pane
;
302 gtk_container_remove(GTK_CONTAINER(multi_vpaned
->last_pane
),(GtkWidget
*)tmp
);
304 tmp
= multi_vpaned
->focused_pane
;
305 prev
= (GtkPaned
*)gtk_widget_get_parent((GtkWidget
*)tmp
);
306 next
= (GtkPaned
*)tmp
->child1
;
307 g_object_ref(G_OBJECT(next
));
308 gtk_container_remove(GTK_CONTAINER(multi_vpaned
->focused_pane
),(GtkWidget
*)next
);
309 gtk_container_remove(GTK_CONTAINER(prev
),(GtkWidget
*)multi_vpaned
->focused_pane
);
310 gtk_paned_pack1(prev
, (GtkWidget
*)next
, FALSE
, TRUE
);
311 multi_vpaned
->focused_pane
= next
;
312 g_object_unref(G_OBJECT(next
));
315 multi_vpaned
->num_children
--;
319 void gtk_multi_vpaned_widget_move_up(GtkMultiVPaned
* multi_vpaned
)
321 GtkWidget
* upWidget
, *downWidget
;
322 GtkPaned
* prev
,*next
, *prevPrev
;
324 if(multi_vpaned
->last_pane
== multi_vpaned
->focused_pane
) return;
327 prev
= (GtkPaned
*)multi_vpaned
->focused_pane
->child1
;
328 g_object_ref(G_OBJECT(prev
));
329 gtk_container_remove(GTK_CONTAINER(multi_vpaned
->focused_pane
),(GtkWidget
*)prev
);
331 if(prev
== multi_vpaned
->last_pane
){
333 multi_vpaned
->last_pane
= multi_vpaned
->focused_pane
;
335 prevPrev
= (GtkPaned
*)prev
->child1
;
336 g_object_ref(G_OBJECT(prevPrev
));
337 gtk_container_remove(GTK_CONTAINER(prev
),(GtkWidget
*)prevPrev
);
340 g_object_ref(G_OBJECT(multi_vpaned
->focused_pane
));
341 if(multi_vpaned
->first_pane
== multi_vpaned
->focused_pane
){
342 gtk_container_remove(GTK_CONTAINER(multi_vpaned
->vbox
),(GtkWidget
*)multi_vpaned
->focused_pane
);
343 gtk_box_pack_end(GTK_BOX(multi_vpaned
->vbox
),(GtkWidget
*)prev
,TRUE
,TRUE
,0);
344 multi_vpaned
->first_pane
= prev
;
346 next
= (GtkPaned
*)gtk_widget_get_parent((GtkWidget
*)multi_vpaned
->focused_pane
);
347 gtk_container_remove(GTK_CONTAINER(next
),(GtkWidget
*)multi_vpaned
->focused_pane
);
348 gtk_paned_pack1(GTK_PANED(next
), (GtkWidget
*)prev
, FALSE
,TRUE
);
350 gtk_paned_pack1(GTK_PANED(prev
),(GtkWidget
*)multi_vpaned
->focused_pane
, FALSE
,TRUE
);
352 gtk_paned_pack1(GTK_PANED(multi_vpaned
->focused_pane
),(GtkWidget
*)prevPrev
, FALSE
,TRUE
);
354 g_object_unref(G_OBJECT(prev
));
355 if(prevPrev
) g_object_unref(G_OBJECT(prevPrev
));
356 g_object_unref(G_OBJECT(multi_vpaned
->focused_pane
));
360 void gtk_multi_vpaned_widget_move_down(GtkMultiVPaned
* multi_vpaned
)
362 GtkWidget
* upWidget
, *downWidget
;
363 GtkPaned
* prev
,*next
, *nextNext
;
365 if(multi_vpaned
->first_pane
== multi_vpaned
->focused_pane
) return;
368 next
= (GtkPaned
*)gtk_widget_get_parent((GtkWidget
*)multi_vpaned
->focused_pane
);
369 g_object_ref(G_OBJECT(next
));
371 if(multi_vpaned
->last_pane
== multi_vpaned
->focused_pane
){
373 multi_vpaned
->last_pane
= next
;
375 prev
= (GtkPaned
*)multi_vpaned
->focused_pane
->child1
;
376 g_object_ref(G_OBJECT(prev
));
377 gtk_container_remove(GTK_CONTAINER(multi_vpaned
->focused_pane
),(GtkWidget
*)prev
);
380 g_object_ref(G_OBJECT(multi_vpaned
->focused_pane
));
381 gtk_container_remove(GTK_CONTAINER(next
),(GtkWidget
*)multi_vpaned
->focused_pane
);
383 if(next
== multi_vpaned
->first_pane
){
384 multi_vpaned
->first_pane
= multi_vpaned
->focused_pane
;
385 gtk_container_remove(GTK_CONTAINER(multi_vpaned
->vbox
),(GtkWidget
*)next
);
386 gtk_box_pack_end(GTK_BOX(multi_vpaned
->vbox
),(GtkWidget
*)multi_vpaned
->focused_pane
,TRUE
,TRUE
,0);
388 nextNext
= (GtkPaned
*)gtk_widget_get_parent((GtkWidget
*)next
);
389 gtk_container_remove(GTK_CONTAINER(nextNext
),(GtkWidget
*)next
);
390 gtk_paned_pack1(nextNext
, (GtkWidget
*)multi_vpaned
->focused_pane
, FALSE
, TRUE
);
392 gtk_paned_pack1(multi_vpaned
->focused_pane
,(GtkWidget
*)next
, FALSE
,TRUE
);
394 gtk_paned_pack1(next
,(GtkWidget
*)prev
, FALSE
,TRUE
);
396 if(prev
)g_object_unref(G_OBJECT(prev
));
397 g_object_unref(G_OBJECT(next
));
398 g_object_unref(G_OBJECT(multi_vpaned
->focused_pane
));
401 void gtk_multi_vpaned_set_scroll_value(GtkMultiVPaned
* multi_vpaned
, double value
)
403 gtk_adjustment_set_value(multi_vpaned
->hadjust
, value
);
404 g_signal_stop_emission_by_name(G_OBJECT(multi_vpaned
->hscrollbar
), "value-changed");
407 void gtk_multi_vpaned_scroll_value_changed(GtkRange
*range
, gpointer multi_vpaned_arg
)
409 TimeWindow time_window
;
410 TimeInterval
*time_span
;
412 GtkMultiVPaned
* multi_vpaned
= (GtkMultiVPaned
*)multi_vpaned_arg
;
413 gdouble value
= gtk_range_get_value(range
);
414 gdouble upper
, lower
, ratio
;
416 time_window
= multi_vpaned
->mw
->current_tab
->time_window
;
418 time_span
= LTTV_TRACESET_CONTEXT(multi_vpaned
->mw
->current_tab
->traceset_info
->
419 traceset_context
)->Time_Span
;
420 lower
= multi_vpaned
->hadjust
->lower
;
421 upper
= multi_vpaned
->hadjust
->upper
;
422 ratio
= (value
- lower
) / (upper
- lower
);
424 time
= ltt_time_sub(time_span
->endTime
, time_span
->startTime
);
425 time
= ltt_time_mul(time
, (float)ratio
);
426 time
= ltt_time_add(time_span
->startTime
, time
);
428 time_window
.start_time
= time
;
430 time
= ltt_time_sub(time_span
->endTime
, time
);
431 if(ltt_time_compare(time
,time_window
.time_width
) < 0){
432 time_window
.time_width
= time
;
434 set_time_window(multi_vpaned
->mw
, &time_window
);
439 gtk_multi_vpaned_size_request (GtkWidget
*widget
,
440 GtkRequisition
*requisition
)
442 GtkPaned
*paned
= GTK_PANED (widget
);
443 GtkRequisition child_requisition
;
445 requisition
->width
= 0;
446 requisition
->height
= 0;
448 if (paned
->child1
&& GTK_WIDGET_VISIBLE (paned
->child1
))
450 gtk_widget_size_request (paned
->child1
, &child_requisition
);
452 requisition
->height
= child_requisition
.height
;
453 requisition
->width
= child_requisition
.width
;
456 if (paned
->child2
&& GTK_WIDGET_VISIBLE (paned
->child2
))
458 gtk_widget_size_request (paned
->child2
, &child_requisition
);
460 requisition
->width
= MAX (requisition
->width
, child_requisition
.width
);
461 requisition
->height
+= child_requisition
.height
;
464 requisition
->height
+= GTK_CONTAINER (paned
)->border_width
* 2;
465 requisition
->width
+= GTK_CONTAINER (paned
)->border_width
* 2;
467 if (paned
->child1
&& GTK_WIDGET_VISIBLE (paned
->child1
) &&
468 paned
->child2
&& GTK_WIDGET_VISIBLE (paned
->child2
))
472 gtk_widget_style_get (widget
, "handle_size", &handle_size
, NULL
);
473 requisition
->height
+= handle_size
;
479 gtk_multi_vpaned_size_allocate (GtkWidget
*widget
,
480 GtkAllocation
*allocation
)
482 GtkPaned
*paned
= GTK_PANED (widget
);
483 gint border_width
= GTK_CONTAINER (paned
)->border_width
;
485 widget
->allocation
= *allocation
;
487 if (paned
->child1
&& GTK_WIDGET_VISIBLE (paned
->child1
) &&
488 paned
->child2
&& GTK_WIDGET_VISIBLE (paned
->child2
))
490 GtkRequisition child1_requisition
;
491 GtkRequisition child2_requisition
;
492 GtkAllocation child1_allocation
;
493 GtkAllocation child2_allocation
;
496 gtk_widget_style_get (widget
, "handle_size", &handle_size
, NULL
);
498 gtk_widget_get_child_requisition (paned
->child1
, &child1_requisition
);
499 gtk_widget_get_child_requisition (paned
->child2
, &child2_requisition
);
501 gtk_paned_compute_position (paned
,
502 MAX (1, widget
->allocation
.height
505 child1_requisition
.height
,
506 child2_requisition
.height
);
508 paned
->handle_pos
.x
= widget
->allocation
.x
+ border_width
;
509 paned
->handle_pos
.y
= widget
->allocation
.y
+ paned
->child1_size
+ border_width
;
510 paned
->handle_pos
.width
= MAX (1, (gint
) widget
->allocation
.width
- 2 * border_width
);
511 paned
->handle_pos
.height
= handle_size
;
513 if (GTK_WIDGET_REALIZED (widget
))
515 if (GTK_WIDGET_MAPPED (widget
))
516 gdk_window_show (paned
->handle
);
517 gdk_window_move_resize (paned
->handle
,
520 paned
->handle_pos
.width
,
524 child1_allocation
.width
= child2_allocation
.width
= MAX (1, (gint
) allocation
->width
- border_width
* 2);
525 child1_allocation
.height
= MAX (1, paned
->child1_size
);
526 child1_allocation
.x
= child2_allocation
.x
= widget
->allocation
.x
+ border_width
;
527 child1_allocation
.y
= widget
->allocation
.y
+ border_width
;
529 child2_allocation
.y
= child1_allocation
.y
+ paned
->child1_size
+ paned
->handle_pos
.height
;
530 child2_allocation
.height
= MAX (1, widget
->allocation
.y
+ widget
->allocation
.height
- child2_allocation
.y
- border_width
);
532 if (GTK_WIDGET_MAPPED (widget
) &&
533 paned
->child1
->allocation
.height
< child1_allocation
.height
)
535 gtk_widget_size_allocate (paned
->child2
, &child2_allocation
);
536 gtk_widget_size_allocate (paned
->child1
, &child1_allocation
);
540 gtk_widget_size_allocate (paned
->child1
, &child1_allocation
);
541 gtk_widget_size_allocate (paned
->child2
, &child2_allocation
);
546 GtkAllocation child_allocation
;
548 if (GTK_WIDGET_REALIZED (widget
))
549 gdk_window_hide (paned
->handle
);
552 gtk_widget_set_child_visible (paned
->child1
, TRUE
);
554 gtk_widget_set_child_visible (paned
->child2
, TRUE
);
556 child_allocation
.x
= widget
->allocation
.x
+ border_width
;
557 child_allocation
.y
= widget
->allocation
.y
+ border_width
;
558 child_allocation
.width
= MAX (1, allocation
->width
- 2 * border_width
);
559 child_allocation
.height
= MAX (1, allocation
->height
- 2 * border_width
);
561 if (paned
->child1
&& GTK_WIDGET_VISIBLE (paned
->child1
))
562 gtk_widget_size_allocate (paned
->child1
, &child_allocation
);
563 else if (paned
->child2
&& GTK_WIDGET_VISIBLE (paned
->child2
))
564 gtk_widget_size_allocate (paned
->child2
, &child_allocation
);