2 * Copyright (C) 2003-2006 David Schleef <ds@schleef.org>
3 * 2005-2006 Eric Anholt <eric@anholt.net>
4 * 2006 Benjamin Otte <otte@gnome.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301 USA
26 #include "swfdec_button.h"
27 #include "swfdec_button_movie.h"
28 #include "swfdec_sound.h"
29 #include "swfdec_sprite.h"
32 G_DEFINE_TYPE (SwfdecButton
, swfdec_button
, SWFDEC_TYPE_GRAPHIC
)
35 swfdec_button_init (SwfdecButton
* button
)
40 swfdec_button_dispose (GObject
*object
)
43 SwfdecButton
*button
= SWFDEC_BUTTON (object
);
45 g_list_foreach (button
->records
, (GFunc
) swfdec_content_free
, NULL
);
46 g_list_free (button
->records
);
47 if (button
->events
!= NULL
) {
48 swfdec_event_list_free (button
->events
);
49 button
->events
= NULL
;
51 for (i
= 0; i
< 4; i
++) {
52 if (button
->sounds
[i
]) {
53 swfdec_sound_chunk_free (button
->sounds
[i
]);
54 button
->sounds
[i
] = NULL
;
58 G_OBJECT_CLASS (swfdec_button_parent_class
)->dispose (G_OBJECT (button
));
62 swfdec_button_create_movie (SwfdecGraphic
*graphic
, gsize
*size
)
64 SwfdecButtonMovie
*movie
= g_object_new (SWFDEC_TYPE_BUTTON_MOVIE
, NULL
);
66 movie
->button
= SWFDEC_BUTTON (graphic
);
67 *size
= sizeof (SwfdecButtonMovie
);
69 return SWFDEC_MOVIE (movie
);
73 swfdec_button_class_init (SwfdecButtonClass
* g_class
)
75 GObjectClass
*object_class
= G_OBJECT_CLASS (g_class
);
76 SwfdecGraphicClass
*graphic_class
= SWFDEC_GRAPHIC_CLASS (g_class
);
78 object_class
->dispose
= swfdec_button_dispose
;
80 graphic_class
->create_movie
= swfdec_button_create_movie
;