annotate src/gtkticker.c @ 1206:0d19ddd6f11e

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