2 * Copyright (C) 2006-2008 Benjamin Otte <otte@gnome.org>
3 * 2007 Pekka Lampila <pekka.lampila@iki.fi>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301 USA
21 #ifndef _SWFDEC_TEXT_FIELD_MOVIE_H_
22 #define _SWFDEC_TEXT_FIELD_MOVIE_H_
24 #include <swfdec/swfdec_actor.h>
25 #include <swfdec/swfdec_text_field.h>
26 #include <swfdec/swfdec_style_sheet.h>
27 #include <swfdec/swfdec_text_buffer.h>
28 #include <swfdec/swfdec_text_format.h>
29 #include <swfdec/swfdec_text_layout.h>
34 typedef struct _SwfdecTextFieldMovie SwfdecTextFieldMovie
;
35 typedef struct _SwfdecTextFieldMovieClass SwfdecTextFieldMovieClass
;
37 #define SWFDEC_TYPE_TEXT_FIELD_MOVIE (swfdec_text_field_movie_get_type())
38 #define SWFDEC_IS_TEXT_FIELD_MOVIE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_TEXT_FIELD_MOVIE))
39 #define SWFDEC_IS_TEXT_FIELD_MOVIE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_TEXT_FIELD_MOVIE))
40 #define SWFDEC_TEXT_FIELD_MOVIE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_TEXT_FIELD_MOVIE, SwfdecTextFieldMovie))
41 #define SWFDEC_TEXT_FIELD_MOVIE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_TEXT_FIELD_MOVIE, SwfdecTextFieldMovieClass))
43 struct _SwfdecTextFieldMovie
{
46 SwfdecRect extents
; /* original extents (copied from graphic) - queue extents update when modifying */
47 /* these are updated with the movie's extents - so call swfdec_movie_update() */
48 cairo_matrix_t to_layout
; /* matrix to go from movie => layout */
49 cairo_matrix_t from_layout
; /* matrix to go from layout => movie */
50 SwfdecRectangle layout_area
; /* layout we render to in stage coordinates */
51 SwfdecRectangle stage_area
; /* complete size of textfield in stage coordinates */
53 /* properties copied from textfield */
60 SwfdecAutoSize auto_size
;
64 SwfdecTextBuffer
* text
; /* the text + formatting */
65 SwfdecTextLayout
* layout
; /* the layouted text */
66 /* cached values from the layout (updated sometimes via swfdec_text_field_movie_update_layout()) */
67 guint layout_width
; /* width of the layout */
68 guint layout_height
; /* height of the layout */
69 guint scroll
; /* current scroll offset in lines (0-indexed) */
70 guint scroll_max
; /* scroll must be smaller than this value */
71 guint lines_visible
; /* number of lines currently visible */
72 guint hscroll
; /* horizontal scrolling offset in pixels */
74 const char * variable
;
76 gboolean condense_white
;
78 SwfdecAsObject
* style_sheet
;
79 const char * style_sheet_input
; /* saved input, so it can be used to apply stylesheet again */
81 gboolean onScroller_emitted
; /* if any of the scroll attributes have changed and we haven't fired the event yet */
82 guint changed
; /* number of onChanged events we have to emit */
83 gboolean mouse_wheel_enabled
;
85 const char * restrict_
;
87 SwfdecColor border_color
;
88 SwfdecColor background_color
;
90 gboolean mouse_pressed
;
91 guint character_pressed
;
94 struct _SwfdecTextFieldMovieClass
{
95 SwfdecActorClass actor_class
;
98 GType
swfdec_text_field_movie_get_type (void);
100 void swfdec_text_field_movie_set_text (SwfdecTextFieldMovie
* movie
,
103 void swfdec_text_field_movie_autosize (SwfdecTextFieldMovie
* text
);
104 void swfdec_text_field_movie_update_layout (SwfdecTextFieldMovie
* text
);
105 void swfdec_text_field_movie_emit_onScroller (SwfdecTextFieldMovie
* text
);
106 const char * swfdec_text_field_movie_get_text (SwfdecTextFieldMovie
* text
);
107 void swfdec_text_field_movie_set_listen_variable
108 (SwfdecTextFieldMovie
* text
,
110 void swfdec_text_field_movie_set_listen_variable_text
111 (SwfdecTextFieldMovie
* text
,
114 guint
swfdec_text_field_movie_get_hscroll_max (SwfdecTextFieldMovie
* text
);
116 /* implemented in swfdec_text_field_movie_as.c */
117 void swfdec_text_field_movie_init_properties (SwfdecAsContext
* cx
);
119 /* implemented in swfdec_html_parser.c */
120 void swfdec_text_field_movie_html_parse (SwfdecTextFieldMovie
* text
,
122 const char * swfdec_text_field_movie_get_html_text (SwfdecTextFieldMovie
* text
);