make the g_print a debug message
[swfdec.git] / libswfdec / swfdec_text_field_movie.h
blob8d719d3aa35980b9c36ae25afa4c6cd513297e76
1 /* Swfdec
2 * Copyright (C) 2006 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.
9 *
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 <libswfdec/swfdec_movie.h>
25 #include <libswfdec/swfdec_text_field.h>
26 #include <libswfdec/swfdec_style_sheet.h>
27 #include <libswfdec/swfdec_text_format.h>
29 G_BEGIN_DECLS
32 typedef struct _SwfdecTextFieldMovie SwfdecTextFieldMovie;
33 typedef struct _SwfdecTextFieldMovieClass SwfdecTextFieldMovieClass;
35 #define SWFDEC_TYPE_TEXT_FIELD_MOVIE (swfdec_text_field_movie_get_type())
36 #define SWFDEC_IS_TEXT_FIELD_MOVIE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_TEXT_FIELD_MOVIE))
37 #define SWFDEC_IS_TEXT_FIELD_MOVIE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_TEXT_FIELD_MOVIE))
38 #define SWFDEC_TEXT_FIELD_MOVIE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_TEXT_FIELD_MOVIE, SwfdecTextFieldMovie))
39 #define SWFDEC_TEXT_FIELD_MOVIE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_TEXT_FIELD_MOVIE, SwfdecTextFieldMovieClass))
41 typedef struct {
42 PangoLayout * layout;
43 int offset_x;
44 int last_line_offset_y;
45 int height;
46 int width;
47 gboolean bullet;
48 } SwfdecLayout;
50 typedef struct {
51 guint index_;
53 PangoAlignment align;
54 gboolean justify;
55 int leading;
56 int block_indent;
57 int left_margin;
58 int right_margin;
59 PangoTabArray * tab_stops;
60 } SwfdecBlock;
62 typedef struct {
63 guint index_;
64 guint length;
65 gboolean newline; // ends in newline
67 gboolean bullet;
68 int indent;
70 GSList * blocks; // SwfdecBlock
71 GSList * attrs; // PangoAttribute
72 } SwfdecParagraph;
74 typedef struct {
75 guint index_;
76 SwfdecTextFormat * format;
77 } SwfdecFormatIndex;
79 struct _SwfdecTextFieldMovie {
80 SwfdecMovie movie;
82 SwfdecTextField * text; /* the text_field object we render */
84 GString * input;
85 char * asterisks; /* bunch of asterisks that we display when password mode is enabled */
86 guint asterisks_length;
87 gboolean input_html; /* whether orginal input was given as HTML */
89 const char * variable;
91 SwfdecTextFormat * format_new;
92 GSList * formats;
94 gboolean condense_white;
95 gboolean embed_fonts;
97 SwfdecAsObject * style_sheet;
98 const char * style_sheet_input; /* saved input, so it can be used to apply stylesheet again */
100 gboolean scroll_changed; /* if any of the scroll attributes have changed and we haven't fired the event yet */
101 int scroll;
102 int scroll_max;
103 int scroll_bottom;
104 int hscroll;
105 int hscroll_max;
106 gboolean mouse_wheel_enabled;
108 const char * restrict_;
110 SwfdecColor border_color;
111 SwfdecColor background_color;
113 // FIXME: Temporary using image surface, until there is a way to get cairo_t
114 // outside the rendering functions
115 cairo_surface_t * surface;
116 cairo_t * cr;
119 struct _SwfdecTextFieldMovieClass {
120 SwfdecMovieClass movie_class;
123 GType swfdec_text_field_movie_get_type (void);
125 void swfdec_text_field_movie_set_text (SwfdecTextFieldMovie * movie,
126 const char * str,
127 gboolean html);
128 void swfdec_text_field_movie_get_text_size (SwfdecTextFieldMovie * text,
129 int * width,
130 int * height);
131 gboolean swfdec_text_field_movie_auto_size (SwfdecTextFieldMovie * text);
132 void swfdec_text_field_movie_update_scroll (SwfdecTextFieldMovie * text,
133 gboolean check_limits);
134 void swfdec_text_field_movie_set_text_format (SwfdecTextFieldMovie * text,
135 SwfdecTextFormat * format,
136 guint start_index,
137 guint end_index);
138 SwfdecTextFormat *swfdec_text_field_movie_get_text_format (SwfdecTextFieldMovie * text,
139 guint start_index,
140 guint end_index);
141 const char * swfdec_text_field_movie_get_text (SwfdecTextFieldMovie * text);
142 void swfdec_text_field_movie_set_listen_variable (SwfdecTextFieldMovie * text,
143 const char * value);
144 void swfdec_text_field_movie_set_listen_variable_text (SwfdecTextFieldMovie *text,
145 const char * value);
146 void swfdec_text_field_movie_replace_text (SwfdecTextFieldMovie * text,
147 guint start_index,
148 guint end_index,
149 const char * str);
151 /* implemented in swfdec_text_field_movie_as.c */
152 void swfdec_text_field_movie_init_properties (SwfdecAsContext * cx);
154 /* implemented in swfdec_html_parser.c */
155 void swfdec_text_field_movie_html_parse (SwfdecTextFieldMovie * text,
156 const char * str);
157 const char * swfdec_text_field_movie_get_html_text (SwfdecTextFieldMovie * text);
159 G_END_DECLS
160 #endif