GtkTextView - TextTags: borders



Hi

I haven't been able to find a way of how to surround a range of text
with a border, but I guess GtkTextView doesn't support it - it is a hard
to define feature anyway.

Well, my question is, how would you go about to implement such a feature
in GtkTextView? Does Pango support such a thing? Can you give me some
hints, please? I am willing to look into it and implement it (if at all
possible) - if this is not a desired feature of GtkTextView (or
GtkSourceView for that matter) I can still implement the feature in a
foreign struct.

Also I am interested in how TextView layouts its text. Does it draw all
the text into a big enough widget and lets the scroll container do all
the work? How does it know into which line a part of text should be
drawn? Does the TextBuffer store text in a collection of 'lines'? Where
does the 'styling' of text happen? Where is the info of GtkTextTags
processed and applied/drawn?

Well, I've been looking at GtkTextView's source (for a few minutes) and
I can say, without error, that I learned nothing :D Well, I've found a
lot of GtkTextLayout references (but I have not found GtkTextLayout's
source) - I suppose this one does the actual drawing of text, does it?
Also, I haven't seen the part of code that would handle the GtkTextTags
info (looking at gtktextview.c).

I would like to know the above because I'm interested in how difficult
the algorithms for discovering mouse button clicks on a range of text
are. Also, I'm interested how would one implement something like what is
depicted in the attached image (note the borders and the hidden text
which is still in the TextBuffer but is not drawn...)? Is it hard to
detect mouse clicks on a range of text (e.g.: in the example it would
have the effect of unfolding the folded code)?

We expect to need this in MonoDevelop, and of course, there are other
features I would like TextView to have, but I think if I get to know the
internals of TextView just a little more, I could perhaps find out all
the answers on my own - eventually....

Thanks in advance!


Regards,
---
Matej

Attachment: borders.png
Description: PNG image



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