1/* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library 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 GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19/*
20 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
21 * file for a list of people on the GTK+ Team. See the ChangeLog
22 * files for a list of changes. These files are distributed with
23 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
24 */
25
26#ifndef __GTK_LABEL_H__
27#define __GTK_LABEL_H__
28
29
30#if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
31#error "Only <gtk/gtk.h> can be included directly."
32#endif
33
34#include <gtk/gtkmisc.h>
35#include <gtk/gtkwindow.h>
36#include <gtk/gtkmenu.h>
37
38
39G_BEGIN_DECLS
40
41#define GTK_TYPE_LABEL (gtk_label_get_type ())
42#define GTK_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LABEL, GtkLabel))
43#define GTK_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LABEL, GtkLabelClass))
44#define GTK_IS_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LABEL))
45#define GTK_IS_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LABEL))
46#define GTK_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LABEL, GtkLabelClass))
47
48
49typedef struct _GtkLabel GtkLabel;
50typedef struct _GtkLabelClass GtkLabelClass;
51
52typedef struct _GtkLabelSelectionInfo GtkLabelSelectionInfo;
53
54struct _GtkLabel
55{
56 GtkMisc misc;
57
58 /*< private >*/
59 gchar *GSEAL (label);
60 guint GSEAL (jtype) : 2;
61 guint GSEAL (wrap) : 1;
62 guint GSEAL (use_underline) : 1;
63 guint GSEAL (use_markup) : 1;
64 guint GSEAL (ellipsize) : 3;
65 guint GSEAL (single_line_mode) : 1;
66 guint GSEAL (have_transform) : 1;
67 guint GSEAL (in_click) : 1;
68 guint GSEAL (wrap_mode) : 3;
69 guint GSEAL (pattern_set) : 1;
70 guint GSEAL (track_links) : 1;
71
72 guint GSEAL (mnemonic_keyval);
73
74 gchar *GSEAL (text);
75 PangoAttrList *GSEAL (attrs);
76 PangoAttrList *GSEAL (effective_attrs);
77
78 PangoLayout *GSEAL (layout);
79
80 GtkWidget *GSEAL (mnemonic_widget);
81 GtkWindow *GSEAL (mnemonic_window);
82
83 GtkLabelSelectionInfo *GSEAL (select_info);
84};
85
86struct _GtkLabelClass
87{
88 GtkMiscClass parent_class;
89
90 void (* move_cursor) (GtkLabel *label,
91 GtkMovementStep step,
92 gint count,
93 gboolean extend_selection);
94 void (* copy_clipboard) (GtkLabel *label);
95
96 /* Hook to customize right-click popup for selectable labels */
97 void (* populate_popup) (GtkLabel *label,
98 GtkMenu *menu);
99
100 gboolean (*activate_link) (GtkLabel *label,
101 const gchar *uri);
102
103 /* Padding for future expansion */
104 void (*_gtk_reserved1) (void);
105 void (*_gtk_reserved2) (void);
106 void (*_gtk_reserved3) (void);
107};
108
109GType gtk_label_get_type (void) G_GNUC_CONST;
110GtkWidget* gtk_label_new (const gchar *str);
111GtkWidget* gtk_label_new_with_mnemonic (const gchar *str);
112void gtk_label_set_text (GtkLabel *label,
113 const gchar *str);
114const gchar * gtk_label_get_text (GtkLabel *label);
115void gtk_label_set_attributes (GtkLabel *label,
116 PangoAttrList *attrs);
117PangoAttrList *gtk_label_get_attributes (GtkLabel *label);
118void gtk_label_set_label (GtkLabel *label,
119 const gchar *str);
120const gchar * gtk_label_get_label (GtkLabel *label);
121void gtk_label_set_markup (GtkLabel *label,
122 const gchar *str);
123void gtk_label_set_use_markup (GtkLabel *label,
124 gboolean setting);
125gboolean gtk_label_get_use_markup (GtkLabel *label);
126void gtk_label_set_use_underline (GtkLabel *label,
127 gboolean setting);
128gboolean gtk_label_get_use_underline (GtkLabel *label);
129
130void gtk_label_set_markup_with_mnemonic (GtkLabel *label,
131 const gchar *str);
132guint gtk_label_get_mnemonic_keyval (GtkLabel *label);
133void gtk_label_set_mnemonic_widget (GtkLabel *label,
134 GtkWidget *widget);
135GtkWidget *gtk_label_get_mnemonic_widget (GtkLabel *label);
136void gtk_label_set_text_with_mnemonic (GtkLabel *label,
137 const gchar *str);
138void gtk_label_set_justify (GtkLabel *label,
139 GtkJustification jtype);
140GtkJustification gtk_label_get_justify (GtkLabel *label);
141void gtk_label_set_ellipsize (GtkLabel *label,
142 PangoEllipsizeMode mode);
143PangoEllipsizeMode gtk_label_get_ellipsize (GtkLabel *label);
144void gtk_label_set_width_chars (GtkLabel *label,
145 gint n_chars);
146gint gtk_label_get_width_chars (GtkLabel *label);
147void gtk_label_set_max_width_chars (GtkLabel *label,
148 gint n_chars);
149gint gtk_label_get_max_width_chars (GtkLabel *label);
150void gtk_label_set_pattern (GtkLabel *label,
151 const gchar *pattern);
152void gtk_label_set_line_wrap (GtkLabel *label,
153 gboolean wrap);
154gboolean gtk_label_get_line_wrap (GtkLabel *label);
155void gtk_label_set_line_wrap_mode (GtkLabel *label,
156 PangoWrapMode wrap_mode);
157PangoWrapMode gtk_label_get_line_wrap_mode (GtkLabel *label);
158void gtk_label_set_selectable (GtkLabel *label,
159 gboolean setting);
160gboolean gtk_label_get_selectable (GtkLabel *label);
161void gtk_label_set_angle (GtkLabel *label,
162 gdouble angle);
163gdouble gtk_label_get_angle (GtkLabel *label);
164void gtk_label_select_region (GtkLabel *label,
165 gint start_offset,
166 gint end_offset);
167gboolean gtk_label_get_selection_bounds (GtkLabel *label,
168 gint *start,
169 gint *end);
170
171PangoLayout *gtk_label_get_layout (GtkLabel *label);
172void gtk_label_get_layout_offsets (GtkLabel *label,
173 gint *x,
174 gint *y);
175
176void gtk_label_set_single_line_mode (GtkLabel *label,
177 gboolean single_line_mode);
178gboolean gtk_label_get_single_line_mode (GtkLabel *label);
179
180const gchar *gtk_label_get_current_uri (GtkLabel *label);
181void gtk_label_set_track_visited_links (GtkLabel *label,
182 gboolean track_links);
183gboolean gtk_label_get_track_visited_links (GtkLabel *label);
184
185#ifndef GTK_DISABLE_DEPRECATED
186
187#define gtk_label_set gtk_label_set_text
188void gtk_label_get (GtkLabel *label,
189 gchar **str);
190
191/* Convenience function to set the name and pattern by parsing
192 * a string with embedded underscores, and return the appropriate
193 * key symbol for the accelerator.
194 */
195guint gtk_label_parse_uline (GtkLabel *label,
196 const gchar *string);
197
198#endif /* GTK_DISABLE_DEPRECATED */
199
200/* private */
201
202void _gtk_label_mnemonics_visible_apply_recursively (GtkWidget *widget,
203 gboolean mnemonics_visible);
204
205G_END_DECLS
206
207#endif /* __GTK_LABEL_H__ */
208