gtklabel.h 7.46 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
 */

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

Elliot Lee's avatar
Elliot Lee committed
29 30 31 32 33
#ifndef __GTK_LABEL_H__
#define __GTK_LABEL_H__


#include <gtk/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
};

Manish Singh's avatar
Manish Singh committed
90
GType                 gtk_label_get_type          (void) G_GNUC_CONST;
91 92
GtkWidget*            gtk_label_new               (const gchar   *str);
GtkWidget*            gtk_label_new_with_mnemonic (const gchar   *str);
93
void                  gtk_label_set_text          (GtkLabel      *label,
94
						   const gchar   *str);
95
const gchar*          gtk_label_get_text          (GtkLabel      *label);
96 97 98 99 100
void                  gtk_label_set_attributes    (GtkLabel      *label,
						   PangoAttrList *attrs);
PangoAttrList        *gtk_label_get_attributes    (GtkLabel      *label);
void                  gtk_label_set_label         (GtkLabel      *label,
						   const gchar   *str);
101
const gchar *         gtk_label_get_label         (GtkLabel      *label);
102 103 104 105 106 107 108 109 110
void                  gtk_label_set_markup        (GtkLabel      *label,
						   const gchar   *str);
void                  gtk_label_set_use_markup    (GtkLabel      *label,
						   gboolean       setting);
gboolean              gtk_label_get_use_markup    (GtkLabel      *label);
void                  gtk_label_set_use_underline (GtkLabel      *label,
						   gboolean       setting);
gboolean              gtk_label_get_use_underline (GtkLabel      *label);

111 112 113 114 115
void     gtk_label_set_markup_with_mnemonic       (GtkLabel         *label,
						   const gchar      *str);
guint    gtk_label_get_mnemonic_keyval            (GtkLabel         *label);
void     gtk_label_set_mnemonic_widget            (GtkLabel         *label,
						   GtkWidget        *widget);
116
GtkWidget *gtk_label_get_mnemonic_widget          (GtkLabel         *label);
117
void     gtk_label_set_text_with_mnemonic         (GtkLabel         *label,
Havoc Pennington's avatar
Havoc Pennington committed
118
						   const gchar      *str);
119 120
void     gtk_label_set_justify                    (GtkLabel         *label,
						   GtkJustification  jtype);
121
GtkJustification gtk_label_get_justify            (GtkLabel         *label);
122 123 124
void     gtk_label_set_ellipsize		  (GtkLabel         *label,
						   PangoEllipsizeMode mode);
PangoEllipsizeMode gtk_label_get_ellipsize        (GtkLabel         *label);
125 126 127
void     gtk_label_set_width_chars		  (GtkLabel         *label,
						   gint              n_chars);
gint     gtk_label_get_width_chars                (GtkLabel         *label);
128 129 130
void     gtk_label_set_max_width_chars    	  (GtkLabel         *label,
					  	   gint              n_chars);
gint     gtk_label_get_max_width_chars  	  (GtkLabel         *label);
131 132 133 134
void     gtk_label_set_pattern                    (GtkLabel         *label,
						   const gchar      *pattern);
void     gtk_label_set_line_wrap                  (GtkLabel         *label,
						   gboolean          wrap);
135
gboolean gtk_label_get_line_wrap                  (GtkLabel         *label);
136 137 138
void     gtk_label_set_line_wrap_mode             (GtkLabel         *label,
						   PangoWrapMode     wrap_mode);
PangoWrapMode gtk_label_get_line_wrap_mode        (GtkLabel         *label);
139 140 141
void     gtk_label_set_selectable                 (GtkLabel         *label,
						   gboolean          setting);
gboolean gtk_label_get_selectable                 (GtkLabel         *label);
142 143 144
void     gtk_label_set_angle                      (GtkLabel         *label,
						   gdouble           angle);
gdouble  gtk_label_get_angle                      (GtkLabel         *label);
145 146 147
void     gtk_label_select_region                  (GtkLabel         *label,
						   gint              start_offset,
						   gint              end_offset);
148 149 150
gboolean gtk_label_get_selection_bounds           (GtkLabel         *label,
                                                   gint             *start,
                                                   gint             *end);
151 152 153 154 155 156

PangoLayout *gtk_label_get_layout         (GtkLabel *label);
void         gtk_label_get_layout_offsets (GtkLabel *label,
                                           gint     *x,
                                           gint     *y);

157 158 159
void         gtk_label_set_single_line_mode  (GtkLabel *label,
                                              gboolean single_line_mode);
gboolean     gtk_label_get_single_line_mode  (GtkLabel *label);
160

161
const gchar *gtk_label_get_current_uri (GtkLabel *label);
162 163 164
void         gtk_label_set_track_visited_links  (GtkLabel *label,
                                                 gboolean  track_links);
gboolean     gtk_label_get_track_visited_links  (GtkLabel *label);
165

166

167 168 169 170
/* private */

void _gtk_label_mnemonics_visible_apply_recursively (GtkWidget *widget,
                                                     gboolean   mnemonics_visible);
171 172
gint _gtk_label_get_cursor_position (GtkLabel *label);
gint _gtk_label_get_selection_bound (GtkLabel *label);
173

174
G_END_DECLS
Elliot Lee's avatar
Elliot Lee committed
175 176

#endif /* __GTK_LABEL_H__ */