Re: Selection, Cut & Paste




Akkana Peck <akkana@netscape.com> writes:

> Chris McAfee wrote:
> > Mozilla is struggling to understand how the selection
> > code works so we can implement cut & paste,
> > anyone have a code sample or similar reference?
> 
> In particular: we're confused about the difference between
> gtk_selection_add_target and gtk_selection_add_targets (they seem to
> trigger different callbacks) 

They should not be triggering different callbacks. 
gtk_selection_add_targets() is just a convenient way
of adding a bunch of targets (as you would do with
gtk_selection_add_target()) at one time.

> and about what is the approved way to
> advertise and receive selections when multiple types need to be
> handled, and when there can be conversion between the multiple types
> (e.g. html or rich text to plain text).

If you look at gtkeditable.c, you'll find an example of
handling multiple types of conversion data. 

It's a little complicated because it is mixing handling
for the PRIMARY and CLIPBOARD selections, and because
of the way asking for TEXT can return either STRING
or COMPOUND_TEXT. However, it's probably comprehensible.

For documentation, see 

 1) the selections section of the tutorial
 2) docs/Changes-1.2.txt (1) is a bit out of date)
 3) http://www.gtk.org/rdp/gtk/gtk-selections.html

Hope this is useful,
                                        Owen



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