gtklabel.h 8.79 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 28
#ifndef __GTK_LABEL_H__
#define __GTK_LABEL_H__


29 30 31 32
#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
33
#include <gtk/deprecated/gtkmisc.h>
34
#include <gtk/gtkwindow.h>
35
#include <gtk/gtkmenu.h>
Elliot Lee's avatar
Elliot Lee committed
36

37

38
G_BEGIN_DECLS
39

Tim Janik's avatar
Tim Janik committed
40
#define GTK_TYPE_LABEL		  (gtk_label_get_type ())
Manish Singh's avatar
Manish Singh committed
41 42 43 44 45
#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))
46

Elliot Lee's avatar
Elliot Lee committed
47

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

52 53
typedef struct _GtkLabelSelectionInfo GtkLabelSelectionInfo;

Elliot Lee's avatar
Elliot Lee committed
54 55 56
struct _GtkLabel
{
  GtkMisc misc;
57

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

struct _GtkLabelClass
{
  GtkMiscClass parent_class;
65 66 67 68 69 70

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

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

76 77
  gboolean (*activate_link) (GtkLabel       *label,
                             const gchar    *uri);
78

79 80 81 82
  /* Padding for future expansion */
  void (*_gtk_reserved1) (void);
  void (*_gtk_reserved2) (void);
  void (*_gtk_reserved3) (void);
83 84 85 86 87
  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
88 89
};

90
GDK_AVAILABLE_IN_ALL
Manish Singh's avatar
Manish Singh committed
91
GType                 gtk_label_get_type          (void) G_GNUC_CONST;
92
GDK_AVAILABLE_IN_ALL
93
GtkWidget*            gtk_label_new               (const gchar   *str);
94
GDK_AVAILABLE_IN_ALL
95
GtkWidget*            gtk_label_new_with_mnemonic (const gchar   *str);
96
GDK_AVAILABLE_IN_ALL
97
void                  gtk_label_set_text          (GtkLabel      *label,
98
						   const gchar   *str);
99
GDK_AVAILABLE_IN_ALL
100
const gchar*          gtk_label_get_text          (GtkLabel      *label);
101
GDK_AVAILABLE_IN_ALL
102 103
void                  gtk_label_set_attributes    (GtkLabel      *label,
						   PangoAttrList *attrs);
104
GDK_AVAILABLE_IN_ALL
105
PangoAttrList        *gtk_label_get_attributes    (GtkLabel      *label);
106
GDK_AVAILABLE_IN_ALL
107 108
void                  gtk_label_set_label         (GtkLabel      *label,
						   const gchar   *str);
109
GDK_AVAILABLE_IN_ALL
110
const gchar *         gtk_label_get_label         (GtkLabel      *label);
111
GDK_AVAILABLE_IN_ALL
112 113
void                  gtk_label_set_markup        (GtkLabel      *label,
						   const gchar   *str);
114
GDK_AVAILABLE_IN_ALL
115 116
void                  gtk_label_set_use_markup    (GtkLabel      *label,
						   gboolean       setting);
117
GDK_AVAILABLE_IN_ALL
118
gboolean              gtk_label_get_use_markup    (GtkLabel      *label);
119
GDK_AVAILABLE_IN_ALL
120 121
void                  gtk_label_set_use_underline (GtkLabel      *label,
						   gboolean       setting);
122
GDK_AVAILABLE_IN_ALL
123 124
gboolean              gtk_label_get_use_underline (GtkLabel      *label);

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

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

202
GDK_AVAILABLE_IN_ALL
203 204
void         gtk_label_set_single_line_mode  (GtkLabel *label,
                                              gboolean single_line_mode);
205
GDK_AVAILABLE_IN_ALL
206
gboolean     gtk_label_get_single_line_mode  (GtkLabel *label);
207

208
GDK_AVAILABLE_IN_ALL
209
const gchar *gtk_label_get_current_uri (GtkLabel *label);
210
GDK_AVAILABLE_IN_ALL
211 212
void         gtk_label_set_track_visited_links  (GtkLabel *label,
                                                 gboolean  track_links);
213
GDK_AVAILABLE_IN_ALL
214
gboolean     gtk_label_get_track_visited_links  (GtkLabel *label);
215

216 217 218 219 220 221 222 223 224
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,
225
                                   gfloat    yalign);
226 227 228

GDK_AVAILABLE_IN_3_16
gfloat       gtk_label_get_yalign (GtkLabel *label);
229

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

#endif /* __GTK_LABEL_H__ */