2003-04-02 Chris Toshok <toshok@ximian.com> [ either fixes #39702 or comes damn, damn close. also, fixes EText to not suck *nearly* as much. ] * gal/util/e-marshal.list: add NONE:POINTER,INT,OBJECT. * gal/e-text/e-entry.h: (struct _EEntryClass): popup -> populate_popup. * gal/e-text/e-entry.c (proxy_changed): rename, the old name was too damn long. (proxy_activate): same. (proxy_populate_popup): same, and change from popup to populate_popup. (e_entry_init): track change to cb names, and populate_popup. also, pass the ECanvas's im_context to the EText. (e_entry_class_init): POPUP -> POPULATE_POPUP. * gal/e-text/e-text.h (struct _EText): remove the old selection stuff, and add im_context/reset_im_context fields. (struct _ETextClass): popup -> populate_popup. * gal/e-text/e-text.c (e_text_dispose): remove all the GtkInvisible based selection stuff, and disconnect from/unref the im_context. (e_text_set_property): add "im_context" handling. (e_text_get_property): same. (e_text_event): connect/disconnect from the IM context's signals in the FOCUS_CHANGE handler. in the KEY_PRESS/RELEASE handler, use gtk_im_context_filter_keypress if we have an im_context. also, use e_text_do_popup now instead of just emitting the "popup" signal. (e_text_copy_clipboard): new function. (e_text_delete_selection): new function. (e_text_cut_clipboard): new function. (e_text_paste_clipboard): new function. (e_text_select_all): new function. (primary_get_cb): new function, handle requests for the primary selection when we're the owner. (primary_clear_cb): new function, unfinished. (e_text_update_primary_selection): new function. (paste_received): new function, insert pasted text. (e_text_paste): new function, (popup_menu_detach): new function, not needed really. (popup_targets_received): new function, pop up the popup once we have the selection information necessary to sensitize the c/c/p buttons. (e_text_do_popup): new function, request the selection. (e_text_reset_im_context): new function. (e_text_command): for E_TEP_SELECT, call e_text_update_primary_selection. for E_TEP_DELETE/INSERT, _delete_selection -> e_text_delete_selection. for E_TEP_COPY, call e_text_copy_clipboard. for E_TEP_PASTE/E_TEP_GET_SELECTION call e_text_paste. (e_text_class_init): change the "popup" signal to "populate_popup". Also, add the "im_context" property. (e_text_commit_cb): new function. IM context callback. (e_text_retrieve_surrounding_cb): new function. IM context callback. (e_text_delete_surrounding_cb): new function. IM context callback. unfinished. svn path=/trunk/; revision=20653
88 lines
2.9 KiB
C
88 lines
2.9 KiB
C
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
|
/*
|
|
* e-entry.h - An EText-based entry widget
|
|
* Copyright 2000, 2001, Ximian, Inc.
|
|
*
|
|
* Authors:
|
|
* Chris Lahey <clahey@ximian.com>
|
|
* Jon Trowbridge <trow@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_ENTRY_H_
|
|
#define _E_ENTRY_H_
|
|
|
|
#include <libgnomecanvas/gnome-canvas.h>
|
|
#include <gtk/gtktable.h>
|
|
#include <libxml/tree.h>
|
|
#include <gal/e-text/e-text.h>
|
|
#include "e-completion.h"
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
#define E_ENTRY_TYPE (e_entry_get_type ())
|
|
#define E_ENTRY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_ENTRY_TYPE, EEntry))
|
|
#define E_ENTRY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_ENTRY_TYPE, EEntryClass))
|
|
#define E_IS_ENTRY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_ENTRY_TYPE))
|
|
#define E_IS_ENTRY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_ENTRY_TYPE))
|
|
|
|
typedef struct _EEntry EEntry;
|
|
typedef struct _EEntryClass EEntryClass;
|
|
struct _EEntryPrivate;
|
|
|
|
typedef void (*EEntryCompletionHandler) (EEntry *entry, ECompletionMatch *match);
|
|
|
|
struct _EEntry {
|
|
GtkTable parent;
|
|
|
|
GnomeCanvas *canvas;
|
|
EText *item;
|
|
|
|
struct _EEntryPrivate *priv;
|
|
};
|
|
|
|
struct _EEntryClass {
|
|
GtkTableClass parent_class;
|
|
|
|
void (* changed) (EEntry *entry);
|
|
void (* activate) (EEntry *entry);
|
|
void (* populate_popup) (EEntry *entry, GdkEventButton *ev, gint pos, GtkMenu *menu);
|
|
void (* completion_popup) (EEntry *entry, gint visible);
|
|
};
|
|
|
|
GtkType e_entry_get_type (void);
|
|
|
|
void e_entry_construct (EEntry *entry);
|
|
GtkWidget *e_entry_new (void);
|
|
|
|
const gchar *e_entry_get_text (EEntry *entry);
|
|
void e_entry_set_text (EEntry *entry, const gchar *text);
|
|
|
|
gint e_entry_get_position (EEntry *entry);
|
|
void e_entry_set_position (EEntry *entry, gint);
|
|
void e_entry_select_region (EEntry *entry, gint start, gint end);
|
|
|
|
void e_entry_set_editable (EEntry *entry, gboolean editable);
|
|
|
|
void e_entry_enable_completion (EEntry *entry, ECompletion *completion);
|
|
void e_entry_enable_completion_full (EEntry *entry, ECompletion *completion, gint autocomplete_delay,
|
|
EEntryCompletionHandler handler);
|
|
gboolean e_entry_completion_popup_is_visible (EEntry *entry);
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* _E_ENTRY_H_ */
|