gtklabel.h 8.84 KB
Newer Older
Cody Russell's avatar
Cody Russell committed
1
/* GTK - The GIMP Toolkit
Elliot Lee's avatar
Elliot Lee committed
2 3 4
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 *
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Lesser General Public
Elliot Lee's avatar
Elliot Lee committed
6 7 8 9 10
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * 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.
Elliot Lee's avatar
Elliot Lee committed
13
 *
14
 * You should have received a copy of the GNU Lesser General Public
Javier Jardón's avatar
Javier Jardón committed
15
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
Elliot Lee's avatar
Elliot Lee committed
16
 */
17 18

/*
19
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
20 21
 * file for a list of people on the GTK+ Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
22
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23 24
 */

Elliot Lee's avatar
Elliot Lee committed
25 26 27
#ifndef __GTK_LABEL_H__
#define __GTK_LABEL_H__

28 29 30 31
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif

Matthias Clasen's avatar
Matthias Clasen committed
32
#include <gtk/deprecated/gtkmisc.h>
33
#include <gtk/gtkwindow.h>
34
#include <gtk/gtkmenu.h>
Elliot Lee's avatar
Elliot Lee committed
35

36
G_BEGIN_DECLS
37

Tim Janik's avatar
Tim Janik committed
38
#define GTK_TYPE_LABEL		  (gtk_label_get_type ())
Manish Singh's avatar
Manish Singh committed
39 40 41 42 43
#define GTK_LABEL(obj)		  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LABEL, GtkLabel))
#define GTK_LABEL_CLASS(klass)	  (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LABEL, GtkLabelClass))
#define GTK_IS_LABEL(obj)	  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LABEL))
#define GTK_IS_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LABEL))
#define GTK_LABEL_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LABEL, GtkLabelClass))
44

Elliot Lee's avatar
Elliot Lee committed
45

46 47 48
typedef struct _GtkLabel              GtkLabel;
typedef struct _GtkLabelPrivate       GtkLabelPrivate;
typedef struct _GtkLabelClass         GtkLabelClass;
Elliot Lee's avatar
Elliot Lee committed
49

50 51
typedef struct _GtkLabelSelectionInfo GtkLabelSelectionInfo;

Elliot Lee's avatar
Elliot Lee committed
52 53 54
struct _GtkLabel
{
  GtkMisc misc;
55

56
  /*< private >*/
57
  GtkLabelPrivate *priv;
Elliot Lee's avatar
Elliot Lee committed
58 59 60 61 62
};

struct _GtkLabelClass
{
  GtkMiscClass parent_class;
63 64 65 66 67 68

  void (* move_cursor)     (GtkLabel       *label,
			    GtkMovementStep step,
			    gint            count,
			    gboolean        extend_selection);
  void (* copy_clipboard)  (GtkLabel       *label);
69

70 71 72
  /* Hook to customize right-click popup for selectable labels */
  void (* populate_popup)   (GtkLabel       *label,
                             GtkMenu        *menu);
73

74 75
  gboolean (*activate_link) (GtkLabel       *label,
                             const gchar    *uri);
76

77 78 79 80
  /* Padding for future expansion */
  void (*_gtk_reserved1) (void);
  void (*_gtk_reserved2) (void);
  void (*_gtk_reserved3) (void);
81 82 83 84 85
  void (*_gtk_reserved4) (void);
  void (*_gtk_reserved5) (void);
  void (*_gtk_reserved6) (void);
  void (*_gtk_reserved7) (void);
  void (*_gtk_reserved8) (void);
Elliot Lee's avatar
Elliot Lee committed
86 87
};

88
GDK_AVAILABLE_IN_ALL
Manish Singh's avatar
Manish Singh committed
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 101
void                  gtk_label_set_attributes    (GtkLabel      *label,
						   PangoAttrList *attrs);
102
GDK_AVAILABLE_IN_ALL
103
PangoAttrList        *gtk_label_get_attributes    (GtkLabel      *label);
104
GDK_AVAILABLE_IN_ALL
105 106
void                  gtk_label_set_label         (GtkLabel      *label,
						   const gchar   *str);
107
GDK_AVAILABLE_IN_ALL
108
const gchar *         gtk_label_get_label         (GtkLabel      *label);
109
GDK_AVAILABLE_IN_ALL
110 111
void                  gtk_label_set_markup        (GtkLabel      *label,
						   const gchar   *str);
112
GDK_AVAILABLE_IN_ALL
113 114
void                  gtk_label_set_use_markup    (GtkLabel      *label,
						   gboolean       setting);
115
GDK_AVAILABLE_IN_ALL
116
gboolean              gtk_label_get_use_markup    (GtkLabel      *label);
117
GDK_AVAILABLE_IN_ALL
118 119
void                  gtk_label_set_use_underline (GtkLabel      *label,
						   gboolean       setting);
120
GDK_AVAILABLE_IN_ALL
121 122
gboolean              gtk_label_get_use_underline (GtkLabel      *label);

123
GDK_AVAILABLE_IN_ALL
124 125
void     gtk_label_set_markup_with_mnemonic       (GtkLabel         *label,
						   const gchar      *str);
126
GDK_AVAILABLE_IN_ALL
127
guint    gtk_label_get_mnemonic_keyval            (GtkLabel         *label);
128
GDK_AVAILABLE_IN_ALL
129 130
void     gtk_label_set_mnemonic_widget            (GtkLabel         *label,
						   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,
Havoc Pennington's avatar
Havoc Pennington committed
135
						   const gchar      *str);
136
GDK_AVAILABLE_IN_ALL
137 138
void     gtk_label_set_justify                    (GtkLabel         *label,
						   GtkJustification  jtype);
139
GDK_AVAILABLE_IN_ALL
140
GtkJustification gtk_label_get_justify            (GtkLabel         *label);
141
GDK_AVAILABLE_IN_ALL
142 143
void     gtk_label_set_ellipsize		  (GtkLabel         *label,
						   PangoEllipsizeMode mode);
144
GDK_AVAILABLE_IN_ALL
145
PangoEllipsizeMode gtk_label_get_ellipsize        (GtkLabel         *label);
146
GDK_AVAILABLE_IN_ALL
147 148
void     gtk_label_set_width_chars		  (GtkLabel         *label,
						   gint              n_chars);
149
GDK_AVAILABLE_IN_ALL
150
gint     gtk_label_get_width_chars                (GtkLabel         *label);
151
GDK_AVAILABLE_IN_ALL
152 153
void     gtk_label_set_max_width_chars    	  (GtkLabel         *label,
					  	   gint              n_chars);
154
GDK_AVAILABLE_IN_ALL
155
gint     gtk_label_get_max_width_chars  	  (GtkLabel         *label);
156 157 158 159 160
GDK_AVAILABLE_IN_3_10
void     gtk_label_set_lines                      (GtkLabel         *label,
                                                   gint              lines);
GDK_AVAILABLE_IN_3_10
gint     gtk_label_get_lines                      (GtkLabel         *label);
161
GDK_AVAILABLE_IN_ALL
162 163
void     gtk_label_set_pattern                    (GtkLabel         *label,
						   const gchar      *pattern);
164
GDK_AVAILABLE_IN_ALL
165 166
void     gtk_label_set_line_wrap                  (GtkLabel         *label,
						   gboolean          wrap);
167
GDK_AVAILABLE_IN_ALL
168
gboolean gtk_label_get_line_wrap                  (GtkLabel         *label);
169
GDK_AVAILABLE_IN_ALL
170 171
void     gtk_label_set_line_wrap_mode             (GtkLabel         *label,
						   PangoWrapMode     wrap_mode);
172
GDK_AVAILABLE_IN_ALL
173
PangoWrapMode gtk_label_get_line_wrap_mode        (GtkLabel         *label);
174
GDK_AVAILABLE_IN_ALL
175 176
void     gtk_label_set_selectable                 (GtkLabel         *label,
						   gboolean          setting);
177
GDK_AVAILABLE_IN_ALL
178
gboolean gtk_label_get_selectable                 (GtkLabel         *label);
179
GDK_AVAILABLE_IN_ALL
180 181
void     gtk_label_set_angle                      (GtkLabel         *label,
						   gdouble           angle);
182
GDK_AVAILABLE_IN_ALL
183
gdouble  gtk_label_get_angle                      (GtkLabel         *label);
184
GDK_AVAILABLE_IN_ALL
185 186 187
void     gtk_label_select_region                  (GtkLabel         *label,
						   gint              start_offset,
						   gint              end_offset);
188
GDK_AVAILABLE_IN_ALL
189 190 191
gboolean gtk_label_get_selection_bounds           (GtkLabel         *label,
                                                   gint             *start,
                                                   gint             *end);
192

193
GDK_AVAILABLE_IN_ALL
194
PangoLayout *gtk_label_get_layout         (GtkLabel *label);
195
GDK_AVAILABLE_IN_ALL
196 197 198 199
void         gtk_label_get_layout_offsets (GtkLabel *label,
                                           gint     *x,
                                           gint     *y);

200
GDK_AVAILABLE_IN_ALL
201 202
void         gtk_label_set_single_line_mode  (GtkLabel *label,
                                              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 210
void         gtk_label_set_track_visited_links  (GtkLabel *label,
                                                 gboolean  track_links);
211
GDK_AVAILABLE_IN_ALL
212
gboolean     gtk_label_get_track_visited_links  (GtkLabel *label);
213

214 215 216 217 218 219 220 221 222
GDK_AVAILABLE_IN_3_16
void         gtk_label_set_xalign (GtkLabel *label,
                                   gfloat    xalign);

GDK_AVAILABLE_IN_3_16
gfloat       gtk_label_get_xalign (GtkLabel *label);

GDK_AVAILABLE_IN_3_16
void         gtk_label_set_yalign (GtkLabel *label,
223
                                   gfloat    yalign);
224 225 226

GDK_AVAILABLE_IN_3_16
gfloat       gtk_label_get_yalign (GtkLabel *label);
227

228 229
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkLabel, g_object_unref)

230
G_END_DECLS
Elliot Lee's avatar
Elliot Lee committed
231 232

#endif /* __GTK_LABEL_H__ */