1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3
* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
6
* This file is part of the Gnome Library.
8
* The Gnome Library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Library General Public License as
10
* published by the Free Software Foundation; either version 2 of the
11
* License, or (at your option) any later version.
13
* The Gnome Library is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Library General Public License for more details.
18
* You should have received a copy of the GNU Library General Public
19
* License along with the Gnome Library; see the file COPYING.LIB. If not,
20
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21
* Boston, MA 02111-1307, USA.
26
/* Text item type for GnomeCanvas widget
28
* GnomeCanvas is basically a port of the Tk toolkit's most excellent canvas widget. Tk is
29
* copyrighted by the Regents of the University of California, Sun Microsystems, and other parties.
32
* Author: Federico Mena <federico@nuclecu.unam.mx>
33
* Port to Pango co-done by Gergõ Érdi <cactus@cactus.rulez.org>
36
#ifndef GNOME_CANVAS_TEXT_H
37
#define GNOME_CANVAS_TEXT_H
40
#include <libgnomecanvas/gnome-canvas.h>
46
/* Text item for the canvas. Text items are positioned by an anchor point and an anchor direction.
48
* A clipping rectangle may be specified for the text. The rectangle is anchored at the text's anchor
49
* point, and is specified by clipping width and height parameters. If the clipping rectangle is
50
* enabled, it will clip the text.
52
* In addition, x and y offset values may be specified. These specify an offset from the anchor
53
* position. If used in conjunction with the clipping rectangle, these could be used to implement
54
* simple scrolling of the text within the clipping rectangle.
56
* Properties marked with [*] also have _set properties associated
57
* with them, that determine if the specified value should be used
58
* instead of the default (style-defined) values
60
* The following object arguments are available:
62
* name type read/write description
63
* ------------------------------------------------------------------------------------------
64
* text string RW The string of the text label
65
* markup string W A Pango markup string for the text label
67
* x double RW X coordinate of anchor point
68
* y double RW Y coordinate of anchor point
70
* font string W A string describing the font
71
* font_desc PangoFontDescription* RW Pointer to a PangoFontDescriptor
72
* attributes PangoAttrList* RW Pointer to a Pango attribute list
73
* style PangoStyle RW Pango style of font to use [*]
74
* variant PangoVariant RW Pango variant of font to use [*]
75
* weight int RW Pango weight of font to use [*]
76
* stretch PangoStretch RW Pango stretch of font to use [*]
77
* size int RW Size (in pixels) of font [*]
78
* size_points double RW Size (in points) of font
79
* scale double RW Ratio to scale font [*]
81
* anchor GtkAnchorType RW Anchor side for the text
82
* justification GtkJustification RW Justification for multiline text
83
* clip_width double RW Width of clip rectangle
84
* clip_height double RW Height of clip rectangle
85
* clip boolean RW Use clipping rectangle?
86
* x_offset double RW Horizontal offset distance from anchor position
87
* y_offset double RW Vertical offset distance from anchor position
89
* text_width double R Used to query the width of the rendered text
90
* text_height double R Used to query the rendered height of the text
92
* fill_color string W X color specification for text
93
* fill_color_gdk GdkColor* RW Pointer to an allocated GdkColor
94
* fill_color_rgba guint RW RGBA value used for AA color.
95
* fill_stipple GdkBitmap* RW Stipple pattern for filling the text
98
#define GNOME_TYPE_CANVAS_TEXT (gnome_canvas_text_get_type ())
99
#define GNOME_CANVAS_TEXT(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_CANVAS_TEXT, GnomeCanvasText))
100
#define GNOME_CANVAS_TEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_TEXT, GnomeCanvasTextClass))
101
#define GNOME_IS_CANVAS_TEXT(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_CANVAS_TEXT))
102
#define GNOME_IS_CANVAS_TEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_TEXT))
103
#define GNOME_CANVAS_TEXT_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GNOME_TYPE_CANVAS_TEXT, GnomeCanvasTextClass))
106
typedef struct _GnomeCanvasText GnomeCanvasText;
107
typedef struct _GnomeCanvasTextClass GnomeCanvasTextClass;
109
typedef struct _GnomeCanvasTextPrivate GnomeCanvasTextPrivate;
111
struct _GnomeCanvasText {
112
GnomeCanvasItem item;
114
PangoFontDescription *font_desc; /* Font description for text */
115
PangoAttrList *attr_list; /* Attribute list of the text (caching) */
116
PangoUnderline underline;
117
gboolean strikethrough;
121
char *text; /* Text to display */
122
GdkBitmap *stipple; /* Stipple for text */
123
GdkGC *gc; /* GC for drawing text */
124
PangoLayout *layout; /* The PangoLayout containing the text */
126
gulong pixel; /* Fill color */
128
double x, y; /* Position at anchor */
130
double clip_width; /* Width of optional clip rectangle */
131
double clip_height; /* Height of optional clip rectangle */
133
double xofs, yofs; /* Text offset distance from anchor position */
135
double affine[6]; /* The item -> canvas affine */ /*AA*/
137
GtkAnchorType anchor; /* Anchor side for text */
138
GtkJustification justification; /* Justification for text */
140
int cx, cy; /* Top-left canvas coordinates for text */
141
int clip_cx, clip_cy; /* Top-left canvas coordinates for clip rectangle */
142
int clip_cwidth, clip_cheight; /* Size of clip rectangle in pixels */
143
int max_width; /* Maximum width of text lines */
144
int height; /* Rendered text height in pixels */
146
guint32 rgba; /* RGBA color for text */ /*AA*/
148
guint clip : 1; /* Use clip rectangle? */
150
guint underline_set : 1; /* Apply specified underline style? */
151
guint strike_set : 1; /* Apply specified strikethrough style? */
152
guint rise_set : 1; /* Apply specified ascension/descension? */
154
guint scale_set : 1; /* Apply specified font scaling ratio? */
156
GnomeCanvasTextPrivate *priv;
159
struct _GnomeCanvasTextClass {
160
GnomeCanvasItemClass parent_class;
164
/* Standard Gtk function */
165
GType gnome_canvas_text_get_type (void) G_GNUC_CONST;