git-svn-id: http://ltt.polymtl.ca/svn@486 04897980-b3bd-0310-b5e0-8ef037075253
[lttv.git] / ltt / branches / poly / lttv / modules / gui / main / src / gtkmultivpaned.c
CommitLineData
e076699e 1/* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 XangXiu Yang
3 *
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;
7 *
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.
12 *
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,
16 * MA 02111-1307, USA.
17 */
18
daecc161 19#include <gtk/gtk.h>
20
21#include <lttv/gtkmultivpaned.h>
22//#include "gtkintl.h"
637bd544 23#include <lttv/mainwindow.h>
cef97e7c 24#include <lttv/gtktraceset.h>
daecc161 25
26static void gtk_multi_vpaned_class_init (GtkMultiVPanedClass *klass);
27static void gtk_multi_vpaned_init (GtkMultiVPaned *multi_vpaned);
28
29
30static void gtk_multi_vpaned_size_request (GtkWidget *widget,
31 GtkRequisition *requisition);
32static void gtk_multi_vpaned_size_allocate (GtkWidget *widget,
33 GtkAllocation *allocation);
34
35void gtk_multi_vpaned_scroll_value_changed (GtkRange *range, gpointer multi_vpaned);
36
37GType
38gtk_multi_vpaned_get_type (void)
39{
40 static GType multi_vpaned_type = 0;
41
42 if (!multi_vpaned_type)
43 {
44 static const GTypeInfo multi_vpaned_info =
45 {
46 sizeof (GtkMultiVPanedClass),
47 NULL, /* base_init */
48 NULL, /* base_finalize */
49 (GClassInitFunc) gtk_multi_vpaned_class_init,
50 NULL, /* class_finalize */
51 NULL, /* class_data */
52 sizeof (GtkMultiVPaned),
53 0, /* n_preallocs */
54 (GInstanceInitFunc) gtk_multi_vpaned_init,
55 NULL, /* value_table */
56 };
57
58 multi_vpaned_type = g_type_register_static (GTK_TYPE_PANED, "GtkMultiVPaned",
59 &multi_vpaned_info, 0);
60 }
61
62 return multi_vpaned_type;
63}
64
65static void
66gtk_multi_vpaned_class_init (GtkMultiVPanedClass *class)
67{
68 GtkWidgetClass *widget_class;
69
70 widget_class = (GtkWidgetClass *) class;
71
72 widget_class->size_request = gtk_multi_vpaned_size_request;
73 widget_class->size_allocate = gtk_multi_vpaned_size_allocate;
74}
75
76static void
77gtk_multi_vpaned_init (GtkMultiVPaned * multi_vpaned)
78{
79 GtkWidget * button;
80
81 GTK_WIDGET_SET_FLAGS (multi_vpaned, GTK_NO_WINDOW);
82 gtk_widget_set_redraw_on_allocate (GTK_WIDGET (multi_vpaned), FALSE);
83
84 multi_vpaned->first_pane = NULL;
85 multi_vpaned->last_pane = NULL;
86 multi_vpaned->focused_pane = NULL;
49bf71b5 87 multi_vpaned->iter = NULL;
daecc161 88 multi_vpaned->num_children = 0;
89
90 multi_vpaned->vbox = NULL;
91 // multi_vpaned->scrollWindow = NULL;
92 // multi_vpaned->viewport = NULL;
93 multi_vpaned->hscrollbar = NULL;
94}
95
96
97GtkWidget* gtk_multi_vpaned_new ()
98{
99 return GTK_WIDGET (g_object_new (gtk_multi_vpaned_get_type (), NULL));
100}
101
49bf71b5 102GtkWidget * gtk_multi_vpaned_get_widget(GtkMultiVPaned * multi_vpaned)
103{
104 if(multi_vpaned->focused_pane == NULL)return NULL;
105 return (GtkWidget*)multi_vpaned->focused_pane->child2;
106}
107
108GtkWidget * gtk_multi_vpaned_get_first_widget(GtkMultiVPaned * multi_vpaned)
109{
110 if(multi_vpaned->first_pane == NULL)return NULL;
111 multi_vpaned->iter = multi_vpaned->first_pane;
112 return multi_vpaned->first_pane->child2;
113}
114
115GtkWidget * gtk_multi_vpaned_get_next_widget(GtkMultiVPaned * multi_vpaned)
116{
117 if(multi_vpaned->iter != multi_vpaned->last_pane){
118 multi_vpaned->iter = (GtkPaned *)multi_vpaned->iter->child1;
119 return multi_vpaned->iter->child2;
120 }else {
121 return NULL;
122 }
123}
124
125void gtk_multi_vpaned_set_data(GtkMultiVPaned * multi_vpaned,char * key, gpointer value)
126{
127 g_object_set_data(G_OBJECT(multi_vpaned->focused_pane), key, value);
128}
129
130gpointer gtk_multi_vpaned_get_data(GtkMultiVPaned * multi_vpaned,char * key)
131{
132 if(multi_vpaned->focused_pane == NULL)return NULL;
133 return g_object_get_data(G_OBJECT(multi_vpaned->focused_pane), key);
134}
daecc161 135
136void gtk_multi_vpaned_set_focus (GtkWidget * widget, gpointer user_data)
137{
138 GtkMultiVPaned * multi_vpaned = (GtkMultiVPaned*) widget;
139 GtkPaned * pane;
140 if(!multi_vpaned->first_pane) return;
141
142
143 pane = multi_vpaned->first_pane;
144 while(1){
145 if((GtkWidget*)pane == (GtkWidget*)user_data){
146 multi_vpaned->focused_pane = pane;
147 break;
148 }
149 if(pane == multi_vpaned->last_pane){
150 multi_vpaned->focused_pane = NULL;
151 break;
152 }
153 pane = (GtkPaned*)pane->child1;
154 }
155}
156
157void gtk_multi_vpaned_set_adjust(GtkMultiVPaned * multi_vpaned, gboolean first_time)
158{
159 TimeWindow time_window;
160 TimeInterval *time_span;
161 double tmp, start;
162 double range = 0;
163
164 get_time_window(multi_vpaned->mw,&time_window);
165 if(first_time){
166 time_span = LTTV_TRACESET_CONTEXT(multi_vpaned->mw->current_tab->traceset_info->
167 traceset_context)->Time_Span ;
168
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;
174 }
175
176 /* Page increment of whole visible area */
177 if(multi_vpaned->hadjust == NULL){
178 g_warning("Insert a viewer first");
179 return;
180 }
181
182 start = ltt_time_to_double(time_window.start_time) * NANOSECONDS_PER_SECOND;
183 tmp = multi_vpaned->hadjust->upper - multi_vpaned->hadjust->lower;
184
185 multi_vpaned->hadjust->page_increment = ltt_time_to_double(
186 time_window.time_width) * NANOSECONDS_PER_SECOND;
187
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;
192
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
195 * in the trace. */
196 multi_vpaned->hadjust->page_size = multi_vpaned->hadjust->page_increment;
197 multi_vpaned->hadjust->step_increment = multi_vpaned->hadjust->page_increment / 10;
198
199 gtk_adjustment_changed (multi_vpaned->hadjust);
200}
201
202void gtk_multi_vpaned_widget_add(GtkMultiVPaned * multi_vpaned, GtkWidget * widget1)
203{
204 GtkPaned * tmpPane;
205 GtkWidget * w;
206
207 g_return_if_fail(GTK_IS_MULTI_VPANED(multi_vpaned));
208 g_object_ref(G_OBJECT(widget1));
209
210
211 if(!multi_vpaned->first_pane){
212 multi_vpaned->first_pane = (GtkPaned *)gtk_vpaned_new();
213 multi_vpaned->last_pane = multi_vpaned->first_pane;
214
215 multi_vpaned->hscrollbar = gtk_hscrollbar_new (NULL);
216 gtk_widget_show(multi_vpaned->hscrollbar);
217
218 multi_vpaned->hadjust = gtk_range_get_adjustment(GTK_RANGE(multi_vpaned->hscrollbar));
219 gtk_multi_vpaned_set_adjust(multi_vpaned, TRUE);
220
221 gtk_range_set_update_policy (GTK_RANGE(multi_vpaned->hscrollbar),
4a93bd36 222 GTK_UPDATE_CONTINUOUS);
223 //changed by Mathieu Desnoyers, was :
224 // GTK_UPDATE_DISCONTINUOUS);
daecc161 225 g_signal_connect(G_OBJECT(multi_vpaned->hscrollbar), "value-changed",
226 G_CALLBACK(gtk_multi_vpaned_scroll_value_changed), multi_vpaned);
227
228 multi_vpaned->vbox = gtk_vbox_new(FALSE,0);
229 gtk_widget_show(multi_vpaned->vbox);
230
231 // multi_vpaned->viewport = gtk_viewport_new (NULL,NULL);
232 // gtk_widget_show(multi_vpaned->viewport);
233
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);
237
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);
242
243 gtk_paned_pack1(GTK_PANED(multi_vpaned), (GtkWidget*)multi_vpaned->vbox,FALSE, TRUE);
244 }else{
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);
248 }
249 gtk_widget_show((GtkWidget *)multi_vpaned->last_pane);
250
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++;
254
255}
256
257void gtk_multi_vpaned_widget_delete(GtkMultiVPaned * multi_vpaned)
258{
259 GtkPaned * tmp, *prev, *next;
260
261 if(!multi_vpaned->focused_pane) return;
262
263 tmp = (GtkPaned*)multi_vpaned->focused_pane->child2; //widget in vpaned
264 g_object_unref(G_OBJECT(tmp));
265
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);
289 }else{
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));
299 }
300
301 multi_vpaned->num_children--;
302}
303
304
305void gtk_multi_vpaned_widget_move_up(GtkMultiVPaned * multi_vpaned)
306{
307 GtkWidget* upWidget, *downWidget;
308 GtkPaned * prev,*next, *prevPrev;
309
310 if(multi_vpaned->last_pane == multi_vpaned->focused_pane) return;
311
312 // move VPane
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);
316
317 if(prev == multi_vpaned->last_pane){
318 prevPrev = NULL;
319 multi_vpaned->last_pane = multi_vpaned->focused_pane;
320 }else{
321 prevPrev = (GtkPaned*)prev->child1;
322 g_object_ref(G_OBJECT(prevPrev));
323 gtk_container_remove(GTK_CONTAINER(prev),(GtkWidget*)prevPrev);
324 }
325
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;
331 }else{
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);
335 }
336 gtk_paned_pack1(GTK_PANED(prev),(GtkWidget*)multi_vpaned->focused_pane, FALSE,TRUE);
337 if(prevPrev)
338 gtk_paned_pack1(GTK_PANED(multi_vpaned->focused_pane),(GtkWidget*)prevPrev, FALSE,TRUE);
339
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));
343}
344
345
346void gtk_multi_vpaned_widget_move_down(GtkMultiVPaned * multi_vpaned)
347{
348 GtkWidget* upWidget, *downWidget;
349 GtkPaned * prev,*next, *nextNext;
350
351 if(multi_vpaned->first_pane == multi_vpaned->focused_pane) return;
352
353 //move VPane
354 next = (GtkPaned*)gtk_widget_get_parent((GtkWidget*)multi_vpaned->focused_pane);
355 g_object_ref(G_OBJECT(next));
356
357 if(multi_vpaned->last_pane == multi_vpaned->focused_pane){
358 prev = NULL;
359 multi_vpaned->last_pane = next;
360 }else{
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);
364 }
365
366 g_object_ref(G_OBJECT(multi_vpaned->focused_pane));
367 gtk_container_remove(GTK_CONTAINER(next),(GtkWidget*)multi_vpaned->focused_pane);
368
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);
373 }else{
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);
377 }
378 gtk_paned_pack1(multi_vpaned->focused_pane,(GtkWidget*)next, FALSE,TRUE);
379 if(prev)
380 gtk_paned_pack1(next,(GtkWidget*)prev, FALSE,TRUE);
381
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));
385}
386
bca085a1 387void gtk_multi_vpaned_set_scroll_value(GtkMultiVPaned * multi_vpaned, double value)
388{
389 gtk_adjustment_set_value(multi_vpaned->hadjust, value);
390 g_signal_stop_emission_by_name(G_OBJECT(multi_vpaned->hscrollbar), "value-changed");
391}
392
daecc161 393void gtk_multi_vpaned_scroll_value_changed(GtkRange *range, gpointer multi_vpaned_arg)
394{
58eecf4a 395 TimeWindow time_window;
396 TimeInterval *time_span;
daecc161 397 LttTime time;
398 GtkMultiVPaned * multi_vpaned = (GtkMultiVPaned*)multi_vpaned_arg;
399 gdouble value = gtk_range_get_value(range);
58eecf4a 400 gdouble upper, lower, ratio;
401
402 time_window = multi_vpaned->mw->current_tab->time_window;
403
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);
409
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);
413
414 time_window.start_time = time;
415
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;
419 }
420 set_time_window(multi_vpaned->mw, &time_window);
daecc161 421}
422
423
424static void
425gtk_multi_vpaned_size_request (GtkWidget *widget,
426 GtkRequisition *requisition)
427{
428 GtkPaned *paned = GTK_PANED (widget);
429 GtkRequisition child_requisition;
430
431 requisition->width = 0;
432 requisition->height = 0;
433
434 if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1))
435 {
436 gtk_widget_size_request (paned->child1, &child_requisition);
437
438 requisition->height = child_requisition.height;
439 requisition->width = child_requisition.width;
440 }
441
442 if (paned->child2 && GTK_WIDGET_VISIBLE (paned->child2))
443 {
444 gtk_widget_size_request (paned->child2, &child_requisition);
445
446 requisition->width = MAX (requisition->width, child_requisition.width);
447 requisition->height += child_requisition.height;
448 }
449
450 requisition->height += GTK_CONTAINER (paned)->border_width * 2;
451 requisition->width += GTK_CONTAINER (paned)->border_width * 2;
452
453 if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1) &&
454 paned->child2 && GTK_WIDGET_VISIBLE (paned->child2))
455 {
456 gint handle_size;
457
458 gtk_widget_style_get (widget, "handle_size", &handle_size, NULL);
459 requisition->height += handle_size;
460 }
461
462}
463
464static void
465gtk_multi_vpaned_size_allocate (GtkWidget *widget,
466 GtkAllocation *allocation)
467{
468 GtkPaned *paned = GTK_PANED (widget);
469 gint border_width = GTK_CONTAINER (paned)->border_width;
470
471 widget->allocation = *allocation;
472
473 if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1) &&
474 paned->child2 && GTK_WIDGET_VISIBLE (paned->child2))
475 {
476 GtkRequisition child1_requisition;
477 GtkRequisition child2_requisition;
478 GtkAllocation child1_allocation;
479 GtkAllocation child2_allocation;
480 gint handle_size;
481
482 gtk_widget_style_get (widget, "handle_size", &handle_size, NULL);
483
484 gtk_widget_get_child_requisition (paned->child1, &child1_requisition);
485 gtk_widget_get_child_requisition (paned->child2, &child2_requisition);
486
487 gtk_paned_compute_position (paned,
488 MAX (1, widget->allocation.height
489 - handle_size
490 - 2 * border_width),
491 child1_requisition.height,
492 child2_requisition.height);
493
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;
498
499 if (GTK_WIDGET_REALIZED (widget))
500 {
501 if (GTK_WIDGET_MAPPED (widget))
502 gdk_window_show (paned->handle);
503 gdk_window_move_resize (paned->handle,
504 paned->handle_pos.x,
505 paned->handle_pos.y,
506 paned->handle_pos.width,
507 handle_size);
508 }
509
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;
514
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);
517
518 if (GTK_WIDGET_MAPPED (widget) &&
519 paned->child1->allocation.height < child1_allocation.height)
520 {
521 gtk_widget_size_allocate (paned->child2, &child2_allocation);
522 gtk_widget_size_allocate (paned->child1, &child1_allocation);
523 }
524 else
525 {
526 gtk_widget_size_allocate (paned->child1, &child1_allocation);
527 gtk_widget_size_allocate (paned->child2, &child2_allocation);
528 }
529 }
530 else
531 {
532 GtkAllocation child_allocation;
533
534 if (GTK_WIDGET_REALIZED (widget))
535 gdk_window_hide (paned->handle);
536
537 if (paned->child1)
538 gtk_widget_set_child_visible (paned->child1, TRUE);
539 if (paned->child2)
540 gtk_widget_set_child_visible (paned->child2, TRUE);
541
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);
546
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);
551 }
552}
553
This page took 0.043317 seconds and 4 git commands to generate.