gtk2/gtk/gtktext.h
Owen Taylor dfba226908 Make parent_class static.
Sun Nov  5 04:24:53 2000  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkcellrenderertextpixbuf.c: Make parent_class
	static.

Tue Sep 19 10:54:22 2000  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkimcontext*.[ch] gtk/gtkimmulticontext.[ch]
	gtk/gtktextlayout.[ch] gtk/gtktextview.c gtk/gtkentry.c:
	Add support for positioning the cursor within the preedit string.

Mon Sep 18 23:56:32 2000  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtktextview.c: Check for bindings after passing
	events to im context filter.

Mon Sep 18 11:50:51 2000  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtktextlayout.c (add_preedit_attrs): Handle
	empty attribute lists properly.

Sun Sep 17 10:08:16 2000  Owen Taylor  <otaylor@redhat.com>

	* gtk/queryimmodules.c (main): Return non-zero exit
	status if errors were encountered querying any
	modules.

Sat Sep 16 14:01:52 2000  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtk.h: include gtkmodule.h gtkoldeditable.h,
	don't include gtkthemes.h.

	* gtk/testgtk.c gtk/testtext.c: Set environment variables
	to point

	* gtk/Makefile.am: Add new .c and .h files, build
	gtk-query-immodules and use it to create a gtk.immodules
	file for use of test programs.

	* gtk/gtkpreview.c: remove extra blank line.

Sat Sep 16 13:21:04 2000  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkimcontextsimple.c (gtk_im_context_simple_add_table):
	Add the ability to add extra tables beyond the default
	one, and also the ability to have compose sequences
	that are prefixes of other compose sequences.

	* gtk/gtkimcontextsimple.c: Export a preedit string which
	consists of possible candidates for keystrokes that have
	been entered but not yet committed.

	* gtk/gtkimcontext.[ch] gtk/immulticontext.[ch]
	gtk/gtkimcontextsimple.[ch]: add gtk_im_context_reset()

	* gtk/gtkmulticontext.[ch] (gtk_im_multicontext_append_menuitems):
	Add a function to add input-method switching menu items
	to a menu.

	* gtk/gtkimmulticontext.[ch]: Properly handly set_client_window
	when switching input methods.

	* gtk/gtkimcontextsimple.[ch]: Change the format of
	the compose table to allow compose tables of different
	lengths / sequence.

Sat Sep 16 13:05:48 2000  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkimmodule.[ch]: Support routines for loading
	GtkIMContext implementations dynamically at runtime.

	* gtk/queryimmodules.c: Program to query the available
	input modules and write the results into a file.

	* gtk/gtkrc.[ch] (gtk_rc_get_im_module_file): Add
	extra config options "im_module_file" (cache file for
	input method modules), and "im_module_path" - path
	to look for modules when generating cache file.

	This doesn't scale.

Sat Sep 16 13:09:06 2000  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkthemes.[ch] gtk/gtkmodule.[ch]: Move most of the
	generic	code from gtkthemes into a new abstraction
	GtkModule which has the logic for implementing
	a loadable module which implements a number of
	GObject types.

Sat Sep 16 13:07:13 2000  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkeditable.[ch]: Convert GtkEditable from
	a class into an interface

	* gtk/gtkoldeditable.[ch]: Move the old editable
	implementation into here, so legacy widgets can
	still rely on the implemenation. GtkOldEditable
	exports GtkEditable. Make selection handling
	code use new text conversion functions (and
	handle UTF-8 as a side-effect). Use GtkClipboard
	for CLIPBOARD.

	* gtk/gtktext.[ch] gtk/gtkcombo.c gtk/gtkspinbutton.c:
	Adopt to match above changes.

	* gtk/gtkentry.[ch]: Implement GtkEditable directly,
	avoid GtkOldEditable implementation. Restructure
        to reduce number of places that modify state directly.
	Move to GtkBindingSet. Display the preedit string.
	Queue recomputation of PangoLayout and scroll position
	to improve effiency of doing complex changes naively.
	Add a menu with cut/copy/paste and input method selection.

Thu Sep 14 22:11:05 2000  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtktextlayout.[ch]: Add gtk_text_layout_set_preedit_string()
	to set preedit string and attributes; display preedit string by
	inserting string and attributes at cursor when creating the
	GtkTextLineDisplay.

	* gtk/gtktextlayout.c: Move all conversions between byte
	positions in PangoLayout and GtkTextIter into new functions
	line_display_iter_to_index/index_to_iter that properly
	handle the preedit string.

	* gtk/gtktextmark.[ch]: Restore gtk_text_mark_get_name, modify
	it to return const char * (eventually will end up
	as GCONST char *, most likely.)

	* gtk/gtktextview.[ch]: Handle the preedit string, call
	gtk_im_context_reset() as necessary, add a menu to switch
	input methods.

	* gtk/gtktextlayout.[ch]: Remove useless
	gtk_text_layout_get_log_attrs() function.
2000-11-12 03:43:24 +00:00

221 lines
7.0 KiB
C

/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* 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/.
*/
#ifndef __GTK_TEXT_H__
#define __GTK_TEXT_H__
#include <gdk/gdk.h>
#include <gtk/gtkadjustment.h>
#include <gtk/gtkoldeditable.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define GTK_TYPE_TEXT (gtk_text_get_type ())
#define GTK_TEXT(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_TEXT, GtkText))
#define GTK_TEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEXT, GtkTextClass))
#define GTK_IS_TEXT(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_TEXT))
#define GTK_IS_TEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT))
#define GTK_TEXT_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_TEXT, GtkTextClass))
typedef struct _GtkTextFont GtkTextFont;
typedef struct _GtkPropertyMark GtkPropertyMark;
typedef struct _GtkText GtkText;
typedef struct _GtkTextClass GtkTextClass;
struct _GtkPropertyMark
{
/* Position in list. */
GList* property;
/* Offset into that property. */
guint offset;
/* Current index. */
guint index;
};
struct _GtkText
{
GtkOldEditable old_editable;
GdkWindow *text_area;
GtkAdjustment *hadj;
GtkAdjustment *vadj;
GdkGC *gc;
GdkPixmap* line_wrap_bitmap;
GdkPixmap* line_arrow_bitmap;
/* GAPPED TEXT SEGMENT */
/* The text, a single segment of text a'la emacs, with a gap
* where insertion occurs. */
union { GdkWChar *wc; guchar *ch; } text;
/* The allocated length of the text segment. */
guint text_len;
/* The gap position, index into address where a char
* should be inserted. */
guint gap_position;
/* The gap size, s.t. *(text + gap_position + gap_size) is
* the first valid character following the gap. */
guint gap_size;
/* The last character position, index into address where a
* character should be appeneded. Thus, text_end - gap_size
* is the length of the actual data. */
guint text_end;
/* LINE START CACHE */
/* A cache of line-start information. Data is a LineParam*. */
GList *line_start_cache;
/* Index to the start of the first visible line. */
guint first_line_start_index;
/* The number of pixels cut off of the top line. */
guint first_cut_pixels;
/* First visible horizontal pixel. */
guint first_onscreen_hor_pixel;
/* First visible vertical pixel. */
guint first_onscreen_ver_pixel;
/* FLAGS */
/* True iff this buffer is wrapping lines, otherwise it is using a
* horizontal scrollbar. */
guint line_wrap : 1;
guint word_wrap : 1;
/* If a fontset is supplied for the widget, use_wchar become true,
* and we use GdkWchar as the encoding of text. */
guint use_wchar : 1;
/* Frozen, don't do updates. @@@ fixme */
guint freeze_count;
/* TEXT PROPERTIES */
/* A doubly-linked-list containing TextProperty objects. */
GList *text_properties;
/* The end of this list. */
GList *text_properties_end;
/* The first node before or on the point along with its offset to
* the point and the buffer's current point. This is the only
* PropertyMark whose index is guaranteed to remain correct
* following a buffer insertion or deletion. */
GtkPropertyMark point;
/* SCRATCH AREA */
union { GdkWChar *wc; guchar *ch; } scratch_buffer;
guint scratch_buffer_len;
/* SCROLLING */
gint last_ver_value;
/* CURSOR */
gint cursor_pos_x; /* Position of cursor. */
gint cursor_pos_y; /* Baseline of line cursor is drawn on. */
GtkPropertyMark cursor_mark; /* Where it is in the buffer. */
GdkWChar cursor_char; /* Character to redraw. */
gchar cursor_char_offset; /* Distance from baseline of the font. */
gint cursor_virtual_x; /* Where it would be if it could be. */
gint cursor_drawn_level; /* How many people have undrawn. */
/* Current Line */
GList *current_line;
/* Tab Stops */
GList *tab_stops;
gint default_tab_width;
GtkTextFont *current_font; /* Text font for current style */
/* Timer used for auto-scrolling off ends */
gint timer;
guint button; /* currently pressed mouse button */
GdkGC *bg_gc; /* gc for drawing background pixmap */
};
struct _GtkTextClass
{
GtkOldEditableClass parent_class;
void (*set_scroll_adjustments) (GtkText *text,
GtkAdjustment *hadjustment,
GtkAdjustment *vadjustment);
};
GtkType gtk_text_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_text_new (GtkAdjustment *hadj,
GtkAdjustment *vadj);
void gtk_text_set_editable (GtkText *text,
gboolean editable);
void gtk_text_set_word_wrap (GtkText *text,
gint word_wrap);
void gtk_text_set_line_wrap (GtkText *text,
gint line_wrap);
void gtk_text_set_adjustments (GtkText *text,
GtkAdjustment *hadj,
GtkAdjustment *vadj);
void gtk_text_set_point (GtkText *text,
guint index);
guint gtk_text_get_point (GtkText *text);
guint gtk_text_get_length (GtkText *text);
void gtk_text_freeze (GtkText *text);
void gtk_text_thaw (GtkText *text);
void gtk_text_insert (GtkText *text,
GdkFont *font,
GdkColor *fore,
GdkColor *back,
const char *chars,
gint length);
gint gtk_text_backward_delete (GtkText *text,
guint nchars);
gint gtk_text_forward_delete (GtkText *text,
guint nchars);
#define GTK_TEXT_INDEX(t, index) (((t)->use_wchar) \
? ((index) < (t)->gap_position ? (t)->text.wc[index] : \
(t)->text.wc[(index)+(t)->gap_size]) \
: ((index) < (t)->gap_position ? (t)->text.ch[index] : \
(t)->text.ch[(index)+(t)->gap_size]))
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GTK_TEXT_H__ */