Commit dfba2269 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

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.
parent b9d32873
......@@ -19,6 +19,7 @@ testtree
gtkcompat.h
testthreads
libgtk.la
gtkfeatures.h
gtkmarshal.h
gtktypebuiltins.h
gtkmarshal.c
......@@ -30,3 +31,5 @@ testdnd
stamp-gtktypebuiltins.h
stamp-gtkmarshal.h
stamp-gtk.defs
gtk-query-immodules-2.0
gtk.immodules
......@@ -104,6 +104,7 @@ gtk_public_h_sources = @STRIP_BEGIN@ \
gtkiconfactory.h \
gtkimage.h \
gtkimcontext.h \
gtkimmodule.h \
gtkimmulticontext.h \
gtkinputdialog.h \
gtkinvisible.h \
......@@ -124,6 +125,7 @@ gtk_public_h_sources = @STRIP_BEGIN@ \
gtkmisc.h \
gtkmodelsimple.h \
gtknotebook.h \
gtkoldeditable.h \
gtkobject.h \
gtkoptionmenu.h \
gtkpacker.h \
......@@ -163,7 +165,6 @@ gtk_public_h_sources = @STRIP_BEGIN@ \
gtktexttagtable.h \
gtktextview.h \
gtktext.h \
gtkthemes.h \
gtktipsquery.h \
gtktogglebutton.h \
gtktoolbar.h \
......@@ -198,6 +199,7 @@ gtk_private_h_sources = @STRIP_BEGIN@ \
gtktextiterprivate.h \
gtktextmarkprivate.h \
gtktexttagprivate.h \
gtkthemes.h \
gtktreeprivate.h \
@STRIP_END@
# GTK+ C sources to build the library from
......@@ -257,6 +259,7 @@ gtk_c_sources = @STRIP_BEGIN@ \
gtkimcontext.c \
gtkimcontextsimple.c \
gtkimcontextsimple.h \
gtkimmodule.c \
gtkimmulticontext.c \
gtkinputdialog.c \
gtkintl.h \
......@@ -279,6 +282,7 @@ gtk_c_sources = @STRIP_BEGIN@ \
gtkmodelsimple.c \
gtknotebook.c \
gtkobject.c \
gtkoldeditable.c \
gtkoptionmenu.c \
gtkpacker.c \
gtkpaned.c \
......@@ -543,11 +547,9 @@ install-data-local:
uninstall-local:
rm -f $(DESTDIR)$(datadir)/themes/Default/gtk-2.0/gtkrc
#
# test programs, not to be installed
#
noinst_PROGRAMS = testgtk testcalendar testinput testselection testrgb testdnd testtext simple treestoretest testtextbuffer # testthreads
DEPS = @gtktargetlib@ $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-1.3.la $(top_builddir)/gdk/@gdktargetlib@
DEPS = @gtktargetlib@ $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-1.3.la $(top_builddir)/gdk/@gdktargetlib@
TEST_DEPS = $(DEPS) gtk.immodules
LDADDS = @STRIP_BEGIN@ \
@gtktargetlib@ \
$(top_builddir)/gdk-pixbuf/libgdk_pixbuf-1.3.la \
......@@ -561,25 +563,44 @@ LDADDS = @STRIP_BEGIN@ \
-lm \
@STRIP_END@
testgtk_DEPENDENCIES = $(DEPS)
testcalendar_DEPENDENCIES = $(DEPS)
testinput_DEPENDENCIES = $(DEPS)
testselection_DEPENDENCIES = $(DEPS)
testrgb_DEPENDENCIES = $(DEPS)
testtext_DEPENDENCIES = $(DEPS)
testtextbuffer_DEPENDENCIES = $(DEPS)
treestoretest_DEPENDENCIES = $(DEPS)
testdnd_DEPENDENCIES = $(DEPS)
simple_DEPENDENCIES = $(DEPS)
#testthreads_DEPENDENCIES = $(DEPS)
#
# Installed tools
#
bin_PROGRAMS = gtk-query-immodules-2.0
gtk_query_immodules_2_0_DEPENDENCIES = $(DEPS)
gtk_query_immodules_2_0_LDADD = $(LDADDS)
gtk_query_immodules_2_0_SOURCES = queryimmodules.c
gtk.immodules: gtk-query-immodules-2.0
./gtk-query-immodules-2.0 ../modules/input/.libs/*.so > gtk.immodules
#
# test programs, not to be installed
#
noinst_PROGRAMS = testgtk testcalendar testinput testselection testrgb testdnd testtext simple treestoretest testtextbuffer # testthreads
testcalendar_DEPENDENCIES = $(TEST_DEPS)
testgtk_DEPENDENCIES = $(TEST_DEPS)
testinput_DEPENDENCIES = $(TEST_DEPS)
testrgb_DEPENDENCIES = $(TEST_DEPS)
testselection_DEPENDENCIES = $(TEST_DEPS)
testtext_DEPENDENCIES = $(TEST_DEPS)
testtextbuffer_DEPENDENCIES = $(TEST_DEPS)
treestoretest_DEPENDENCIES = $(TEST_DEPS)
testdnd_DEPENDENCIES = $(TEST_DEPS)
simple_DEPENDENCIES = $(TEST_DEPS)
#testthreads_DEPENDENCIES = $(TEST_DEPS)
testcalendar_LDADD = $(LDADDS)
testgtk_LDADD = $(LDADDS)
testinput_LDADD = $(LDADDS)
testrgb_LDADD = $(LDADDS)
testselection_LDADD = $(LDADDS)
testtext_LDADD = $(LDADDS)
treestoretest_LDADD = $(LDADDS)
testtextbuffer_LDADD = $(LDADDS)
testrgb_LDADD = $(LDADDS)
treestoretest_LDADD = $(LDADDS)
testdnd_LDADD = $(LDADDS)
simple_LDADD = $(LDADDS)
#testthreads_LDADD = $(LDADDS)
......
......@@ -104,6 +104,7 @@
#include <gtk/gtkmodelsimple.h>
#include <gtk/gtknotebook.h>
#include <gtk/gtkobject.h>
#include <gtk/gtkoldeditable.h>
#include <gtk/gtkoptionmenu.h>
#include <gtk/gtkpacker.h>
#include <gtk/gtkpaned.h>
......@@ -133,7 +134,6 @@
#include <gtk/gtktext.h>
#include <gtk/gtktextbuffer.h>
#include <gtk/gtktextview.h>
#include <gtk/gtkthemes.h>
#include <gtk/gtktipsquery.h>
#include <gtk/gtktogglebutton.h>
#include <gtk/gtktoolbar.h>
......
......@@ -60,7 +60,7 @@ static void gtk_cell_renderer_text_pixbuf_render (GtkCellRenderer
guint flags);
GtkCellRendererTextClass *parent_class = NULL;
static GtkCellRendererTextClass *parent_class = NULL;
GtkType
......
......@@ -132,6 +132,7 @@ gtk_combo_entry_key_press (GtkEntry * entry, GdkEventKey * event, GtkCombo * com
/* completion */
if ((event->keyval == GDK_Tab) && (event->state & GDK_MOD1_MASK))
{
GtkEditable *editable = GTK_EDITABLE (entry);
GCompletion * cmpl;
gchar* prefix;
gchar* nprefix = NULL;
......@@ -145,16 +146,16 @@ gtk_combo_entry_key_press (GtkEntry * entry, GdkEventKey * event, GtkCombo * com
cmpl = g_completion_new ((GCompletionFunc)gtk_combo_func);
g_completion_add_items (cmpl, GTK_LIST (combo->list)->children);
pos = GTK_EDITABLE (entry)->current_pos;
prefix = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, pos);
pos = gtk_editable_get_position (editable);
prefix = gtk_editable_get_chars (editable, 0, pos);
g_completion_complete(cmpl, prefix, &nprefix);
if (nprefix && strlen (nprefix) > strlen (prefix))
{
gtk_editable_insert_text (GTK_EDITABLE (entry), nprefix + pos,
strlen (nprefix) - strlen (prefix), &pos);
GTK_EDITABLE (entry)->current_pos = pos;
gtk_editable_insert_text (editable, nprefix + pos,
strlen (nprefix) - strlen (prefix), &pos);
gtk_editable_set_position (editable, pos);
}
if (nprefix)
......
This diff is collapsed.
......@@ -31,132 +31,73 @@
#include <gdk/gdk.h>
#include <gtk/gtkwidget.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define GTK_TYPE_EDITABLE (gtk_editable_get_type ())
#define GTK_EDITABLE(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_EDITABLE, GtkEditable))
#define GTK_EDITABLE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_EDITABLE, GtkEditableClass))
#define GTK_IS_EDITABLE(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_EDITABLE))
#define GTK_IS_EDITABLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_EDITABLE))
#define GTK_EDITABLE_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_EDITABLE, GtkEditableClass))
#define GTK_TYPE_EDITABLE (gtk_editable_get_type ())
#define GTK_EDITABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_EDITABLE, GtkEditable))
#define GTK_EDITABLE_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), GTK_TYPE_EDITABLE, GtkEditableClass))
#define GTK_IS_EDITABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_EDITABLE))
#define GTK_IS_EDITABLE_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), GTK_TYPE_EDITABLE))
#define GTK_EDITABLE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_EDITABLE, GtkEditableClass))
typedef struct _GtkEditable GtkEditable;
typedef struct _GtkEditable GtkEditable; /* Dummy typedef */
typedef struct _GtkEditableClass GtkEditableClass;
typedef void (*GtkTextFunction) (GtkEditable *editable, guint32 time);
struct _GtkEditable
{
GtkWidget widget;
/*< public >*/
guint current_pos;
guint selection_start_pos;
guint selection_end_pos;
guint has_selection : 1;
/*< private >*/
guint editable : 1;
guint visible : 1;
GdkIC *ic;
GdkICAttr *ic_attr;
gchar *clipboard_text;
};
struct _GtkEditableClass
{
GtkWidgetClass parent_class;
GTypeInterface base_iface;
/* Signals for notification/filtering of changes */
void (* changed) (GtkEditable *editable);
void (* insert_text) (GtkEditable *editable,
const gchar *text,
gint length,
gint *position);
void (* delete_text) (GtkEditable *editable,
gint start_pos,
gint end_pos);
/* Bindings actions */
void (* activate) (GtkEditable *editable);
void (* set_editable) (GtkEditable *editable,
gboolean is_editable);
void (* move_cursor) (GtkEditable *editable,
gint x,
gint y);
void (* move_word) (GtkEditable *editable,
gint n);
void (* move_page) (GtkEditable *editable,
gint x,
gint y);
void (* move_to_row) (GtkEditable *editable,
gint row);
void (* move_to_column) (GtkEditable *editable,
gint row);
void (* kill_char) (GtkEditable *editable,
gint direction);
void (* kill_word) (GtkEditable *editable,
gint direction);
void (* kill_line) (GtkEditable *editable,
gint direction);
void (* cut_clipboard) (GtkEditable *editable);
void (* copy_clipboard) (GtkEditable *editable);
void (* paste_clipboard) (GtkEditable *editable);
/* Virtual functions. get_chars is in paricular not a signal because
* it returns malloced memory. The others are not signals because
* they would not be particularly useful as such. (All changes to
* selection and position do not go through these functions)
*/
void (* update_text) (GtkEditable *editable,
gint start_pos,
gint end_pos);
gchar* (* get_chars) (GtkEditable *editable,
gint start_pos,
gint end_pos);
void (* set_selection)(GtkEditable *editable,
gint start_pos,
gint end_pos);
void (* set_position) (GtkEditable *editable,
gint position);
void (* insert_text) (GtkEditable *editable,
const gchar *text,
gint length,
gint *position);
void (* delete_text) (GtkEditable *editable,
gint start_pos,
gint end_pos);
gchar* (* get_chars) (GtkEditable *editable,
gint start_pos,
gint end_pos);
void (* set_selection_bounds) (GtkEditable *editable,
gint start_pos,
gint end_pos);
gboolean (* get_selection_bounds) (GtkEditable *editable,
gint *start_pos,
gint *end_pos);
void (* set_position) (GtkEditable *editable,
gint position);
gint (* get_position) (GtkEditable *editable);
};
GtkType gtk_editable_get_type (void) G_GNUC_CONST;
void gtk_editable_select_region (GtkEditable *editable,
gint start,
gint end);
void gtk_editable_insert_text (GtkEditable *editable,
const gchar *new_text,
gint new_text_length,
gint *position);
void gtk_editable_delete_text (GtkEditable *editable,
gint start_pos,
gint end_pos);
gchar* gtk_editable_get_chars (GtkEditable *editable,
gint start_pos,
gint end_pos);
void gtk_editable_cut_clipboard (GtkEditable *editable);
void gtk_editable_copy_clipboard (GtkEditable *editable);
void gtk_editable_paste_clipboard (GtkEditable *editable);
void gtk_editable_claim_selection (GtkEditable *editable,
gboolean claim,
guint32 time);
void gtk_editable_delete_selection (GtkEditable *editable);
void gtk_editable_changed (GtkEditable *editable);
void gtk_editable_set_position (GtkEditable *editable,
gint position);
gint gtk_editable_get_position (GtkEditable *editable);
void gtk_editable_set_editable (GtkEditable *editable,
gboolean is_editable);
GtkType gtk_editable_get_type (void) G_GNUC_CONST;
void gtk_editable_select_region (GtkEditable *editable,
gint start,
gint end);
gboolean gtk_editable_get_selection_bounds (GtkEditable *editable,
gint *start,
gint *end);
void gtk_editable_insert_text (GtkEditable *editable,
const gchar *new_text,
gint new_text_length,
gint *position);
void gtk_editable_delete_text (GtkEditable *editable,
gint start_pos,
gint end_pos);
gchar* gtk_editable_get_chars (GtkEditable *editable,
gint start_pos,
gint end_pos);
void gtk_editable_cut_clipboard (GtkEditable *editable);
void gtk_editable_copy_clipboard (GtkEditable *editable);
void gtk_editable_paste_clipboard (GtkEditable *editable);
void gtk_editable_delete_selection (GtkEditable *editable);
void gtk_editable_set_position (GtkEditable *editable,
gint position);
gint gtk_editable_get_position (GtkEditable *editable);
void gtk_editable_set_editable (GtkEditable *editable,
gboolean is_editable);
#ifdef __cplusplus
}
......
This diff is collapsed.
......@@ -51,57 +51,106 @@ typedef struct _GtkEntryClass GtkEntryClass;
struct _GtkEntry
{
GtkEditable editable;
GtkWidget widget;
GdkWindow *text_area;
GdkPixmap *backing_pixmap;
GdkCursor *cursor;
gchar *text;
guint16 text_size; /* allocated size, in bytes */
guint editable : 1;
guint visible : 1;
guint overwrite_mode : 1;
guint16 text_length; /* length in use, in chars */
guint16 text_max_length;
/*< private >*/
GdkWindow *text_area;
GtkIMContext *im_context;
GtkWidget *popup_menu;
gint current_pos;
gint selection_bound;
PangoLayout *cached_layout;
guint cache_includes_preedit : 1;
guint need_im_reset : 1;
guint button;
guint32 timer;
guint16 n_bytes; /* length in use, in bytes */
PangoLayout *layout;
guint timer;
guint recompute_idle;
gint scroll_offset;
gint ascent; /* font ascent, in pango units */
gint descent; /* font descent, in pango units */
GtkIMContext *im_context;
guint16 text_size; /* allocated size, in bytes */
guint16 n_bytes; /* length in use, in bytes */
guint16 preedit_length; /* length of preedit string, in bytes */
guint16 preedit_cursor; /* offset of cursor within preedit string, in bytes */
};
struct _GtkEntryClass
{
GtkEditableClass parent_class;
GtkWidgetClass parent_class;
/* Notification of changes
*/
void (* changed) (GtkEntry *entry);
void (* insert_text) (GtkEntry *entry,
const gchar *text,
gint length,
gint *position);
void (* delete_text) (GtkEntry *entry,
gint start_pos,
gint end_pos);
/* Action signals
*/
void (* activate) (GtkEntry *entry);
void (* move) (GtkEntry *entry,
GtkMovementStep step,
gint count,
gboolean extend_selection);
void (* insert) (GtkEntry *entry,
const gchar *str);
void (* delete) (GtkEntry *entry,
GtkDeleteType type,
gint count);
void (* cut_clipboard) (GtkEntry *entry);
void (* copy_clipboard) (GtkEntry *entry);
void (* paste_clipboard) (GtkEntry *entry);
void (* toggle_overwrite) (GtkEntry *entry);
};
GtkType gtk_entry_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_entry_new (void);
GtkWidget* gtk_entry_new_with_max_length (guint16 max);
void gtk_entry_set_visibility (GtkEntry *entry,
gboolean visible);
void gtk_entry_set_editable (GtkEntry *entry,
gboolean editable);
/* text is truncated if needed */
void gtk_entry_set_max_length (GtkEntry *entry,
guint16 max);
/* Somewhat more convenient than the GtkEditable generic functions
*/
void gtk_entry_set_text (GtkEntry *entry,
const gchar *text);
/* returns a reference to the text */
gchar* gtk_entry_get_text (GtkEntry *entry);
/* Deprecated compatibility functions
*/
GtkWidget* gtk_entry_new_with_max_length (guint16 max);
void gtk_entry_append_text (GtkEntry *entry,
const gchar *text);
void gtk_entry_prepend_text (GtkEntry *entry,
const gchar *text);
void gtk_entry_set_position (GtkEntry *entry,
gint position);
/* returns a reference to the text */
gchar* gtk_entry_get_text (GtkEntry *entry);
void gtk_entry_select_region (GtkEntry *entry,
gint start,
gint end);
void gtk_entry_set_visibility (GtkEntry *entry,
gboolean visible);
void gtk_entry_set_editable (GtkEntry *entry,
gboolean editable);
/* text is truncated if needed */
void gtk_entry_set_max_length (GtkEntry *entry,
guint16 max);
#ifdef __cplusplus
}
......
......@@ -35,7 +35,8 @@ static void gtk_im_context_init (GtkIMContext *im_context);
static void gtk_im_context_real_get_preedit_string (GtkIMContext *context,
gchar **str,
PangoAttrList **attrs);
PangoAttrList **attrs,
gint *cursor_pos);
static gboolean gtk_im_context_real_filter_keypress (GtkIMContext *context,
GdkEventKey *event);
......@@ -118,12 +119,15 @@ gtk_im_context_init (GtkIMContext *im_context)
static void
gtk_im_context_real_get_preedit_string (GtkIMContext *context,
gchar **str,
PangoAttrList **attrs)
PangoAttrList **attrs,
gint *cursor_pos)
{
if (str)
*str = g_strdup ("");
if (attrs)
*attrs = pango_attr_list_new ();
if (cursor_pos)
*cursor_pos = 0;
}
static gboolean
......@@ -175,7 +179,8 @@ gtk_im_context_set_client_window (GtkIMContext *context,
void
gtk_im_context_get_preedit_string (GtkIMContext *context,
gchar **str,
PangoAttrList **attrs)
PangoAttrList **attrs,
gint *cursor_pos)
{
GtkIMContextClass *klass;
......@@ -183,7 +188,7 @@ gtk_im_context_get_preedit_string (GtkIMContext *context,
g_return_if_fail (GTK_IS_IM_CONTEXT (context));
klass = GTK_IM_CONTEXT_GET_CLASS (context);
klass->get_preedit_string (context, str, attrs);
klass->get_preedit_string (context, str, attrs, cursor_pos);
}
/**
......@@ -235,7 +240,7 @@ gtk_im_context_focus_in (GtkIMContext *context)
}
/**
* gtk_im_context_focus_in:
* gtk_im_context_focus_out:
* @context: a #GtkIMContext
*
* Notify the input method that the widget to which this
......@@ -256,4 +261,25 @@ gtk_im_context_focus_out (GtkIMContext *context)
klass->focus_out (context);
}
/**
* gtk_im_context_reset:
* @context: a #GtkIMContext
*
* Notify the input method that a change such as a change in cursor
* position has been made. This will typically cause the input
* method to clear the preedit state.
**/
void
gtk_im_context_reset (GtkIMContext *context)
{
GtkIMContextClass *klass;
g_return_if_fail (context != NULL);
g_return_if_fail (GTK_IS_IM_CONTEXT (context));
klass = GTK_IM_CONTEXT_GET_CLASS (context);
if (klass->reset)
klass->reset (context);
}
......@@ -60,11 +60,13 @@ struct _GtkIMContextClass
GdkWindow *window);
void (*get_preedit_string) (GtkIMContext *context,
gchar **str,
PangoAttrList **attrs);
PangoAttrList **attrs,
gint *cursor_pos);
gboolean (*filter_keypress) (GtkIMContext *context,
GdkEventKey *event);
void (*focus_in) (GtkIMContext *context);
void (*focus_out) (GtkIMContext *context);
void (*reset) (GtkIMContext *context);
};
GtkType gtk_im_context_get_type (void) G_GNUC_CONST;
......@@ -72,12 +74,14 @@ GtkType gtk_im_context_get_type (void) G_GNUC_CONST;
void gtk_im_context_set_client_window (GtkIMContext *context,
GdkWindow *window);
void gtk_im_context_get_preedit_string (GtkIMContext *context,
char **str,
PangoAttrList **attrs);
gchar **str,
PangoAttrList **attrs,
gint *cursor_pos);
gboolean gtk_im_context_filter_keypress (GtkIMContext *context,
GdkEventKey *event);
void gtk_im_context_focus_in (GtkIMContext *context);
void gtk_im_context_focus_out (GtkIMContext *context);
void gtk_im_context_reset (GtkIMContext *context);
#ifdef __cplusplus
}
......
This diff is collapsed.
......@@ -38,13 +38,17 @@ extern "C" {
typedef struct _GtkIMContextSimple GtkIMContextSimple;
typedef struct _GtkIMContextSimpleClass GtkIMContextSimpleClass;
#define GTK_MAX_COMPOSE_LEN 4
#define GTK_MAX_COMPOSE_LEN 7
struct _GtkIMContextSimple
{
GtkIMContext object;
GSList *tables;
guint compose_buffer[GTK_MAX_COMPOSE_LEN + 1];
gunichar tentative_match;
gint tentative_match_len;
};
struct _GtkIMContextSimpleClass
......@@ -53,8 +57,12 @@ struct _GtkIMContextSimpleClass
};
GtkType gtk_im_context_simple_get_type (void) G_GNUC_CONST;
GtkIMContext *gtk_im_context_simple_new (void);
GtkIMContext *gtk_im_context_simple_new (void);
void gtk_im_context_simple_add_table (GtkIMContextSimple *context_simple,
guint16 *data,
gint max_seq_len,
gint n_seqs);
#ifdef __cplusplus
}
#endif /* __cplusplus */
......
This diff is collapsed.
/* GTK - The GIMP Toolkit
* Copyright (C) 2000 Red Hat Software
*
* 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.
*/
#ifndef __GTK_IM_MODULE_H__
#define __GTK_IM_MODULE_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <gtk/gtkimcontext.h>
typedef struct _GtkIMContextInfo GtkIMContextInfo;
struct _GtkIMContextInfo
{
const gchar *context_id;
const gchar *context_name;
const gchar *domain;
const gchar *domain_dirname;
const gchar *default_locales;
};
/* Functions for use within GTK+
*/
void _gtk_im_module_list (const GtkIMContextInfo ***contexts,
guint *n_contexts);
GtkIMContext *_gtk_im_module_create (const gchar *context_id);
const gchar * _gtk_im_module_get_default_context_id (const gchar *lang);
/* The following entry points are exported by each input method module
*/
/*
void im_module_list (const GtkIMContextInfo ***contexts,
guint *n_contexts);
void im_module_init (GtkModule *module);
void im_module_exit (void);
GtkIMContext *im_module_create (const gchar *context_id);
*/
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif __GTK_IM_MODULE_H__
This diff is collapsed.
......@@ -21,6 +21,7 @@
#define __GTK_IM_MULTICONTEXT_H__
#include <gtk/gtkimcontext.h>
#include <gtk/gtkmenushell.h>
#ifdef __cplusplus
extern "C" {
......@@ -43,6 +44,10 @@ struct _GtkIMMulticontext
GtkIMContext object;
GtkIMContext *slave;
GdkWindow *client_window;
const gchar *context_id;
};
struct _GtkIMMulticontextClass
......@@ -53,6 +58,9 @@ struct _GtkIMMulticontextClass
GtkType gtk_im_multicontext_get_type (void) G_GNUC_CONST;
GtkIMContext *gtk_im_multicontext_new (void);
void gtk_im_multicontext_append_menuitems (GtkIMMulticontext *context,
GtkMenuShell *menushell);
#ifdef __cplusplus
}