Files
evolution/widgets/table/e-cell.h
Suresh Chandrasekharan 0517e6655c Support for preedit in e-text widgets.
2003-10-14  Suresh Chandrasekharan  <suresh.chandrasekharan@sun.com>

	* Support for preedit in e-text widgets.

	* gal/gal/e-text/e-text.c: Added e_text_preedit_changed_cb and
	insert_preedit_text.

	* Modified the following functions.
	(e_text_draw) Calls insert_preedit_text also cursor pos @ the end of
	text->selection_start + text->preedit_len

	(e_text_event) Added hooks for preedit_cb
	(e_text_init) Inits text->preedit_len
	(e_text_retrieve_surrounding_cb) Removed printf
	(e_text_delete_surrounding_cb) Correct params for
	gtk_editable_delete_text to make it work.

	* gal/gal/e-text/e-text.h: Added preedit_len in struct _EText


2003-09-25  Suresh Chandrasekharan  <suresh.chandrasekharan@sun.com>

	* Fix for "44222 task summary entry widget not i18ned". The following
	files are changed.

	* gal/gal/e-table/e-cell-text.c: Lots of changes for i18n
	selection/input support. Added these functions for input method support.

	(e_cell_text_preedit_changed_cb)
	(e_cell_text_commit_cb)
	(e_cell_text_retrieve_surrounding_cb)
	(e_cell_text_delete_surrounding_cb)

	(layout_with_preedit) This function inserts the preedit string
	with the right attribs to the layout text.

	(build_attr_list) Creates the PangoAttrList with bold/stikeout/underline
	as applicable for the current ECellText.

	The following functions are modified.

	(ect_stop_editing): disconnect signal handlers when editing stops

	(ect_draw): Changes for including the preedit only to the currently
	selected row/col. Also display the cursor at the end of preedit text.

	(ect_event): Connects the IM callbacks to the key press event.
	Disconnect when not in editing mode. Also a special flag to see
	when Enter key pressed in preedit mode, the text is committed only
	not a new row is created. This woks in conjunction with the changes
	made in the eti_event in e-table-item.c file and e-cell.h.

	(ect_height): Changes due to parameters changing for generate_layout

	(ect_enter_edit): Initialization of im_context for a cell text and
	assoociated flags.

	(ect_max_width):  Changes due to parameters changing for
	generate_layout.

	(ect_max_width_by_row):  Changes due to parameters changing for
	generate_layout.

	(ect_show_tooltip): Changes due to parameters changing for
	generate_layout.

	(e_cell_text_construct): check whether paramters are NULL.

	(get_position_from_xy): Changes due to parameters changing for
	generate_layout.

	(_insert): Set the selection_start as the minimum of strlen(edit->text)
	and selection_start. Used to correct the preedit_string length
	which may have added to the selection_start.

	(e_cell_text_view_command): When inserting, if in the preedit mode
	do not delete the selection.

	(_selection_get): Set utf8 data instead of string data.

	(_selection_received): Take in UTF8_ATOM inaddition to
	GDK_SELECTION_TYPE_STRING.

	(e_cell_text_view_get_selection): Make utf8 data when acting as a
	selection source.

	* gal/e-table/e-cell-text.h : Included <gtk/gtkmenu.h>

	* gal/e-table/e-cell.h: Added enum E_CELL_PREEDIT to ECellFlags

	* gal/e-table/e-table-item.c: (eti_event) Changes for not committing
	the edited text as a seperate row in preedit mode.

	* gal/e-table/e-table.c: (table_canvas_focus_event_cb) To have
	proper im_context focus for the ecanvas holding the e-table.

svn path=/trunk/; revision=22882
2003-10-14 18:20:18 +00:00

225 lines
9.0 KiB
C

/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* e-cell.h
* Copyright 1999, 2000, 2001, Ximian, Inc.
*
* Authors:
* Miguel de Icaza <miguel@ximian.com>
* Chris Lahey <clahey@ximian.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License, version 2, as published by the Free Software Foundation.
*
* 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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 _E_CELL_H_
#define _E_CELL_H_
#include <gdk/gdktypes.h>
#include <libgnomeprint/gnome-print.h>
#include <libgnomeprint/gnome-font.h>
#include <gal/e-table/e-table-model.h>
#include <gal/e-table/e-table-tooltip.h>
G_BEGIN_DECLS
#define E_CELL_TYPE (e_cell_get_type ())
#define E_CELL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_TYPE, ECell))
#define E_CELL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_TYPE, ECellClass))
#define E_CELL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_CELL_TYPE, ECellClass))
#define E_IS_CELL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_TYPE))
#define E_IS_CELL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_TYPE))
typedef gboolean (*ETableSearchFunc) (gconstpointer haystack,
const char *needle);
typedef enum {
E_CELL_SELECTED = 1 << 0,
E_CELL_JUSTIFICATION = 3 << 1,
E_CELL_JUSTIFY_CENTER = 0 << 1,
E_CELL_JUSTIFY_LEFT = 1 << 1,
E_CELL_JUSTIFY_RIGHT = 2 << 1,
E_CELL_JUSTIFY_FILL = 3 << 1,
E_CELL_ALIGN_LEFT = 1 << 1,
E_CELL_ALIGN_RIGHT = 1 << 2,
E_CELL_FOCUSED = 1 << 3,
E_CELL_EDITING = 1 << 4,
E_CELL_CURSOR = 1 << 5,
E_CELL_PREEDIT = 1 << 6
} ECellFlags;
typedef enum {
E_CELL_GRAB = 1 << 0,
E_CELL_UNGRAB = 1 << 1
} ECellActions;
typedef struct {
GtkObject object;
} ECell;
typedef struct {
ECell *ecell;
ETableModel *e_table_model;
void *e_table_item_view;
gint focus_x1, focus_y1, focus_x2, focus_y2;
gint focus_col, focus_row;
} ECellView;
#define E_CELL_IS_FOCUSED(ecell_view) (ecell_view->focus_x1 != -1)
typedef struct {
GtkObjectClass parent_class;
ECellView *(*new_view) (ECell *ecell, ETableModel *table_model, void *e_table_item_view);
void (*kill_view) (ECellView *ecell_view);
void (*realize) (ECellView *ecell_view);
void (*unrealize) (ECellView *ecell_view);
void (*draw) (ECellView *ecell_view, GdkDrawable *drawable,
int model_col, int view_col, int row,
ECellFlags flags, int x1, int y1, int x2, int y2);
gint (*event) (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions);
void (*focus) (ECellView *ecell_view, int model_col, int view_col,
int row, int x1, int y1, int x2, int y2);
void (*unfocus) (ECellView *ecell_view);
int (*height) (ECellView *ecell_view, int model_col, int view_col, int row);
void *(*enter_edit) (ECellView *ecell_view, int model_col, int view_col, int row);
void (*leave_edit) (ECellView *ecell_view, int model_col, int view_col, int row, void *context);
void *(*save_state) (ECellView *ecell_view, int model_col, int view_col, int row, void *context);
void (*load_state) (ECellView *ecell_view, int model_col, int view_col, int row, void *context, void *save_state);
void (*free_state) (ECellView *ecell_view, int model_col, int view_col, int row, void *save_state);
void (*print) (ECellView *ecell_view, GnomePrintContext *context,
int model_col, int view_col, int row,
gdouble width, gdouble height);
gdouble (*print_height) (ECellView *ecell_view, GnomePrintContext *context,
int model_col, int view_col, int row, gdouble width);
int (*max_width) (ECellView *ecell_view, int model_col, int view_col);
int (*max_width_by_row) (ECellView *ecell_view, int model_col, int view_col, int row);
void (*show_tooltip) (ECellView *ecell_view, int model_col, int view_col, int row, int col_width, ETableTooltip *tooltip);
gchar *(*get_bg_color) (ECellView *ecell_view, int row);
void (*style_set) (ECellView *ecell_view, GtkStyle *previous_style);
} ECellClass;
GType e_cell_get_type (void);
/* View creation methods. */
ECellView *e_cell_new_view (ECell *ecell,
ETableModel *table_model,
void *e_table_item_view);
void e_cell_kill_view (ECellView *ecell_view);
/* Cell View methods. */
gint e_cell_event (ECellView *ecell_view,
GdkEvent *event,
int model_col,
int view_col,
int row,
ECellFlags flags,
ECellActions *actions);
void e_cell_realize (ECellView *ecell_view);
void e_cell_unrealize (ECellView *ecell_view);
void e_cell_draw (ECellView *ecell_view,
GdkDrawable *drawable,
int model_col,
int view_col,
int row,
ECellFlags flags,
int x1,
int y1,
int x2,
int y2);
void e_cell_print (ECellView *ecell_view,
GnomePrintContext *context,
int model_col,
int view_col,
int row,
double width,
double height);
gdouble e_cell_print_height (ECellView *ecell_view,
GnomePrintContext *context,
int model_col,
int view_col,
int row,
gdouble width);
int e_cell_max_width (ECellView *ecell_view,
int model_col,
int view_col);
int e_cell_max_width_by_row (ECellView *ecell_view,
int model_col,
int view_col,
int row);
gboolean e_cell_max_width_by_row_implemented (ECellView *ecell_view);
void e_cell_show_tooltip (ECellView *ecell_view,
int model_col,
int view_col,
int row,
int col_width,
ETableTooltip *tooltip);
gchar *e_cell_get_bg_color (ECellView *ecell_view,
int row);
void e_cell_style_set (ECellView *ecell_view,
GtkStyle *previous_style);
void e_cell_focus (ECellView *ecell_view,
int model_col,
int view_col,
int row,
int x1,
int y1,
int x2,
int y2);
void e_cell_unfocus (ECellView *ecell_view);
int e_cell_height (ECellView *ecell_view,
int model_col,
int view_col,
int row);
void *e_cell_enter_edit (ECellView *ecell_view,
int model_col,
int view_col,
int row);
void e_cell_leave_edit (ECellView *ecell_view,
int model_col,
int view_col,
int row,
void *edit_context);
void *e_cell_save_state (ECellView *ecell_view,
int model_col,
int view_col,
int row,
void *edit_context);
void e_cell_load_state (ECellView *ecell_view,
int model_col,
int view_col,
int row,
void *edit_context,
void *state);
void e_cell_free_state (ECellView *ecell_view,
int model_col,
int view_col,
int row,
void *state);
G_END_DECLS
#endif /* _E_CELL_H_ */