You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

208 line
8.4 KiB

  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, write to the Free
  16. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  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. #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
  25. #error "Only <gtk/gtk.h> can be included directly."
  26. #endif
  27. #ifndef __GTK_LABEL_H__
  28. #define __GTK_LABEL_H__
  29. #include <gtk/gtkmisc.h>
  30. #include <gtk/gtkwindow.h>
  31. #include <gtk/gtkmenu.h>
  32. G_BEGIN_DECLS
  33. #define GTK_TYPE_LABEL (gtk_label_get_type ())
  34. #define GTK_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LABEL, GtkLabel))
  35. #define GTK_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LABEL, GtkLabelClass))
  36. #define GTK_IS_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LABEL))
  37. #define GTK_IS_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LABEL))
  38. #define GTK_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LABEL, GtkLabelClass))
  39. typedef struct _GtkLabel GtkLabel;
  40. typedef struct _GtkLabelClass GtkLabelClass;
  41. typedef struct _GtkLabelSelectionInfo GtkLabelSelectionInfo;
  42. struct _GtkLabel
  43. {
  44. GtkMisc misc;
  45. /*< private >*/
  46. gchar *GSEAL (label);
  47. guint GSEAL (jtype) : 2;
  48. guint GSEAL (wrap) : 1;
  49. guint GSEAL (use_underline) : 1;
  50. guint GSEAL (use_markup) : 1;
  51. guint GSEAL (ellipsize) : 3;
  52. guint GSEAL (single_line_mode) : 1;
  53. guint GSEAL (have_transform) : 1;
  54. guint GSEAL (in_click) : 1;
  55. guint GSEAL (wrap_mode) : 3;
  56. guint GSEAL (pattern_set) : 1;
  57. guint GSEAL (track_links) : 1;
  58. guint GSEAL (mnemonic_keyval);
  59. gchar *GSEAL (text);
  60. PangoAttrList *GSEAL (attrs);
  61. PangoAttrList *GSEAL (effective_attrs);
  62. PangoLayout *GSEAL (layout);
  63. GtkWidget *GSEAL (mnemonic_widget);
  64. GtkWindow *GSEAL (mnemonic_window);
  65. GtkLabelSelectionInfo *GSEAL (select_info);
  66. };
  67. struct _GtkLabelClass
  68. {
  69. GtkMiscClass parent_class;
  70. void (* move_cursor) (GtkLabel *label,
  71. GtkMovementStep step,
  72. gint count,
  73. gboolean extend_selection);
  74. void (* copy_clipboard) (GtkLabel *label);
  75. /* Hook to customize right-click popup for selectable labels */
  76. void (* populate_popup) (GtkLabel *label,
  77. GtkMenu *menu);
  78. gboolean (*activate_link) (GtkLabel *label,
  79. const gchar *uri);
  80. /* Padding for future expansion */
  81. void (*_gtk_reserved1) (void);
  82. void (*_gtk_reserved2) (void);
  83. void (*_gtk_reserved3) (void);
  84. };
  85. GType gtk_label_get_type (void) G_GNUC_CONST;
  86. GtkWidget* gtk_label_new (const gchar *str);
  87. GtkWidget* gtk_label_new_with_mnemonic (const gchar *str);
  88. void gtk_label_set_text (GtkLabel *label,
  89. const gchar *str);
  90. G_CONST_RETURN gchar* gtk_label_get_text (GtkLabel *label);
  91. void gtk_label_set_attributes (GtkLabel *label,
  92. PangoAttrList *attrs);
  93. PangoAttrList *gtk_label_get_attributes (GtkLabel *label);
  94. void gtk_label_set_label (GtkLabel *label,
  95. const gchar *str);
  96. G_CONST_RETURN gchar *gtk_label_get_label (GtkLabel *label);
  97. void gtk_label_set_markup (GtkLabel *label,
  98. const gchar *str);
  99. void gtk_label_set_use_markup (GtkLabel *label,
  100. gboolean setting);
  101. gboolean gtk_label_get_use_markup (GtkLabel *label);
  102. void gtk_label_set_use_underline (GtkLabel *label,
  103. gboolean setting);
  104. gboolean gtk_label_get_use_underline (GtkLabel *label);
  105. void gtk_label_set_markup_with_mnemonic (GtkLabel *label,
  106. const gchar *str);
  107. guint gtk_label_get_mnemonic_keyval (GtkLabel *label);
  108. void gtk_label_set_mnemonic_widget (GtkLabel *label,
  109. GtkWidget *widget);
  110. GtkWidget *gtk_label_get_mnemonic_widget (GtkLabel *label);
  111. void gtk_label_set_text_with_mnemonic (GtkLabel *label,
  112. const gchar *str);
  113. void gtk_label_set_justify (GtkLabel *label,
  114. GtkJustification jtype);
  115. GtkJustification gtk_label_get_justify (GtkLabel *label);
  116. void gtk_label_set_ellipsize (GtkLabel *label,
  117. PangoEllipsizeMode mode);
  118. PangoEllipsizeMode gtk_label_get_ellipsize (GtkLabel *label);
  119. void gtk_label_set_width_chars (GtkLabel *label,
  120. gint n_chars);
  121. gint gtk_label_get_width_chars (GtkLabel *label);
  122. void gtk_label_set_max_width_chars (GtkLabel *label,
  123. gint n_chars);
  124. gint gtk_label_get_max_width_chars (GtkLabel *label);
  125. void gtk_label_set_pattern (GtkLabel *label,
  126. const gchar *pattern);
  127. void gtk_label_set_line_wrap (GtkLabel *label,
  128. gboolean wrap);
  129. gboolean gtk_label_get_line_wrap (GtkLabel *label);
  130. void gtk_label_set_line_wrap_mode (GtkLabel *label,
  131. PangoWrapMode wrap_mode);
  132. PangoWrapMode gtk_label_get_line_wrap_mode (GtkLabel *label);
  133. void gtk_label_set_selectable (GtkLabel *label,
  134. gboolean setting);
  135. gboolean gtk_label_get_selectable (GtkLabel *label);
  136. void gtk_label_set_angle (GtkLabel *label,
  137. gdouble angle);
  138. gdouble gtk_label_get_angle (GtkLabel *label);
  139. void gtk_label_select_region (GtkLabel *label,
  140. gint start_offset,
  141. gint end_offset);
  142. gboolean gtk_label_get_selection_bounds (GtkLabel *label,
  143. gint *start,
  144. gint *end);
  145. PangoLayout *gtk_label_get_layout (GtkLabel *label);
  146. void gtk_label_get_layout_offsets (GtkLabel *label,
  147. gint *x,
  148. gint *y);
  149. void gtk_label_set_single_line_mode (GtkLabel *label,
  150. gboolean single_line_mode);
  151. gboolean gtk_label_get_single_line_mode (GtkLabel *label);
  152. G_CONST_RETURN gchar *gtk_label_get_current_uri (GtkLabel *label);
  153. void gtk_label_set_track_visited_links (GtkLabel *label,
  154. gboolean track_links);
  155. gboolean gtk_label_get_track_visited_links (GtkLabel *label);
  156. #ifndef GTK_DISABLE_DEPRECATED
  157. #define gtk_label_set gtk_label_set_text
  158. void gtk_label_get (GtkLabel *label,
  159. gchar **str);
  160. /* Convenience function to set the name and pattern by parsing
  161. * a string with embedded underscores, and return the appropriate
  162. * key symbol for the accelerator.
  163. */
  164. guint gtk_label_parse_uline (GtkLabel *label,
  165. const gchar *string);
  166. #endif /* GTK_DISABLE_DEPRECATED */
  167. /* private */
  168. void _gtk_label_mnemonics_visible_apply_recursively (GtkWidget *widget,
  169. gboolean mnemonics_visible);
  170. G_END_DECLS
  171. #endif /* __GTK_LABEL_H__ */