Blame gtk/gtktexttag.h

Packit 98cdb6
/* gtktexttag.c - text tag object
Packit 98cdb6
 *
Packit 98cdb6
 * Copyright (c) 1992-1994 The Regents of the University of California.
Packit 98cdb6
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
Packit 98cdb6
 * Copyright (c) 2000      Red Hat, Inc.
Packit 98cdb6
 * Tk -> Gtk port by Havoc Pennington <hp@redhat.com>
Packit 98cdb6
 *
Packit 98cdb6
 * This software is copyrighted by the Regents of the University of
Packit 98cdb6
 * California, Sun Microsystems, Inc., and other parties.  The
Packit 98cdb6
 * following terms apply to all files associated with the software
Packit 98cdb6
 * unless explicitly disclaimed in individual files.
Packit 98cdb6
 *
Packit 98cdb6
 * The authors hereby grant permission to use, copy, modify,
Packit 98cdb6
 * distribute, and license this software and its documentation for any
Packit 98cdb6
 * purpose, provided that existing copyright notices are retained in
Packit 98cdb6
 * all copies and that this notice is included verbatim in any
Packit 98cdb6
 * distributions. No written agreement, license, or royalty fee is
Packit 98cdb6
 * required for any of the authorized uses.  Modifications to this
Packit 98cdb6
 * software may be copyrighted by their authors and need not follow
Packit 98cdb6
 * the licensing terms described here, provided that the new terms are
Packit 98cdb6
 * clearly indicated on the first page of each file where they apply.
Packit 98cdb6
 *
Packit 98cdb6
 * IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY
Packit 98cdb6
 * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
Packit 98cdb6
 * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION,
Packit 98cdb6
 * OR ANY DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED
Packit 98cdb6
 * OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 98cdb6
 *
Packit 98cdb6
 * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
Packit 98cdb6
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
Packit 98cdb6
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
Packit 98cdb6
 * NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
Packit 98cdb6
 * AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
Packit 98cdb6
 * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
Packit 98cdb6
 *
Packit 98cdb6
 * GOVERNMENT USE: If you are acquiring this software on behalf of the
Packit 98cdb6
 * U.S. government, the Government shall have only "Restricted Rights"
Packit 98cdb6
 * in the software and related documentation as defined in the Federal
Packit 98cdb6
 * Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2).  If you
Packit 98cdb6
 * are acquiring the software on behalf of the Department of Defense,
Packit 98cdb6
 * the software shall be classified as "Commercial Computer Software"
Packit 98cdb6
 * and the Government shall have only "Restricted Rights" as defined
Packit 98cdb6
 * in Clause 252.227-7013 (c) (1) of DFARs.  Notwithstanding the
Packit 98cdb6
 * foregoing, the authors grant the U.S. Government and others acting
Packit 98cdb6
 * in its behalf permission to use and distribute the software in
Packit 98cdb6
 * accordance with the terms specified in this license.
Packit 98cdb6
 *
Packit 98cdb6
 */
Packit 98cdb6
Packit 98cdb6
#ifndef __GTK_TEXT_TAG_H__
Packit 98cdb6
#define __GTK_TEXT_TAG_H__
Packit 98cdb6
Packit 98cdb6
Packit 98cdb6
#if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
Packit 98cdb6
#error "Only <gtk/gtk.h> can be included directly."
Packit 98cdb6
#endif
Packit 98cdb6
Packit 98cdb6
#include <gdk/gdk.h>
Packit 98cdb6
#include <gtk/gtkenums.h>
Packit 98cdb6
Packit 98cdb6
/* Not needed, retained for compatibility -Yosh */
Packit 98cdb6
#include <gtk/gtkobject.h>
Packit 98cdb6
Packit 98cdb6
Packit 98cdb6
G_BEGIN_DECLS
Packit 98cdb6
Packit 98cdb6
typedef struct _GtkTextIter GtkTextIter;
Packit 98cdb6
typedef struct _GtkTextTagTable GtkTextTagTable;
Packit 98cdb6
Packit 98cdb6
typedef struct _GtkTextAttributes GtkTextAttributes;
Packit 98cdb6
Packit 98cdb6
#define GTK_TYPE_TEXT_TAG            (gtk_text_tag_get_type ())
Packit 98cdb6
#define GTK_TEXT_TAG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TEXT_TAG, GtkTextTag))
Packit 98cdb6
#define GTK_TEXT_TAG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEXT_TAG, GtkTextTagClass))
Packit 98cdb6
#define GTK_IS_TEXT_TAG(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TEXT_TAG))
Packit 98cdb6
#define GTK_IS_TEXT_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT_TAG))
Packit 98cdb6
#define GTK_TEXT_TAG_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TEXT_TAG, GtkTextTagClass))
Packit 98cdb6
Packit 98cdb6
#define GTK_TYPE_TEXT_ATTRIBUTES     (gtk_text_attributes_get_type ())
Packit 98cdb6
Packit 98cdb6
typedef struct _GtkTextTag GtkTextTag;
Packit 98cdb6
typedef struct _GtkTextTagClass GtkTextTagClass;
Packit 98cdb6
Packit 98cdb6
struct _GtkTextTag
Packit 98cdb6
{
Packit 98cdb6
  GObject parent_instance;
Packit 98cdb6
Packit 98cdb6
  GtkTextTagTable *GSEAL (table);
Packit 98cdb6
Packit 98cdb6
  char *GSEAL (name);           /* Name of this tag.  This field is actually
Packit 98cdb6
                                 * a pointer to the key from the entry in
Packit 98cdb6
                                 * tkxt->tagTable, so it needn't be freed
Packit 98cdb6
                                 * explicitly. */
Packit 98cdb6
  int GSEAL (priority);  /* Priority of this tag within widget.  0
Packit 98cdb6
                         * means lowest priority.  Exactly one tag
Packit 98cdb6
                         * has each integer value between 0 and
Packit 98cdb6
                         * numTags-1. */
Packit 98cdb6
  /*
Packit 98cdb6
   * Information for displaying text with this tag.  The information
Packit 98cdb6
   * belows acts as an override on information specified by lower-priority
Packit 98cdb6
   * tags.  If no value is specified, then the next-lower-priority tag
Packit 98cdb6
   * on the text determins the value.  The text widget itself provides
Packit 98cdb6
   * defaults if no tag specifies an override.
Packit 98cdb6
   */
Packit 98cdb6
Packit 98cdb6
  GtkTextAttributes *GSEAL (values);
Packit 98cdb6
  
Packit 98cdb6
  /* Flags for whether a given value is set; if a value is unset, then
Packit 98cdb6
   * this tag does not affect it.
Packit 98cdb6
   */
Packit 98cdb6
  guint GSEAL (bg_color_set) : 1;
Packit 98cdb6
  guint GSEAL (bg_stipple_set) : 1;
Packit 98cdb6
  guint GSEAL (fg_color_set) : 1;
Packit 98cdb6
  guint GSEAL (scale_set) : 1;
Packit 98cdb6
  guint GSEAL (fg_stipple_set) : 1;
Packit 98cdb6
  guint GSEAL (justification_set) : 1;
Packit 98cdb6
  guint GSEAL (left_margin_set) : 1;
Packit 98cdb6
  guint GSEAL (indent_set) : 1;
Packit 98cdb6
  guint GSEAL (rise_set) : 1;
Packit 98cdb6
  guint GSEAL (strikethrough_set) : 1;
Packit 98cdb6
  guint GSEAL (right_margin_set) : 1;
Packit 98cdb6
  guint GSEAL (pixels_above_lines_set) : 1;
Packit 98cdb6
  guint GSEAL (pixels_below_lines_set) : 1;
Packit 98cdb6
  guint GSEAL (pixels_inside_wrap_set) : 1;
Packit 98cdb6
  guint GSEAL (tabs_set) : 1;
Packit 98cdb6
  guint GSEAL (underline_set) : 1;
Packit 98cdb6
  guint GSEAL (wrap_mode_set) : 1;
Packit 98cdb6
  guint GSEAL (bg_full_height_set) : 1;
Packit 98cdb6
  guint GSEAL (invisible_set) : 1;
Packit 98cdb6
  guint GSEAL (editable_set) : 1;
Packit 98cdb6
  guint GSEAL (language_set) : 1;
Packit 98cdb6
  guint GSEAL (pg_bg_color_set) : 1;
Packit 98cdb6
Packit 98cdb6
  /* Whether these margins accumulate or override */
Packit 98cdb6
  guint GSEAL (accumulative_margin) : 1;
Packit 98cdb6
Packit 98cdb6
  guint GSEAL (pad1) : 1;
Packit 98cdb6
};
Packit 98cdb6
Packit 98cdb6
struct _GtkTextTagClass
Packit 98cdb6
{
Packit 98cdb6
  GObjectClass parent_class;
Packit 98cdb6
Packit 98cdb6
  gboolean (* event) (GtkTextTag        *tag,
Packit 98cdb6
                      GObject           *event_object, /* widget, canvas item, whatever */
Packit 98cdb6
                      GdkEvent          *event,        /* the event itself */
Packit 98cdb6
                      const GtkTextIter *iter);        /* location of event in buffer */
Packit 98cdb6
Packit 98cdb6
  /* Padding for future expansion */
Packit 98cdb6
  void (*_gtk_reserved1) (void);
Packit 98cdb6
  void (*_gtk_reserved2) (void);
Packit 98cdb6
  void (*_gtk_reserved3) (void);
Packit 98cdb6
  void (*_gtk_reserved4) (void);
Packit 98cdb6
};
Packit 98cdb6
Packit 98cdb6
GType        gtk_text_tag_get_type     (void) G_GNUC_CONST;
Packit 98cdb6
GtkTextTag  *gtk_text_tag_new          (const gchar       *name);
Packit 98cdb6
gint         gtk_text_tag_get_priority (GtkTextTag        *tag);
Packit 98cdb6
void         gtk_text_tag_set_priority (GtkTextTag        *tag,
Packit 98cdb6
                                        gint               priority);
Packit 98cdb6
gboolean     gtk_text_tag_event        (GtkTextTag        *tag,
Packit 98cdb6
                                        GObject           *event_object,
Packit 98cdb6
                                        GdkEvent          *event,
Packit 98cdb6
                                        const GtkTextIter *iter);
Packit 98cdb6
Packit 98cdb6
/*
Packit 98cdb6
 * Style object created by folding a set of tags together
Packit 98cdb6
 */
Packit 98cdb6
Packit 98cdb6
typedef struct _GtkTextAppearance GtkTextAppearance;
Packit 98cdb6
Packit 98cdb6
struct _GtkTextAppearance
Packit 98cdb6
{
Packit 98cdb6
  /*< public >*/
Packit 98cdb6
  GdkColor bg_color;
Packit 98cdb6
  GdkColor fg_color;
Packit 98cdb6
  GdkBitmap *bg_stipple;
Packit 98cdb6
  GdkBitmap *fg_stipple;
Packit 98cdb6
Packit 98cdb6
  /* super/subscript rise, can be negative */
Packit 98cdb6
  gint rise;
Packit 98cdb6
Packit 98cdb6
  /*< private >*/
Packit 98cdb6
  /* I'm not sure this can really be used without breaking some things
Packit 98cdb6
   * an app might do :-/
Packit 98cdb6
   */
Packit 98cdb6
  gpointer padding1;
Packit 98cdb6
Packit 98cdb6
  /*< public >*/
Packit 98cdb6
  guint underline : 4;          /* PangoUnderline */
Packit 98cdb6
  guint strikethrough : 1;
Packit 98cdb6
Packit 98cdb6
  /* Whether to use background-related values; this is irrelevant for
Packit 98cdb6
   * the values struct when in a tag, but is used for the composite
Packit 98cdb6
   * values struct; it's true if any of the tags being composited
Packit 98cdb6
   * had background stuff set.
Packit 98cdb6
   */
Packit 98cdb6
  guint draw_bg : 1;
Packit 98cdb6
  
Packit 98cdb6
  /* These are only used when we are actually laying out and rendering
Packit 98cdb6
   * a paragraph; not when a GtkTextAppearance is part of a
Packit 98cdb6
   * GtkTextAttributes.
Packit 98cdb6
   */
Packit 98cdb6
  guint inside_selection : 1;
Packit 98cdb6
  guint is_text : 1;
Packit 98cdb6
Packit 98cdb6
  /*< private >*/
Packit 98cdb6
  guint pad1 : 1;
Packit 98cdb6
  guint pad2 : 1;
Packit 98cdb6
  guint pad3 : 1;
Packit 98cdb6
  guint pad4 : 1;
Packit 98cdb6
};
Packit 98cdb6
Packit 98cdb6
struct _GtkTextAttributes
Packit 98cdb6
{
Packit 98cdb6
  /*< private >*/
Packit 98cdb6
  guint refcount;
Packit 98cdb6
Packit 98cdb6
  /*< public >*/
Packit 98cdb6
  GtkTextAppearance appearance;
Packit 98cdb6
Packit 98cdb6
  GtkJustification justification;
Packit 98cdb6
  GtkTextDirection direction;
Packit 98cdb6
Packit 98cdb6
  /* Individual chunks of this can be set/unset as a group */
Packit 98cdb6
  PangoFontDescription *font;
Packit 98cdb6
Packit 98cdb6
  gdouble font_scale;
Packit 98cdb6
  
Packit 98cdb6
  gint left_margin;
Packit 98cdb6
Packit 98cdb6
  gint indent;  
Packit 98cdb6
Packit 98cdb6
  gint right_margin;
Packit 98cdb6
Packit 98cdb6
  gint pixels_above_lines;
Packit 98cdb6
Packit 98cdb6
  gint pixels_below_lines;
Packit 98cdb6
Packit 98cdb6
  gint pixels_inside_wrap;
Packit 98cdb6
Packit 98cdb6
  PangoTabArray *tabs;
Packit 98cdb6
Packit 98cdb6
  GtkWrapMode wrap_mode;        /* How to handle wrap-around for this tag.
Packit 98cdb6
                                 * Must be GTK_WRAPMODE_CHAR,
Packit 98cdb6
                                 * GTK_WRAPMODE_NONE, GTK_WRAPMODE_WORD
Packit 98cdb6
                                 */
Packit 98cdb6
Packit 98cdb6
  PangoLanguage *language;
Packit 98cdb6
Packit 98cdb6
  /*< private >*/
Packit 98cdb6
  GdkColor *pg_bg_color;
Packit 98cdb6
Packit 98cdb6
  /*< public >*/
Packit 98cdb6
  /* hide the text  */
Packit 98cdb6
  guint invisible : 1;
Packit 98cdb6
Packit 98cdb6
  /* Background is fit to full line height rather than
Packit 98cdb6
   * baseline +/- ascent/descent (font height)
Packit 98cdb6
   */
Packit 98cdb6
  guint bg_full_height : 1;
Packit 98cdb6
Packit 98cdb6
  /* can edit this text */
Packit 98cdb6
  guint editable : 1;
Packit 98cdb6
Packit 98cdb6
  /* colors are allocated etc. */
Packit 98cdb6
  guint realized : 1;
Packit 98cdb6
Packit 98cdb6
  /*< private >*/
Packit 98cdb6
  guint pad1 : 1;
Packit 98cdb6
  guint pad2 : 1;
Packit 98cdb6
  guint pad3 : 1;
Packit 98cdb6
  guint pad4 : 1;
Packit 98cdb6
};
Packit 98cdb6
Packit 98cdb6
GtkTextAttributes* gtk_text_attributes_new         (void);
Packit 98cdb6
GtkTextAttributes* gtk_text_attributes_copy        (GtkTextAttributes *src);
Packit 98cdb6
void               gtk_text_attributes_copy_values (GtkTextAttributes *src,
Packit 98cdb6
                                                    GtkTextAttributes *dest);
Packit 98cdb6
void               gtk_text_attributes_unref       (GtkTextAttributes *values);
Packit 98cdb6
GtkTextAttributes *gtk_text_attributes_ref         (GtkTextAttributes *values);
Packit 98cdb6
Packit 98cdb6
GType              gtk_text_attributes_get_type    (void) G_GNUC_CONST;
Packit 98cdb6
Packit 98cdb6
Packit 98cdb6
G_END_DECLS
Packit 98cdb6
Packit 98cdb6
#endif
Packit 98cdb6