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, see <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23 */
24
25#ifndef __GTK_LABEL_H__
26#define __GTK_LABEL_H__
27
28#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
29#error "Only <gtk/gtk.h> can be included directly."
30#endif
31
32#include <gtk/deprecated/gtkmisc.h>
33#include <gtk/gtkwindow.h>
34#include <gtk/gtkmenu.h>
35
36G_BEGIN_DECLS
37
38#define GTK_TYPE_LABEL (gtk_label_get_type ())
39#define GTK_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LABEL, GtkLabel))
40#define GTK_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LABEL, GtkLabelClass))
41#define GTK_IS_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LABEL))
42#define GTK_IS_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LABEL))
43#define GTK_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LABEL, GtkLabelClass))
44
45
46typedef struct _GtkLabel GtkLabel;
47typedef struct _GtkLabelPrivate GtkLabelPrivate;
48typedef struct _GtkLabelClass GtkLabelClass;
49
50typedef struct _GtkLabelSelectionInfo GtkLabelSelectionInfo;
51
52struct _GtkLabel
53{
54 GtkMisc misc;
55
56 /*< private >*/
57 GtkLabelPrivate *priv;
58};
59
60struct _GtkLabelClass
61{
62 GtkMiscClass parent_class;
63
64 void (* move_cursor) (GtkLabel *label,
65 GtkMovementStep step,
66 gint count,
67 gboolean extend_selection);
68 void (* copy_clipboard) (GtkLabel *label);
69
70 /* Hook to customize right-click popup for selectable labels */
71 void (* populate_popup) (GtkLabel *label,
72 GtkMenu *menu);
73
74 gboolean (*activate_link) (GtkLabel *label,
75 const gchar *uri);
76
77 /* Padding for future expansion */
78 void (*_gtk_reserved1) (void);
79 void (*_gtk_reserved2) (void);
80 void (*_gtk_reserved3) (void);
81 void (*_gtk_reserved4) (void);
82 void (*_gtk_reserved5) (void);
83 void (*_gtk_reserved6) (void);
84 void (*_gtk_reserved7) (void);
85 void (*_gtk_reserved8) (void);
86};
87
88GDK_AVAILABLE_IN_ALL
89GType gtk_label_get_type (void) G_GNUC_CONST;
90GDK_AVAILABLE_IN_ALL
91GtkWidget* gtk_label_new (const gchar *str);
92GDK_AVAILABLE_IN_ALL
93GtkWidget* gtk_label_new_with_mnemonic (const gchar *str);
94GDK_AVAILABLE_IN_ALL
95void gtk_label_set_text (GtkLabel *label,
96 const gchar *str);
97GDK_AVAILABLE_IN_ALL
98const gchar* gtk_label_get_text (GtkLabel *label);
99GDK_AVAILABLE_IN_ALL
100void gtk_label_set_attributes (GtkLabel *label,
101 PangoAttrList *attrs);
102GDK_AVAILABLE_IN_ALL
103PangoAttrList *gtk_label_get_attributes (GtkLabel *label);
104GDK_AVAILABLE_IN_ALL
105void gtk_label_set_label (GtkLabel *label,
106 const gchar *str);
107GDK_AVAILABLE_IN_ALL
108const gchar * gtk_label_get_label (GtkLabel *label);
109GDK_AVAILABLE_IN_ALL
110void gtk_label_set_markup (GtkLabel *label,
111 const gchar *str);
112GDK_AVAILABLE_IN_ALL
113void gtk_label_set_use_markup (GtkLabel *label,
114 gboolean setting);
115GDK_AVAILABLE_IN_ALL
116gboolean gtk_label_get_use_markup (GtkLabel *label);
117GDK_AVAILABLE_IN_ALL
118void gtk_label_set_use_underline (GtkLabel *label,
119 gboolean setting);
120GDK_AVAILABLE_IN_ALL
121gboolean gtk_label_get_use_underline (GtkLabel *label);
122
123GDK_AVAILABLE_IN_ALL
124void gtk_label_set_markup_with_mnemonic (GtkLabel *label,
125 const gchar *str);
126GDK_AVAILABLE_IN_ALL
127guint gtk_label_get_mnemonic_keyval (GtkLabel *label);
128GDK_AVAILABLE_IN_ALL
129void gtk_label_set_mnemonic_widget (GtkLabel *label,
130 GtkWidget *widget);
131GDK_AVAILABLE_IN_ALL
132GtkWidget *gtk_label_get_mnemonic_widget (GtkLabel *label);
133GDK_AVAILABLE_IN_ALL
134void gtk_label_set_text_with_mnemonic (GtkLabel *label,
135 const gchar *str);
136GDK_AVAILABLE_IN_ALL
137void gtk_label_set_justify (GtkLabel *label,
138 GtkJustification jtype);
139GDK_AVAILABLE_IN_ALL
140GtkJustification gtk_label_get_justify (GtkLabel *label);
141GDK_AVAILABLE_IN_ALL
142void gtk_label_set_ellipsize (GtkLabel *label,
143 PangoEllipsizeMode mode);
144GDK_AVAILABLE_IN_ALL
145PangoEllipsizeMode gtk_label_get_ellipsize (GtkLabel *label);
146GDK_AVAILABLE_IN_ALL
147void gtk_label_set_width_chars (GtkLabel *label,
148 gint n_chars);
149GDK_AVAILABLE_IN_ALL
150gint gtk_label_get_width_chars (GtkLabel *label);
151GDK_AVAILABLE_IN_ALL
152void gtk_label_set_max_width_chars (GtkLabel *label,
153 gint n_chars);
154GDK_AVAILABLE_IN_ALL
155gint gtk_label_get_max_width_chars (GtkLabel *label);
156GDK_AVAILABLE_IN_3_10
157void gtk_label_set_lines (GtkLabel *label,
158 gint lines);
159GDK_AVAILABLE_IN_3_10
160gint gtk_label_get_lines (GtkLabel *label);
161GDK_AVAILABLE_IN_ALL
162void gtk_label_set_pattern (GtkLabel *label,
163 const gchar *pattern);
164GDK_AVAILABLE_IN_ALL
165void gtk_label_set_line_wrap (GtkLabel *label,
166 gboolean wrap);
167GDK_AVAILABLE_IN_ALL
168gboolean gtk_label_get_line_wrap (GtkLabel *label);
169GDK_AVAILABLE_IN_ALL
170void gtk_label_set_line_wrap_mode (GtkLabel *label,
171 PangoWrapMode wrap_mode);
172GDK_AVAILABLE_IN_ALL
173PangoWrapMode gtk_label_get_line_wrap_mode (GtkLabel *label);
174GDK_AVAILABLE_IN_ALL
175void gtk_label_set_selectable (GtkLabel *label,
176 gboolean setting);
177GDK_AVAILABLE_IN_ALL
178gboolean gtk_label_get_selectable (GtkLabel *label);
179GDK_AVAILABLE_IN_ALL
180void gtk_label_set_angle (GtkLabel *label,
181 gdouble angle);
182GDK_AVAILABLE_IN_ALL
183gdouble gtk_label_get_angle (GtkLabel *label);
184GDK_AVAILABLE_IN_ALL
185void gtk_label_select_region (GtkLabel *label,
186 gint start_offset,
187 gint end_offset);
188GDK_AVAILABLE_IN_ALL
189gboolean gtk_label_get_selection_bounds (GtkLabel *label,
190 gint *start,
191 gint *end);
192
193GDK_AVAILABLE_IN_ALL
194PangoLayout *gtk_label_get_layout (GtkLabel *label);
195GDK_AVAILABLE_IN_ALL
196void gtk_label_get_layout_offsets (GtkLabel *label,
197 gint *x,
198 gint *y);
199
200GDK_AVAILABLE_IN_ALL
201void gtk_label_set_single_line_mode (GtkLabel *label,
202 gboolean single_line_mode);
203GDK_AVAILABLE_IN_ALL
204gboolean gtk_label_get_single_line_mode (GtkLabel *label);
205
206GDK_AVAILABLE_IN_ALL
207const gchar *gtk_label_get_current_uri (GtkLabel *label);
208GDK_AVAILABLE_IN_ALL
209void gtk_label_set_track_visited_links (GtkLabel *label,
210 gboolean track_links);
211GDK_AVAILABLE_IN_ALL
212gboolean gtk_label_get_track_visited_links (GtkLabel *label);
213
214GDK_AVAILABLE_IN_3_16
215void gtk_label_set_xalign (GtkLabel *label,
216 gfloat xalign);
217
218GDK_AVAILABLE_IN_3_16
219gfloat gtk_label_get_xalign (GtkLabel *label);
220
221GDK_AVAILABLE_IN_3_16
222void gtk_label_set_yalign (GtkLabel *label,
223 gfloat yalign);
224
225GDK_AVAILABLE_IN_3_16
226gfloat gtk_label_get_yalign (GtkLabel *label);
227
228G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkLabel, g_object_unref)
229
230G_END_DECLS
231
232#endif /* __GTK_LABEL_H__ */
233