1 /* Dia -- an diagram creation/manipulation program
2 * Copyright (C) 1998 Alexander Larsson
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #include "properties.h"
33 #define USE_TEXTLINE_FOR_LINES
36 /** The object that owns this text. */
37 DiaObject
*parent_object
;
38 /* don't change these values directly, use the text_set* functions */
42 #ifdef USE_TEXTLINE_FOR_LINES
48 int *strlen
; /* in characters */
62 /* Computed values: */
63 real ascent
; /* **average** ascent */
64 real descent
; /* **average** descent */
69 /* makes an internal copy of the string */
70 Text
*new_text(const char *string
, DiaFont
*font
, real height
,
71 Point
*pos
, Color
*color
, Alignment align
);
72 void text_destroy(Text
*text
);
73 Text
*text_copy(Text
*text
);
74 gchar
*text_get_line(Text
*text
, int line
);
75 char *text_get_string_copy(Text
*text
);
76 void text_set_string(Text
*text
, const char *string
);
77 void text_set_height(Text
*text
, real height
);
78 void text_set_font(Text
*text
, DiaFont
*font
);
79 void text_set_position(Text
*text
, Point
*pos
);
80 void text_set_color(Text
*text
, Color
*col
);
81 void text_set_alignment(Text
*text
, Alignment align
);
82 real
text_distance_from(Text
*text
, Point
*point
);
83 void text_calc_boundingbox(Text
*text
, Rectangle
*box
);
84 void text_draw(Text
*text
, DiaRenderer
*renderer
);
85 void text_set_cursor(Text
*text
, Point
*clicked_point
,
86 DiaRenderer
*interactive_renderer
);
87 void text_set_cursor_at_end( Text
* text
);
88 void text_grab_focus(Text
*text
, DiaObject
*object
);
89 int text_is_empty(Text
*text
);
90 int text_delete_all(Text
*text
, ObjectChange
**change
);
91 void text_get_attributes(Text
*text
, TextAttributes
*attr
);
92 void text_set_attributes(Text
*text
, TextAttributes
*attr
);
94 real
text_get_line_width(Text
*text
, int line_no
);
95 int text_get_line_strlen(Text
*text
, int line_no
);
96 real
text_get_max_width(Text
*text
);
97 real
text_get_ascent(Text
*text
);
98 real
text_get_descent(Text
*text
);
100 void data_add_text(AttributeNode attr
, Text
*text
);
101 Text
*data_text(AttributeNode attr
);
103 gboolean
apply_textattr_properties(GPtrArray
*props
,
104 Text
*text
, const gchar
*textname
,
105 TextAttributes
*attrs
);
106 gboolean
apply_textstr_properties(GPtrArray
*props
,
107 Text
*text
, const gchar
*textname
,