Blame gtk/gtktextsegment.h

Packit Service fb6fa5
/* GTK - The GIMP Toolkit
Packit Service fb6fa5
 * gtktextsegment.h Copyright (C) 2000 Red Hat, Inc.
Packit Service fb6fa5
 *
Packit Service fb6fa5
 * This library is free software; you can redistribute it and/or
Packit Service fb6fa5
 * modify it under the terms of the GNU Lesser General Public
Packit Service fb6fa5
 * License as published by the Free Software Foundation; either
Packit Service fb6fa5
 * version 2 of the License, or (at your option) any later version.
Packit Service fb6fa5
 *
Packit Service fb6fa5
 * This library is distributed in the hope that it will be useful,
Packit Service fb6fa5
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service fb6fa5
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service fb6fa5
 * Lesser General Public License for more details.
Packit Service fb6fa5
 *
Packit Service fb6fa5
 * You should have received a copy of the GNU Lesser General Public
Packit Service fb6fa5
 * License along with this library; if not, write to the
Packit Service fb6fa5
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Packit Service fb6fa5
 * Boston, MA 02111-1307, USA.
Packit Service fb6fa5
 */
Packit Service fb6fa5
Packit Service fb6fa5
/*
Packit Service fb6fa5
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
Packit Service fb6fa5
 * file for a list of people on the GTK+ Team.  See the ChangeLog
Packit Service fb6fa5
 * files for a list of changes.  These files are distributed with
Packit Service fb6fa5
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
Packit Service fb6fa5
 */
Packit Service fb6fa5
Packit Service fb6fa5
#ifndef __GTK_TEXT_SEGMENT_H__
Packit Service fb6fa5
#define __GTK_TEXT_SEGMENT_H__
Packit Service fb6fa5
Packit Service fb6fa5
#include <gtk/gtktexttag.h>
Packit Service fb6fa5
#include <gtk/gtktextiter.h>
Packit Service fb6fa5
#include <gtk/gtktextmarkprivate.h>
Packit Service fb6fa5
#include <gtk/gtktextchild.h>
Packit Service fb6fa5
#include <gtk/gtktextchildprivate.h>
Packit Service fb6fa5
Packit Service fb6fa5
G_BEGIN_DECLS
Packit Service fb6fa5
Packit Service fb6fa5
/*
Packit Service fb6fa5
 * Segments: each line is divided into one or more segments, where each
Packit Service fb6fa5
 * segment is one of several things, such as a group of characters, a
Packit Service fb6fa5
 * tag toggle, a mark, or an embedded widget.  Each segment starts with
Packit Service fb6fa5
 * a standard header followed by a body that varies from type to type.
Packit Service fb6fa5
 */
Packit Service fb6fa5
Packit Service fb6fa5
/* This header has the segment type, and two specific segments
Packit Service fb6fa5
   (character and toggle segments) */
Packit Service fb6fa5
Packit Service fb6fa5
/* Information a BTree stores about a tag. */
Packit Service fb6fa5
typedef struct _GtkTextTagInfo GtkTextTagInfo;
Packit Service fb6fa5
struct _GtkTextTagInfo {
Packit Service fb6fa5
  GtkTextTag *tag;
Packit Service fb6fa5
  GtkTextBTreeNode *tag_root; /* highest-level node containing the tag */
Packit Service fb6fa5
  gint toggle_count;      /* total toggles of this tag below tag_root */
Packit Service fb6fa5
};
Packit Service fb6fa5
Packit Service fb6fa5
/* Body of a segment that toggles a tag on or off */
Packit Service fb6fa5
struct _GtkTextToggleBody {
Packit Service fb6fa5
  GtkTextTagInfo *info;             /* Tag that starts or ends here. */
Packit Service fb6fa5
  gboolean inNodeCounts;             /* TRUE means this toggle has been
Packit Service fb6fa5
                                      * accounted for in node toggle
Packit Service fb6fa5
                                      * counts; FALSE means it hasn't, yet. */
Packit Service fb6fa5
};
Packit Service fb6fa5
Packit Service fb6fa5
Packit Service fb6fa5
/* Class struct for segments */
Packit Service fb6fa5
Packit Service fb6fa5
/* Split seg at index, returning list of two new segments, and freeing seg */
Packit Service fb6fa5
typedef GtkTextLineSegment* (*GtkTextSegSplitFunc)      (GtkTextLineSegment *seg,
Packit Service fb6fa5
                                                         gint                index);
Packit Service fb6fa5
Packit Service fb6fa5
/* Delete seg which is contained in line; if tree_gone, the tree is being
Packit Service fb6fa5
 * freed in its entirety, which may matter for some reason (?)
Packit Service fb6fa5
 * Return TRUE if the segment is not deleteable, e.g. a mark.
Packit Service fb6fa5
 */
Packit Service fb6fa5
typedef gboolean            (*GtkTextSegDeleteFunc)     (GtkTextLineSegment *seg,
Packit Service fb6fa5
                                                         GtkTextLine        *line,
Packit Service fb6fa5
                                                         gboolean            tree_gone);
Packit Service fb6fa5
Packit Service fb6fa5
/* Called after segment structure of line changes, so segments can
Packit Service fb6fa5
 * cleanup (e.g. merge with adjacent segments). Returns a segment list
Packit Service fb6fa5
 * to replace the original segment list with. The line argument is
Packit Service fb6fa5
 * the current line.
Packit Service fb6fa5
 */
Packit Service fb6fa5
typedef GtkTextLineSegment* (*GtkTextSegCleanupFunc)    (GtkTextLineSegment *seg,
Packit Service fb6fa5
                                                         GtkTextLine        *line);
Packit Service fb6fa5
Packit Service fb6fa5
/* Called when a segment moves from one line to another. CleanupFunc is also
Packit Service fb6fa5
 * called in that case, so many segments just use CleanupFunc, I'm not sure
Packit Service fb6fa5
 * what's up with that (this function may not be needed...)
Packit Service fb6fa5
 */
Packit Service fb6fa5
typedef void                (*GtkTextSegLineChangeFunc) (GtkTextLineSegment *seg,
Packit Service fb6fa5
                                                         GtkTextLine        *line);
Packit Service fb6fa5
Packit Service fb6fa5
/* Called to do debug checks on the segment. */
Packit Service fb6fa5
typedef void                (*GtkTextSegCheckFunc)      (GtkTextLineSegment *seg,
Packit Service fb6fa5
                                                         GtkTextLine        *line);
Packit Service fb6fa5
Packit Service fb6fa5
struct _GtkTextLineSegmentClass {
Packit Service fb6fa5
  char *name;                           /* Name of this kind of segment. */
Packit Service fb6fa5
  gboolean leftGravity;                 /* If a segment has zero size (e.g. a
Packit Service fb6fa5
                                         * mark or tag toggle), does it
Packit Service fb6fa5
                                         * attach to character to its left
Packit Service fb6fa5
                                         * or right?  1 means left, 0 means
Packit Service fb6fa5
                                         * right. */
Packit Service fb6fa5
  GtkTextSegSplitFunc splitFunc;        /* Procedure to split large segment
Packit Service fb6fa5
                                         * into two smaller ones. */
Packit Service fb6fa5
  GtkTextSegDeleteFunc deleteFunc;      /* Procedure to call to delete
Packit Service fb6fa5
                                         * segment. */
Packit Service fb6fa5
  GtkTextSegCleanupFunc cleanupFunc;   /* After any change to a line, this
Packit Service fb6fa5
                                        * procedure is invoked for all
Packit Service fb6fa5
                                        * segments left in the line to
Packit Service fb6fa5
                                        * perform any cleanup they wish
Packit Service fb6fa5
                                        * (e.g. joining neighboring
Packit Service fb6fa5
                                        * segments). */
Packit Service fb6fa5
  GtkTextSegLineChangeFunc lineChangeFunc;
Packit Service fb6fa5
  /* Invoked when a segment is about
Packit Service fb6fa5
   * to be moved from its current line
Packit Service fb6fa5
   * to an earlier line because of
Packit Service fb6fa5
   * a deletion.  The line is that
Packit Service fb6fa5
   * for the segment's old line.
Packit Service fb6fa5
   * CleanupFunc will be invoked after
Packit Service fb6fa5
   * the deletion is finished. */
Packit Service fb6fa5
Packit Service fb6fa5
  GtkTextSegCheckFunc checkFunc;       /* Called during consistency checks
Packit Service fb6fa5
                                        * to check internal consistency of
Packit Service fb6fa5
                                        * segment. */
Packit Service fb6fa5
};
Packit Service fb6fa5
Packit Service fb6fa5
/*
Packit Service fb6fa5
 * The data structure below defines line segments.
Packit Service fb6fa5
 */
Packit Service fb6fa5
Packit Service fb6fa5
struct _GtkTextLineSegment {
Packit Service fb6fa5
  const GtkTextLineSegmentClass *type;  /* Pointer to record describing
Packit Service fb6fa5
                                         * segment's type. */
Packit Service fb6fa5
  GtkTextLineSegment *next;             /* Next in list of segments for this
Packit Service fb6fa5
                                         * line, or NULL for end of list. */
Packit Service fb6fa5
Packit Service fb6fa5
  int char_count;                       /* # of chars of index space occupied */
Packit Service fb6fa5
Packit Service fb6fa5
  int byte_count;                       /* Size of this segment (# of bytes
Packit Service fb6fa5
                                         * of index space it occupies). */
Packit Service fb6fa5
  union {
Packit Service fb6fa5
    char chars[4];                      /* Characters that make up character
Packit Service fb6fa5
                                         * info.  Actual length varies to
Packit Service fb6fa5
                                         * hold as many characters as needed.*/
Packit Service fb6fa5
    GtkTextToggleBody toggle;              /* Information about tag toggle. */
Packit Service fb6fa5
    GtkTextMarkBody mark;              /* Information about mark. */
Packit Service fb6fa5
    GtkTextPixbuf pixbuf;              /* Child pixbuf */
Packit Service fb6fa5
    GtkTextChildBody child;            /* Child widget */
Packit Service fb6fa5
  } body;
Packit Service fb6fa5
};
Packit Service fb6fa5
Packit Service fb6fa5
Packit Service fb6fa5
GtkTextLineSegment  *gtk_text_line_segment_split (const GtkTextIter *iter);
Packit Service fb6fa5
Packit Service fb6fa5
GtkTextLineSegment *_gtk_char_segment_new                  (const gchar    *text,
Packit Service fb6fa5
                                                            guint           len);
Packit Service fb6fa5
GtkTextLineSegment *_gtk_char_segment_new_from_two_strings (const gchar    *text1,
Packit Service fb6fa5
                                                            guint           len1,
Packit Service fb6fa5
							    guint           chars1,
Packit Service fb6fa5
                                                            const gchar    *text2,
Packit Service fb6fa5
                                                            guint           len2,
Packit Service fb6fa5
							    guint           chars2);
Packit Service fb6fa5
GtkTextLineSegment *_gtk_toggle_segment_new                (GtkTextTagInfo *info,
Packit Service fb6fa5
                                                            gboolean        on);
Packit Service fb6fa5
Packit Service fb6fa5
Packit Service fb6fa5
G_END_DECLS
Packit Service fb6fa5
Packit Service fb6fa5
#endif
Packit Service fb6fa5
Packit Service fb6fa5