annotate plugins/ticker/gtkticker.c @ 3440:a686f716ac33

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