Or, add another text effect style to wxTextAttrEffects in wx/textctrl.h,
and also some functions to wxRichTextRenderer (a place to put common
drawing functions) to draw the effect using an application-overridable
colour.
It could also be hard-wired into the text-drawing code but using a
renderer, you could supply a new renderer for your application and apply
colour without having to complicate wxRichTextAttr with further members
and attributes (and changing a lot of functions that deal with them)
apart from the text effect style. There could be a default colour set
with a static member of wxRichTextRenderer, so if you only need one
colour, you wouldn't have to supply a new renderer in your application.
The tricky bit would be maintaining the correct attributes for the
pertinent words. You could use a custom wxRichTextDrawingHandler handler
to supply virtual attributes; do the spell check, maintain a list of
words in the current document that should be highlighted, then in your
wxRichTextDrawingHandler::HasVirtualAttributes/GetVirtualAttributes/GetVirtualSubobjectAttributes
functions, test whether the current text object and positions within it
require highlighting, if so adding the text effect style. To use
different colours, you could maybe set a property in the text objects
and query that in the renderer code, or the renderer code could access
your list of words to be highlighted.
With the above, you wouldn't need to calculate text object positions on
the screen, and some of the work would be done by wxRTC instead of your
application.
BTW I recently replaced MySpell with Hunspell in one of my applications
and it was much easier than I thought since the API is largely the same
as MySpell's. I use wxSpellChecker and added new HunspellInterface.cpp/h
file to replace MySpellInterface.cpp/h.
Regards,
Julian
> To unsubscribe, send email to
wx-users+u...@googlegroups.com
> <mailto:
unsub...@googlegroups.com>
> or visit
http://groups.google.com/group/wx-users
> To unsubscribe, send email to
wx-users+u...@googlegroups.com
> or visit
http://groups.google.com/group/wx-users