Text widget with 'chunks'




Hello.  I'm writing a meta-configuration tool, and I'd like to know
whether a widget with the following properties exists.

I need a widget that will behave as follows: In general, it will look
like a GtkEntry or a GtkText, but it will allow the application to
insert widgets or chunks of text that act like single characters.

Here's a concrete example.  Suppose my application allows users to
edit a shell prompt.  I'd like them to be able to type characters, but
also select special elements like the current time, the working
directory, and so forth from a pulldown menu.  These elements are
displayed as part of the text.  For example, if I type 'at ', then
select the current time, then type ' %', the text widget should
display something like: 'at [TIME] %', where '[TIME]' is visually
distinct from the rest of the characters.  If I hit the left arrow key
3 times, the cursor should then be immediately to the left of the
'[TIME]' chunk; If I then hit 'DEL', the entire '[TIME]' chunk should
go away.  In other words, chunks should perhaps look like larger
blocks of text (or perhaps widgets?), but behave as though they were
single characters.

Is there a widget that can be made to do this?  If so, then I'd love
to use it.  If not, I could use a little advise in implementing it. Do
you suggest that I should :
   1) Implement this on top of an existing widget, by changing its default
      signal handlers?
   2) Modify the code for an existing widget (which one?) to do this?
   3) Write a new widget from scratch?
   4) Do something else entirely?

Many thanks for your time,

--
Nick Mathewson
<nickm@mit.edu>



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