Re: Text buffer API



on 7/10/00 11:55 AM, Havoc Pennington at hp@redhat.com wrote:

> insert_text is a virtual function (also a signal) that inserts
> text in its default handler. The default handler also resets
> the passed-in iterator to point to the end of the inserted
> text. 
> 
> delete_text is a virtual function/signal that deletes text in
> a range. It resets both iterators to point to the same spot,
> where the deleted text used to exist. (The default handler does
> all the work)
> 
> changed is a simple signal emitted after a change is made. This
> is emitted from the default handler for insert_text and delete_text.
> 
> modified_changed is emitted if the "modified" bit gets flipped
> on or off. This is used to enable/disable a "save" menu item,
> for example.

I haven't had a chance to look over the whole API, but I do want to mention
an issue that came up for us when trying to implement undo in Nautilus and
we were working with a GtkEntry.

For undo, we have a need to distinguish changes to text that happen as a
result of a user action from those that are done by the code. In GtkEntry we
found no signal (other than the widget key down signals) emitted as part of
typing that was not also emitted as a result of calling
gtk_entry_insert_text or gtk_entry_delete_text. As a workaround, we started
on a subclass (poorly implemented -- just good enough for our purposes now)
called NautilusEntry with an additional signal, "user_changed", that we
intend to be emitted only when the change was actually done by the user.

    -- Darin





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]