Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 83406 - Support objects in StyledText
Summary: Support objects in StyledText
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.1   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: 3.2 M4   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 103508 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-01-21 11:15 EST by Veronika Irvine CLA
Modified: 2005-12-19 13:04 EST (History)
14 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Veronika Irvine CLA 2005-01-21 11:15:08 EST
StyledText should support objects such as images or widgets embedded in the 
text.  The text should flow around the objects (that is, it is not sufficient 
for an object to change the height of the row where it is anchored and force 
the remaining text down).
Comment 1 Dejan Glozic CLA 2005-01-21 11:37:05 EST
A nice enhancement is support of images as links. This means:

1) Image links participate in tabbing order
2) Focus indication is drown around them when in focus
3) Mouse changes when over the image link
4) Image can be changed when mouse is over ('hover' image)
5) The same event is fired as for textual links for enter, exit and activation.

Also, image should be selectable with the rest of the text. It should be 
ignored in simple text clipboard content type but added in RTF content type.
Comment 2 Steve Northover CLA 2005-04-04 15:22:35 EDT
Post 3.1.
Comment 3 Felipe Heidrich CLA 2005-07-21 11:37:49 EDT
*** Bug 103508 has been marked as a duplicate of this bug. ***
Comment 4 Felipe Heidrich CLA 2005-11-22 14:44:46 EST
fixed in head > 20051122

we changed StyleRange to be a subclass of TextStyle, the new fields are 
Font font;
int rise;
GlyphMetrics metrics;

StyledText still don't have javadoc for these new features but TextStyle and
TextLayout are ready (java doc + snippets).

The code is still very new and we are aware of some redraw problems, any help
testing/fixing is welcome. Soon I'll add javadoc and snippets to the SWT
homepage.

---
The embedded images/controls use
StyleRange#metrics;
StyledText#addPaintObjectListener()
PaintObjectEvent
PaintObjectListener

---

Dejan, I moved your comments to bug 83408, I think they belong there.
Comment 5 Mark Wallace CLA 2005-12-19 11:50:59 EST
The size of embedded controls\objects should be configurable. Taking the control tag support in FormText as a reference then the equivalent functionality would be to have width and height attributes on the control tag.
Comment 6 Veronika Irvine CLA 2005-12-19 13:04:42 EST
The height and width are already configurable.

See:

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet212.java?rev=HEAD&content-type=text/vnd.viewcvs-markup

StyleRange style = new StyleRange ();
style.start = offset;
style.length = 1;
Rectangle rect = image.getBounds();
style.metrics = new GlyphMetrics(rect.height, 0, rect.width);
styledText.setStyleRange(style);