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 
36 G_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 
46 typedef struct _GtkLabel              GtkLabel;
47 typedef struct _GtkLabelPrivate       GtkLabelPrivate;
48 typedef struct _GtkLabelClass         GtkLabelClass;
49 
50 typedef struct _GtkLabelSelectionInfo GtkLabelSelectionInfo;
51 
52 struct _GtkLabel
53 {
54   GtkMisc misc;
55 
56   /*< private >*/
57   GtkLabelPrivate *priv;
58 };
59 
60 struct _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 
88 GDK_AVAILABLE_IN_ALL
89 GType                 gtk_label_get_type          (void) G_GNUC_CONST;
90 GDK_AVAILABLE_IN_ALL
91 GtkWidget*            gtk_label_new               (const gchar   *str);
92 GDK_AVAILABLE_IN_ALL
93 GtkWidget*            gtk_label_new_with_mnemonic (const gchar   *str);
94 GDK_AVAILABLE_IN_ALL
95 void                  gtk_label_set_text          (GtkLabel      *label,
96 						   const gchar   *str);
97 GDK_AVAILABLE_IN_ALL
98 const gchar*          gtk_label_get_text          (GtkLabel      *label);
99 GDK_AVAILABLE_IN_ALL
100 void                  gtk_label_set_attributes    (GtkLabel      *label,
101 						   PangoAttrList *attrs);
102 GDK_AVAILABLE_IN_ALL
103 PangoAttrList        *gtk_label_get_attributes    (GtkLabel      *label);
104 GDK_AVAILABLE_IN_ALL
105 void                  gtk_label_set_label         (GtkLabel      *label,
106 						   const gchar   *str);
107 GDK_AVAILABLE_IN_ALL
108 const gchar *         gtk_label_get_label         (GtkLabel      *label);
109 GDK_AVAILABLE_IN_ALL
110 void                  gtk_label_set_markup        (GtkLabel      *label,
111 						   const gchar   *str);
112 GDK_AVAILABLE_IN_ALL
113 void                  gtk_label_set_use_markup    (GtkLabel      *label,
114 						   gboolean       setting);
115 GDK_AVAILABLE_IN_ALL
116 gboolean              gtk_label_get_use_markup    (GtkLabel      *label);
117 GDK_AVAILABLE_IN_ALL
118 void                  gtk_label_set_use_underline (GtkLabel      *label,
119 						   gboolean       setting);
120 GDK_AVAILABLE_IN_ALL
121 gboolean              gtk_label_get_use_underline (GtkLabel      *label);
122 
123 GDK_AVAILABLE_IN_ALL
124 void     gtk_label_set_markup_with_mnemonic       (GtkLabel         *label,
125 						   const gchar      *str);
126 GDK_AVAILABLE_IN_ALL
127 guint    gtk_label_get_mnemonic_keyval            (GtkLabel         *label);
128 GDK_AVAILABLE_IN_ALL
129 void     gtk_label_set_mnemonic_widget            (GtkLabel         *label,
130 						   GtkWidget        *widget);
131 GDK_AVAILABLE_IN_ALL
132 GtkWidget *gtk_label_get_mnemonic_widget          (GtkLabel         *label);
133 GDK_AVAILABLE_IN_ALL
134 void     gtk_label_set_text_with_mnemonic         (GtkLabel         *label,
135 						   const gchar      *str);
136 GDK_AVAILABLE_IN_ALL
137 void     gtk_label_set_justify                    (GtkLabel         *label,
138 						   GtkJustification  jtype);
139 GDK_AVAILABLE_IN_ALL
140 GtkJustification gtk_label_get_justify            (GtkLabel         *label);
141 GDK_AVAILABLE_IN_ALL
142 void     gtk_label_set_ellipsize		  (GtkLabel         *label,
143 						   PangoEllipsizeMode mode);
144 GDK_AVAILABLE_IN_ALL
145 PangoEllipsizeMode gtk_label_get_ellipsize        (GtkLabel         *label);
146 GDK_AVAILABLE_IN_ALL
147 void     gtk_label_set_width_chars		  (GtkLabel         *label,
148 						   gint              n_chars);
149 GDK_AVAILABLE_IN_ALL
150 gint     gtk_label_get_width_chars                (GtkLabel         *label);
151 GDK_AVAILABLE_IN_ALL
152 void     gtk_label_set_max_width_chars    	  (GtkLabel         *label,
153 					  	   gint              n_chars);
154 GDK_AVAILABLE_IN_ALL
155 gint     gtk_label_get_max_width_chars  	  (GtkLabel         *label);
156 GDK_AVAILABLE_IN_3_10
157 void     gtk_label_set_lines                      (GtkLabel         *label,
158                                                    gint              lines);
159 GDK_AVAILABLE_IN_3_10
160 gint     gtk_label_get_lines                      (GtkLabel         *label);
161 GDK_AVAILABLE_IN_ALL
162 void     gtk_label_set_pattern                    (GtkLabel         *label,
163 						   const gchar      *pattern);
164 GDK_AVAILABLE_IN_ALL
165 void     gtk_label_set_line_wrap                  (GtkLabel         *label,
166 						   gboolean          wrap);
167 GDK_AVAILABLE_IN_ALL
168 gboolean gtk_label_get_line_wrap                  (GtkLabel         *label);
169 GDK_AVAILABLE_IN_ALL
170 void     gtk_label_set_line_wrap_mode             (GtkLabel         *label,
171 						   PangoWrapMode     wrap_mode);
172 GDK_AVAILABLE_IN_ALL
173 PangoWrapMode gtk_label_get_line_wrap_mode        (GtkLabel         *label);
174 GDK_AVAILABLE_IN_ALL
175 void     gtk_label_set_selectable                 (GtkLabel         *label,
176 						   gboolean          setting);
177 GDK_AVAILABLE_IN_ALL
178 gboolean gtk_label_get_selectable                 (GtkLabel         *label);
179 GDK_AVAILABLE_IN_ALL
180 void     gtk_label_set_angle                      (GtkLabel         *label,
181 						   gdouble           angle);
182 GDK_AVAILABLE_IN_ALL
183 gdouble  gtk_label_get_angle                      (GtkLabel         *label);
184 GDK_AVAILABLE_IN_ALL
185 void     gtk_label_select_region                  (GtkLabel         *label,
186 						   gint              start_offset,
187 						   gint              end_offset);
188 GDK_AVAILABLE_IN_ALL
189 gboolean gtk_label_get_selection_bounds           (GtkLabel         *label,
190                                                    gint             *start,
191                                                    gint             *end);
192 
193 GDK_AVAILABLE_IN_ALL
194 PangoLayout *gtk_label_get_layout         (GtkLabel *label);
195 GDK_AVAILABLE_IN_ALL
196 void         gtk_label_get_layout_offsets (GtkLabel *label,
197                                            gint     *x,
198                                            gint     *y);
199 
200 GDK_AVAILABLE_IN_ALL
201 void         gtk_label_set_single_line_mode  (GtkLabel *label,
202                                               gboolean single_line_mode);
203 GDK_AVAILABLE_IN_ALL
204 gboolean     gtk_label_get_single_line_mode  (GtkLabel *label);
205 
206 GDK_AVAILABLE_IN_ALL
207 const gchar *gtk_label_get_current_uri (GtkLabel *label);
208 GDK_AVAILABLE_IN_ALL
209 void         gtk_label_set_track_visited_links  (GtkLabel *label,
210                                                  gboolean  track_links);
211 GDK_AVAILABLE_IN_ALL
212 gboolean     gtk_label_get_track_visited_links  (GtkLabel *label);
213 
214 GDK_AVAILABLE_IN_3_16
215 void         gtk_label_set_xalign (GtkLabel *label,
216                                    gfloat    xalign);
217 
218 GDK_AVAILABLE_IN_3_16
219 gfloat       gtk_label_get_xalign (GtkLabel *label);
220 
221 GDK_AVAILABLE_IN_3_16
222 void         gtk_label_set_yalign (GtkLabel *label,
223                                    gfloat    yalign);
224 
225 GDK_AVAILABLE_IN_3_16
226 gfloat       gtk_label_get_yalign (GtkLabel *label);
227 
228 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkLabel, g_object_unref)
229 
230 G_END_DECLS
231 
232 #endif /* __GTK_LABEL_H__ */
233