Thu, 29 Aug 2002 01:47:15 +0000
[gaim-migrate @ 3516]
some patches from some people.
| 3391 | 1 | /* GTK - The GIMP Toolkit |
| 2 | * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald | |
| 3 | * | |
| 4 | * This library is free software; you can redistribute it and/or | |
| 5 | * modify it under the terms of the GNU Library General Public | |
| 6 | * License as published by the Free Software Foundation; either | |
| 7 | * version 2 of the License, or (at your option) any later version. | |
| 8 | * | |
| 9 | * This library is distributed in the hope that it will be useful, | |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | * Library General Public License for more details. | |
| 13 | * | |
| 14 | * You should have received a copy of the GNU Library General Public | |
| 15 | * License along with this library; if not, write to the | |
| 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
| 17 | * Boston, MA 02111-1307, USA. | |
| 18 | */ | |
| 19 | ||
| 20 | /* | |
| 21 | * GtkTicker Copyright 2000 Syd Logan | |
| 22 | */ | |
| 23 | ||
| 24 | #include "gtkticker.h" | |
| 25 | #include <gtk/gtk.h> | |
| 26 | ||
| 27 | static void gtk_ticker_compute_offsets (GtkTicker *ticker); | |
| 28 | static void gtk_ticker_class_init (GtkTickerClass *klass); | |
| 29 | static void gtk_ticker_init (GtkTicker *ticker); | |
| 30 | static void gtk_ticker_map (GtkWidget *widget); | |
| 31 | static void gtk_ticker_realize (GtkWidget *widget); | |
| 32 | static void gtk_ticker_size_request (GtkWidget *widget, | |
| 33 | GtkRequisition *requisition); | |
| 34 | static void gtk_ticker_size_allocate (GtkWidget *widget, | |
| 35 | GtkAllocation *allocation); | |
| 36 | static gint gtk_ticker_expose (GtkWidget *widget, | |
| 37 | GdkEventExpose *event); | |
| 38 | static void gtk_ticker_add_real (GtkContainer *container, | |
| 39 | GtkWidget *widget); | |
| 40 | static void gtk_ticker_remove_real (GtkContainer *container, | |
| 41 | GtkWidget *widget); | |
| 42 | static void gtk_ticker_forall (GtkContainer *container, | |
| 43 | gboolean include_internals, | |
| 44 | GtkCallback callback, | |
| 45 | gpointer callback_data); | |
| 46 | static GtkType gtk_ticker_child_type (GtkContainer *container); | |
| 47 | ||
| 48 | ||
| 49 | static GtkContainerClass *parent_class = NULL; | |
| 50 | ||
| 51 | ||
| 52 | GtkType | |
| 53 | gtk_ticker_get_type (void) | |
| 54 | { | |
| 55 | static GtkType ticker_type = 0; | |
| 56 | ||
| 57 | if (!ticker_type) | |
| 58 | { | |
| 59 | static const GtkTypeInfo ticker_info = | |
| 60 | { | |
| 61 | "GtkTicker", | |
| 62 | sizeof (GtkTicker), | |
| 63 | sizeof (GtkTickerClass), | |
| 64 | (GtkClassInitFunc) gtk_ticker_class_init, | |
| 65 | (GtkObjectInitFunc) gtk_ticker_init, | |
| 66 | /* reserved_1 */ NULL, | |
| 67 | /* reserved_2 */ NULL, | |
| 68 | (GtkClassInitFunc) NULL, | |
| 69 | }; | |
| 70 | ||
| 71 | ticker_type = gtk_type_unique (GTK_TYPE_CONTAINER, &ticker_info); | |
| 72 | } | |
| 73 | ||
| 74 | return ticker_type; | |
| 75 | } | |
| 76 | ||
| 77 | static void | |
| 78 | gtk_ticker_class_init (GtkTickerClass *class) | |
| 79 | { | |
| 80 | GtkObjectClass *object_class; | |
| 81 | GtkWidgetClass *widget_class; | |
| 82 | GtkContainerClass *container_class; | |
| 83 | ||
| 84 | object_class = (GtkObjectClass*) class; | |
| 85 | widget_class = (GtkWidgetClass*) class; | |
| 86 | container_class = (GtkContainerClass*) class; | |
| 87 | ||
| 88 | parent_class = gtk_type_class (GTK_TYPE_CONTAINER); | |
| 89 | ||
| 90 | widget_class->map = gtk_ticker_map; | |
| 91 | widget_class->realize = gtk_ticker_realize; | |
| 92 | widget_class->size_request = gtk_ticker_size_request; | |
| 93 | widget_class->size_allocate = gtk_ticker_size_allocate; | |
| 94 | widget_class->expose_event = gtk_ticker_expose; | |
| 95 | ||
| 96 | container_class->add = gtk_ticker_add_real; | |
| 97 | container_class->remove = gtk_ticker_remove_real; | |
| 98 | container_class->forall = gtk_ticker_forall; | |
| 99 | container_class->child_type = gtk_ticker_child_type; | |
| 100 | } | |
| 101 | ||
| 102 | static GtkType | |
| 103 | gtk_ticker_child_type (GtkContainer *container) | |
| 104 | { | |
| 105 | return GTK_TYPE_WIDGET; | |
| 106 | } | |
| 107 | ||
| 108 | static void | |
| 109 | gtk_ticker_init (GtkTicker *ticker) | |
| 110 | { | |
| 111 | GTK_WIDGET_UNSET_FLAGS (ticker, GTK_NO_WINDOW); | |
| 112 | ||
| 113 | ticker->interval = (guint) 200; | |
| 114 | ticker->scootch = (guint) 2; | |
| 115 | ticker->children = NULL; | |
| 116 | ticker->timer = 0; | |
| 117 | ticker->dirty = TRUE; | |
| 118 | } | |
| 119 | ||
| 120 | GtkWidget* | |
| 121 | gtk_ticker_new (void) | |
| 122 | { | |
| 123 | GtkTicker *ticker; | |
| 124 | ||
| 125 | ticker = gtk_type_new (GTK_TYPE_TICKER); | |
| 126 | return GTK_WIDGET (ticker); | |
| 127 | } | |
| 128 | ||
| 129 | static void | |
| 130 | gtk_ticker_put (GtkTicker *ticker, | |
| 131 | GtkWidget *widget) | |
| 132 | { | |
| 133 | GtkTickerChild *child_info; | |
| 134 | ||
| 135 | g_return_if_fail (ticker != NULL); | |
| 136 | g_return_if_fail (GTK_IS_TICKER (ticker)); | |
| 137 | g_return_if_fail (widget != NULL); | |
| 138 | ||
| 139 | child_info = g_new(GtkTickerChild, 1); | |
| 140 | child_info->widget = widget; | |
| 141 | child_info->x = 0; | |
| 142 | ||
| 143 | gtk_widget_set_parent(widget, GTK_WIDGET (ticker)); | |
| 144 | ||
| 145 | ticker->children = g_list_append (ticker->children, child_info); | |
| 146 | ||
| 147 | if (GTK_WIDGET_REALIZED (ticker)) | |
| 148 | gtk_widget_realize (widget); | |
| 149 | ||
| 150 | if (GTK_WIDGET_VISIBLE (ticker) && GTK_WIDGET_VISIBLE (widget)) | |
| 151 | { | |
| 152 | if (GTK_WIDGET_MAPPED (ticker)) | |
| 153 | gtk_widget_map (widget); | |
| 154 | ||
| 155 | gtk_widget_queue_resize (GTK_WIDGET (ticker)); | |
| 156 | } | |
| 157 | } | |
| 158 | ||
| 159 | void | |
| 160 | gtk_ticker_set_interval (GtkTicker *ticker, gint interval ) | |
| 161 | { | |
| 162 | g_return_if_fail (ticker != NULL); | |
| 163 | g_return_if_fail (GTK_IS_TICKER (ticker)); | |
| 164 | ||
| 165 | if ( interval < 0 ) | |
| 166 | interval = 200; | |
| 167 | ticker->interval = interval; | |
| 168 | ||
| 169 | } | |
| 170 | ||
| 171 | guint | |
| 172 | gtk_ticker_get_interval (GtkTicker *ticker ) | |
| 173 | { | |
| 174 | g_return_val_if_fail (ticker != NULL, -1); | |
| 175 | g_return_val_if_fail (GTK_IS_TICKER (ticker), -1); | |
| 176 | ||
| 177 | return ticker->interval; | |
| 178 | } | |
| 179 | ||
| 180 | void | |
| 181 | gtk_ticker_set_scootch (GtkTicker *ticker, gint scootch ) | |
| 182 | { | |
| 183 | g_return_if_fail (ticker != NULL); | |
| 184 | g_return_if_fail (GTK_IS_TICKER (ticker)); | |
| 185 | ||
| 186 | if ( scootch <= 0 ) | |
| 187 | scootch = 2; | |
| 188 | ticker->scootch = scootch; | |
| 189 | ticker->dirty = TRUE; | |
| 190 | } | |
| 191 | ||
| 192 | guint | |
| 193 | gtk_ticker_get_scootch (GtkTicker *ticker ) | |
| 194 | { | |
| 195 | g_return_val_if_fail (ticker != NULL, -1); | |
| 196 | g_return_val_if_fail (GTK_IS_TICKER (ticker), -1); | |
| 197 | ||
| 198 | return ticker->scootch; | |
| 199 | } | |
| 200 | ||
| 201 | void | |
| 202 | gtk_ticker_set_spacing (GtkTicker *ticker, gint spacing ) | |
| 203 | { | |
| 204 | g_return_if_fail (ticker != NULL); | |
| 205 | g_return_if_fail (GTK_IS_TICKER (ticker)); | |
| 206 | ||
| 207 | if ( spacing < 0 ) | |
| 208 | spacing = 0; | |
| 209 | ticker->spacing = spacing; | |
| 210 | ticker->dirty = TRUE; | |
| 211 | ||
| 212 | } | |
| 213 | ||
| 214 | static int | |
| 215 | ticker_timeout( gpointer data ) | |
| 216 | { | |
| 217 | GtkTicker *ticker = (GtkTicker *) data; | |
| 218 | ||
| 219 | if (GTK_WIDGET_VISIBLE (ticker)) | |
| 220 | gtk_widget_queue_resize (GTK_WIDGET (ticker)); | |
| 221 | ||
| 222 | return( TRUE ); | |
| 223 | } | |
| 224 | ||
| 225 | void | |
| 226 | gtk_ticker_start_scroll(GtkTicker *ticker) | |
| 227 | { | |
| 228 | g_return_if_fail (ticker != NULL); | |
| 229 | g_return_if_fail (GTK_IS_TICKER (ticker)); | |
| 230 | if ( ticker->timer != 0 ) | |
| 231 | return; | |
| 232 | ticker->timer = gtk_timeout_add(ticker->interval, | |
| 233 | ticker_timeout, ticker); | |
| 234 | } | |
| 235 | ||
| 236 | void | |
| 237 | gtk_ticker_stop_scroll(GtkTicker *ticker) | |
| 238 | { | |
| 239 | g_return_if_fail (ticker != NULL); | |
| 240 | g_return_if_fail (GTK_IS_TICKER (ticker)); | |
| 241 | if ( ticker->timer == 0 ) | |
| 242 | return; | |
| 243 | gtk_timeout_remove( ticker->timer ); | |
| 244 | ticker->timer = 0; | |
| 245 | ||
| 246 | } | |
| 247 | ||
| 248 | guint | |
| 249 | gtk_ticker_get_spacing (GtkTicker *ticker ) | |
| 250 | { | |
| 251 | g_return_val_if_fail (ticker != NULL, -1); | |
| 252 | g_return_val_if_fail (GTK_IS_TICKER (ticker), -1); | |
| 253 | ||
| 254 | return ticker->spacing; | |
| 255 | } | |
| 256 | ||
| 257 | static void | |
| 258 | gtk_ticker_map (GtkWidget *widget) | |
| 259 | { | |
| 260 | GtkTicker *ticker; | |
| 261 | GtkTickerChild *child; | |
| 262 | GList *children; | |
| 263 | ||
| 264 | g_return_if_fail (widget != NULL); | |
| 265 | g_return_if_fail (GTK_IS_TICKER (widget)); | |
| 266 | ||
| 267 | GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED); | |
| 268 | ticker = GTK_TICKER (widget); | |
| 269 | ||
| 270 | children = ticker->children; | |
| 271 | while (children) | |
| 272 | { | |
| 273 | child = children->data; | |
| 274 | children = children->next; | |
| 275 | ||
| 276 | if (GTK_WIDGET_VISIBLE (child->widget) && | |
| 277 | !GTK_WIDGET_MAPPED (child->widget)) | |
| 278 | gtk_widget_map (child->widget); | |
| 279 | } | |
| 280 | ||
| 281 | gdk_window_show (widget->window); | |
| 282 | } | |
| 283 | ||
| 284 | static void | |
| 285 | gtk_ticker_realize (GtkWidget *widget) | |
| 286 | { | |
| 287 | GdkWindowAttr attributes; | |
| 288 | gint attributes_mask; | |
| 289 | ||
| 290 | g_return_if_fail (widget != NULL); | |
| 291 | g_return_if_fail (GTK_IS_TICKER (widget)); | |
| 292 | ||
| 293 | GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); | |
| 294 | ||
| 295 | attributes.window_type = GDK_WINDOW_CHILD; | |
| 296 | attributes.x = widget->allocation.x; | |
| 297 | attributes.y = widget->allocation.y; | |
| 298 | attributes.width = widget->allocation.width; | |
| 299 | attributes.height = widget->allocation.height; | |
| 300 | attributes.wclass = GDK_INPUT_OUTPUT; | |
| 301 | attributes.visual = gtk_widget_get_visual (widget); | |
| 302 | attributes.colormap = gtk_widget_get_colormap (widget); | |
| 303 | attributes.event_mask = gtk_widget_get_events (widget); | |
| 304 | attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK; | |
| 305 | ||
| 306 | attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; | |
| 307 | ||
| 308 | widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), | |
| 309 | &attributes, attributes_mask); | |
| 310 | gdk_window_set_user_data (widget->window, widget); | |
| 311 | ||
| 312 | widget->style = gtk_style_attach (widget->style, widget->window); | |
| 313 | gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); | |
| 314 | } | |
| 315 | ||
| 316 | static void | |
| 317 | gtk_ticker_size_request (GtkWidget *widget, | |
| 318 | GtkRequisition *requisition) | |
| 319 | { | |
| 320 | GtkTicker *ticker; | |
| 321 | GtkTickerChild *child; | |
| 322 | GList *children; | |
| 323 | GtkRequisition child_requisition; | |
| 324 | ||
| 325 | g_return_if_fail (widget != NULL); | |
| 326 | g_return_if_fail (GTK_IS_TICKER (widget)); | |
| 327 | g_return_if_fail (requisition != NULL); | |
| 328 | ||
| 329 | ticker = GTK_TICKER (widget); | |
| 330 | requisition->width = 0; | |
| 331 | requisition->height = 0; | |
| 332 | ||
| 333 | children = ticker->children; | |
| 334 | while (children) | |
| 335 | { | |
| 336 | child = children->data; | |
| 337 | children = children->next; | |
| 338 | ||
| 339 | if (GTK_WIDGET_VISIBLE (child->widget)) | |
| 340 | { | |
| 341 | gtk_widget_size_request (child->widget, &child_requisition); | |
| 342 | ||
| 343 | requisition->height = MAX (requisition->height, | |
| 344 | child_requisition.height); | |
| 345 | requisition->width += child_requisition.width + ticker->spacing; | |
| 346 | } | |
| 347 | } | |
| 348 | if ( requisition->width > ticker->spacing ) | |
| 349 | requisition->width -= ticker->spacing; | |
| 350 | ||
| 351 | requisition->height += GTK_CONTAINER (ticker)->border_width * 2; | |
| 352 | requisition->width += GTK_CONTAINER (ticker)->border_width * 2; | |
| 353 | } | |
| 354 | ||
| 355 | static void | |
| 356 | gtk_ticker_compute_offsets (GtkTicker *ticker) | |
| 357 | { | |
| 358 | GtkTickerChild *child; | |
| 359 | GtkRequisition child_requisition; | |
| 360 | GList *children; | |
| 361 | guint16 border_width; | |
| 362 | ||
| 363 | g_return_if_fail (ticker != NULL); | |
| 364 | g_return_if_fail (GTK_IS_TICKER(ticker)); | |
| 365 | ||
| 366 | border_width = GTK_CONTAINER (ticker)->border_width; | |
| 367 | ||
| 368 | ticker->width = GTK_WIDGET(ticker)->allocation.width; | |
| 369 | ticker->total = 0; | |
| 370 | children = ticker->children; | |
| 371 | while (children) { | |
| 372 | child = children->data; | |
| 373 | ||
| 374 | child->x = 0; | |
| 375 | if (GTK_WIDGET_VISIBLE (child->widget)) { | |
| 376 | gtk_widget_get_child_requisition (child->widget, &child_requisition); | |
| 377 | child->offset = ticker->total; | |
| 378 | ticker->total += | |
| 379 | child_requisition.width + border_width + ticker->spacing; | |
| 380 | } | |
| 381 | children = children->next; | |
| 382 | } | |
| 383 | ticker->dirty = FALSE; | |
| 384 | } | |
| 385 | ||
| 386 | static void | |
| 387 | gtk_ticker_size_allocate (GtkWidget *widget, | |
| 388 | GtkAllocation *allocation) | |
| 389 | { | |
| 390 | GtkTicker *ticker; | |
| 391 | GtkTickerChild *child; | |
| 392 | GtkAllocation child_allocation; | |
| 393 | GtkRequisition child_requisition; | |
| 394 | GList *children; | |
| 395 | guint16 border_width; | |
| 396 | ||
| 397 | g_return_if_fail (widget != NULL); | |
| 398 | g_return_if_fail (GTK_IS_TICKER(widget)); | |
| 399 | g_return_if_fail (allocation != NULL); | |
| 400 | ||
| 401 | ticker = GTK_TICKER (widget); | |
| 402 | ||
| 403 | if ( GTK_WIDGET(ticker)->allocation.width != ticker->width ) | |
| 404 | ticker->dirty = TRUE; | |
| 405 | ||
| 406 | if ( ticker->dirty == TRUE ) { | |
| 407 | gtk_ticker_compute_offsets( ticker ); | |
| 408 | } | |
| 409 | ||
| 410 | widget->allocation = *allocation; | |
| 411 | if (GTK_WIDGET_REALIZED (widget)) | |
| 412 | gdk_window_move_resize (widget->window, | |
| 413 | allocation->x, | |
| 414 | allocation->y, | |
| 415 | allocation->width, | |
| 416 | allocation->height); | |
| 417 | ||
| 418 | border_width = GTK_CONTAINER (ticker)->border_width; | |
| 419 | ||
| 420 | children = ticker->children; | |
| 421 | while (children) | |
| 422 | { | |
| 423 | child = children->data; | |
| 424 | child->x -= ticker->scootch; | |
| 425 | ||
| 426 | if (GTK_WIDGET_VISIBLE (child->widget)) { | |
| 427 | gtk_widget_get_child_requisition (child->widget, &child_requisition); | |
| 428 | child_allocation.width = child_requisition.width; | |
| 429 | child_allocation.x = child->offset + border_width + child->x; | |
| 430 | if ( ( child_allocation.x + child_allocation.width ) < GTK_WIDGET(ticker)->allocation.x ) { | |
| 431 | if ( ticker->total >= GTK_WIDGET(ticker)->allocation.width ) { | |
| 432 | child->x += GTK_WIDGET(ticker)->allocation.x + GTK_WIDGET(ticker)->allocation.width + ( ticker->total - ( GTK_WIDGET(ticker)->allocation.x + GTK_WIDGET(ticker)->allocation.width ) ); | |
| 433 | } | |
| 434 | else { | |
| 435 | child->x += GTK_WIDGET(ticker)->allocation.x + GTK_WIDGET(ticker)->allocation.width; | |
| 436 | } | |
| 437 | } | |
| 438 | child_allocation.y = border_width; | |
| 439 | child_allocation.height = child_requisition.height; | |
| 440 | gtk_widget_size_allocate (child->widget, &child_allocation); | |
| 441 | } | |
| 442 | children = children->next; | |
| 443 | } | |
| 444 | } | |
| 445 | ||
| 446 | static gint | |
| 447 | gtk_ticker_expose (GtkWidget *widget, GdkEventExpose *event) | |
| 448 | { | |
| 449 | GtkTicker *ticker; | |
| 450 | GtkTickerChild *child; | |
| 451 | GdkEventExpose child_event; | |
| 452 | GList *children; | |
| 453 | ||
| 454 | g_return_val_if_fail (widget != NULL, FALSE); | |
| 455 | g_return_val_if_fail (GTK_IS_TICKER (widget), FALSE); | |
| 456 | g_return_val_if_fail (event != NULL, FALSE); | |
| 457 | ||
| 458 | if (GTK_WIDGET_DRAWABLE (widget)) | |
| 459 | { | |
| 460 | ticker = GTK_TICKER (widget); | |
| 461 | ||
| 462 | child_event = *event; | |
| 463 | ||
| 464 | children = ticker->children; | |
| 465 | while (children) | |
| 466 | { | |
| 467 | child = children->data; | |
| 468 | children = children->next; | |
| 469 | ||
| 470 | if (GTK_WIDGET_NO_WINDOW (child->widget) && | |
| 471 | gtk_widget_intersect (child->widget, &event->area, | |
| 472 | &child_event.area)) | |
| 473 | gtk_widget_event (child->widget, (GdkEvent*) &child_event); | |
| 474 | } | |
| 475 | } | |
| 476 | ||
| 477 | return FALSE; | |
| 478 | } | |
| 479 | ||
| 3466 | 480 | |
| 3391 | 481 | void |
| 482 | gtk_ticker_add(GtkTicker *ticker, GtkWidget *widget) | |
| 483 | { | |
| 484 | gtk_ticker_add_real( GTK_CONTAINER( ticker ), widget ); | |
| 485 | ticker->dirty = TRUE; | |
| 486 | } | |
| 487 | ||
| 488 | void | |
| 489 | gtk_ticker_remove(GtkTicker *ticker, GtkWidget *widget) | |
| 490 | { | |
| 491 | gtk_ticker_remove_real( GTK_CONTAINER( ticker ), widget ); | |
| 492 | ticker->dirty = TRUE; | |
| 493 | } | |
| 494 | ||
| 495 | static void | |
| 496 | gtk_ticker_add_real(GtkContainer *container, | |
| 497 | GtkWidget *widget) | |
| 498 | { | |
| 499 | g_return_if_fail (container != NULL); | |
| 500 | g_return_if_fail (GTK_IS_TICKER (container)); | |
| 501 | g_return_if_fail (widget != NULL); | |
| 502 | ||
| 503 | gtk_ticker_put(GTK_TICKER (container), widget); | |
| 504 | } | |
| 505 | ||
| 506 | static void | |
| 507 | gtk_ticker_remove_real(GtkContainer *container, | |
| 508 | GtkWidget *widget) | |
| 509 | { | |
| 510 | GtkTicker *ticker; | |
| 511 | GtkTickerChild *child; | |
| 512 | GList *children; | |
| 513 | ||
| 514 | g_return_if_fail (container != NULL); | |
| 515 | g_return_if_fail (GTK_IS_TICKER (container)); | |
| 516 | g_return_if_fail (widget != NULL); | |
| 517 | ||
| 518 | ticker = GTK_TICKER (container); | |
| 519 | ||
| 520 | children = ticker->children; | |
| 521 | while (children) | |
| 522 | { | |
| 523 | child = children->data; | |
| 524 | ||
| 525 | if (child->widget == widget) | |
| 526 | { | |
| 527 | gboolean was_visible = GTK_WIDGET_VISIBLE (widget); | |
| 528 | ||
| 529 | gtk_widget_unparent (widget); | |
| 530 | ||
| 531 | ticker->children = g_list_remove_link (ticker->children, children); | |
| 532 | g_list_free (children); | |
| 533 | g_free (child); | |
| 534 | ||
| 535 | if (was_visible && GTK_WIDGET_VISIBLE (container)) | |
| 536 | gtk_widget_queue_resize (GTK_WIDGET (container)); | |
| 537 | ||
| 538 | break; | |
| 539 | } | |
| 540 | ||
| 541 | children = children->next; | |
| 542 | } | |
| 543 | } | |
| 544 | ||
| 545 | static void | |
| 546 | gtk_ticker_forall (GtkContainer *container, | |
| 547 | gboolean include_internals, | |
| 548 | GtkCallback callback, | |
| 549 | gpointer callback_data) | |
| 550 | { | |
| 551 | GtkTicker *ticker; | |
| 552 | GtkTickerChild *child; | |
| 553 | GList *children; | |
| 554 | ||
| 555 | g_return_if_fail (container != NULL); | |
| 556 | g_return_if_fail (GTK_IS_TICKER (container)); | |
| 557 | g_return_if_fail (callback != NULL); | |
| 558 | ||
| 559 | ticker = GTK_TICKER (container); | |
| 560 | ||
| 561 | children = ticker->children; | |
| 562 | while (children) | |
| 563 | { | |
| 564 | child = children->data; | |
| 565 | children = children->next; | |
| 566 | ||
| 567 | (* callback) (child->widget, callback_data); | |
| 568 | } | |
| 569 | } |