X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtktextsegment.h;h=42c0c28200dd8526983f6818dce0d29c7945aaaa;hb=563eb60666d9f72c38d7542b0ab37841e6aac488;hp=d3fe77e82a34969cd4604ae666427c88d696da1a;hpb=9ae724bf4d72d1eed98f3e55a640b31ff552e8f1;p=~andy%2Fgtk diff --git a/gtk/gtktextsegment.h b/gtk/gtktextsegment.h index d3fe77e82..42c0c2820 100644 --- a/gtk/gtktextsegment.h +++ b/gtk/gtktextsegment.h @@ -1,9 +1,37 @@ -#ifndef GTK_TEXT_SEGMENT_H -#define GTK_TEXT_SEGMENT_H +/* GTK - The GIMP Toolkit + * gtktextsegment.h Copyright (C) 2000 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * 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 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + */ + +/* + * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GTK+ Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +#ifndef __GTK_TEXT_SEGMENT_H__ +#define __GTK_TEXT_SEGMENT_H__ + +#include +#include +#include +#include +#include + +G_BEGIN_DECLS /* * Segments: each line is divided into one or more segments, where each @@ -15,11 +43,6 @@ extern "C" { /* This header has the segment type, and two specific segments (character and toggle segments) */ -#include -#include -#include -#include - /* Information a BTree stores about a tag. */ typedef struct _GtkTextTagInfo GtkTextTagInfo; struct _GtkTextTagInfo { @@ -39,17 +62,36 @@ struct _GtkTextToggleBody { /* Class struct for segments */ -typedef GtkTextLineSegment *(* GtkTextLineSegmentSplitFunc) (GtkTextLineSegment *segPtr, - int index); -typedef gboolean (* GtkTextViewSegDeleteFunc) (GtkTextLineSegment *segPtr, - GtkTextLine *line, - gboolean treeGone); -typedef GtkTextLineSegment *(* GtkTextViewSegCleanupFunc) (GtkTextLineSegment *segPtr, - GtkTextLine *line); -typedef void (* GtkTextLineSegmentLineChangeFunc) (GtkTextLineSegment *segPtr, - GtkTextLine *line); -typedef void (* GtkTextViewSegCheckFunc) (GtkTextLineSegment *segPtr, - GtkTextLine *line); +/* Split seg at index, returning list of two new segments, and freeing seg */ +typedef GtkTextLineSegment* (*GtkTextSegSplitFunc) (GtkTextLineSegment *seg, + gint index); + +/* Delete seg which is contained in line; if tree_gone, the tree is being + * freed in its entirety, which may matter for some reason (?) + * Return TRUE if the segment is not deleteable, e.g. a mark. + */ +typedef gboolean (*GtkTextSegDeleteFunc) (GtkTextLineSegment *seg, + GtkTextLine *line, + gboolean tree_gone); + +/* Called after segment structure of line changes, so segments can + * cleanup (e.g. merge with adjacent segments). Returns a segment list + * to replace the original segment list with. The line argument is + * the current line. + */ +typedef GtkTextLineSegment* (*GtkTextSegCleanupFunc) (GtkTextLineSegment *seg, + GtkTextLine *line); + +/* Called when a segment moves from one line to another. CleanupFunc is also + * called in that case, so many segments just use CleanupFunc, I'm not sure + * what's up with that (this function may not be needed...) + */ +typedef void (*GtkTextSegLineChangeFunc) (GtkTextLineSegment *seg, + GtkTextLine *line); + +/* Called to do debug checks on the segment. */ +typedef void (*GtkTextSegCheckFunc) (GtkTextLineSegment *seg, + GtkTextLine *line); struct _GtkTextLineSegmentClass { char *name; /* Name of this kind of segment. */ @@ -58,28 +100,28 @@ struct _GtkTextLineSegmentClass { * attach to character to its left * or right? 1 means left, 0 means * right. */ - GtkTextLineSegmentSplitFunc splitFunc; /* Procedure to split large segment + GtkTextSegSplitFunc splitFunc; /* Procedure to split large segment * into two smaller ones. */ - GtkTextViewSegDeleteFunc deleteFunc; /* Procedure to call to delete - * segment. */ - GtkTextViewSegCleanupFunc cleanupFunc; /* After any change to a line, this - * procedure is invoked for all - * segments left in the line to - * perform any cleanup they wish - * (e.g. joining neighboring - * segments). */ - GtkTextLineSegmentLineChangeFunc lineChangeFunc; - /* Invoked when a segment is about - * to be moved from its current line - * to an earlier line because of - * a deletion. The line is that - * for the segment's old line. - * CleanupFunc will be invoked after - * the deletion is finished. */ - - GtkTextViewSegCheckFunc checkFunc; /* Called during consistency checks - * to check internal consistency of + GtkTextSegDeleteFunc deleteFunc; /* Procedure to call to delete * segment. */ + GtkTextSegCleanupFunc cleanupFunc; /* After any change to a line, this + * procedure is invoked for all + * segments left in the line to + * perform any cleanup they wish + * (e.g. joining neighboring + * segments). */ + GtkTextSegLineChangeFunc lineChangeFunc; + /* Invoked when a segment is about + * to be moved from its current line + * to an earlier line because of + * a deletion. The line is that + * for the segment's old line. + * CleanupFunc will be invoked after + * the deletion is finished. */ + + GtkTextSegCheckFunc checkFunc; /* Called during consistency checks + * to check internal consistency of + * segment. */ }; /* @@ -87,13 +129,13 @@ struct _GtkTextLineSegmentClass { */ struct _GtkTextLineSegment { - GtkTextLineSegmentClass *type; /* Pointer to record describing + const GtkTextLineSegmentClass *type; /* Pointer to record describing * segment's type. */ - GtkTextLineSegment *next; /* Next in list of segments for this + GtkTextLineSegment *next; /* Next in list of segments for this * line, or NULL for end of list. */ int char_count; /* # of chars of index space occupied */ - + int byte_count; /* Size of this segment (# of bytes * of index space it occupies). */ union { @@ -102,26 +144,27 @@ struct _GtkTextLineSegment { * hold as many characters as needed.*/ GtkTextToggleBody toggle; /* Information about tag toggle. */ GtkTextMarkBody mark; /* Information about mark. */ - GtkTextPixmap pixmap; /* Child pixmap */ -#if 0 - GtkTextChild child; /* child widget */ -#endif + GtkTextPixbuf pixbuf; /* Child pixbuf */ + GtkTextChildBody child; /* Child widget */ } body; }; -GtkTextLineSegment *gtk_text_line_segment_split(const GtkTextIter *iter); - -GtkTextLineSegment *char_segment_new(const gchar *text, guint len); +GtkTextLineSegment *gtk_text_line_segment_split (const GtkTextIter *iter); -GtkTextLineSegment *char_segment_new_from_two_strings(const gchar *text1, guint len1, - const gchar *text2, guint len2); +GtkTextLineSegment *_gtk_char_segment_new (const gchar *text, + guint len); +GtkTextLineSegment *_gtk_char_segment_new_from_two_strings (const gchar *text1, + guint len1, + guint chars1, + const gchar *text2, + guint len2, + guint chars2); +GtkTextLineSegment *_gtk_toggle_segment_new (GtkTextTagInfo *info, + gboolean on); -GtkTextLineSegment *toggle_segment_new(GtkTextTagInfo *info, gboolean on); -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif